diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/_meta.json b/sdk/databoxedge/azure-mgmt-databoxedge/_meta.json index 2527cb55f4a7..4268013be3fb 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/_meta.json +++ b/sdk/databoxedge/azure-mgmt-databoxedge/_meta.json @@ -1,8 +1,11 @@ { - "autorest": "3.3.0", - "use": "@autorest/python@5.6.6", - "commit": "cc247b28bd6dc94786fb18e691d6331a168985f6", + "autorest": "3.7.2", + "use": [ + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" + ], + "commit": "754938e4cb9416358b02dcc11f444adf14b3b7b6", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/databoxedge/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.6.6 --version=3.3.0", + "autorest_command": "autorest specification/databoxedge/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/databoxedge/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/__init__.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/__init__.py index e63196b6b98f..577ebf317c02 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/__init__.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/__init__.py @@ -7,10 +7,12 @@ # -------------------------------------------------------------------------- from ._data_box_edge_management_client import DataBoxEdgeManagementClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['DataBoxEdgeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/_configuration.py index 70492096ac98..9e2949933eb0 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/_configuration.py @@ -6,19 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential -VERSION = "unknown" class DataBoxEdgeManagementClientConfiguration(Configuration): """Configuration for DataBoxEdgeManagementClient. @@ -34,16 +33,15 @@ class DataBoxEdgeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -67,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/_data_box_edge_management_client.py index 0e619b3c6ee6..a2200d7fbae3 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/_data_box_edge_management_client.py @@ -6,41 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import DataBoxEdgeManagementClientConfiguration +from .operations import AddonsOperations, AlertsOperations, AvailableSkusOperations, BandwidthSchedulesOperations, ContainersOperations, DevicesOperations, JobsOperations, MonitoringConfigOperations, NodesOperations, Operations, OperationsStatusOperations, OrdersOperations, RolesOperations, SharesOperations, StorageAccountCredentialsOperations, StorageAccountsOperations, TriggersOperations, UsersOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import DataBoxEdgeManagementClientConfiguration -from .operations import Operations -from .operations import AvailableSkusOperations -from .operations import DevicesOperations -from .operations import AlertsOperations -from .operations import BandwidthSchedulesOperations -from .operations import JobsOperations -from .operations import NodesOperations -from .operations import OperationsStatusOperations -from .operations import OrdersOperations -from .operations import RolesOperations -from .operations import AddonsOperations -from .operations import MonitoringConfigOperations -from .operations import SharesOperations -from .operations import StorageAccountCredentialsOperations -from .operations import StorageAccountsOperations -from .operations import ContainersOperations -from .operations import TriggersOperations -from .operations import UsersOperations -from . import models - -class DataBoxEdgeManagementClient(object): +class DataBoxEdgeManagementClient: """The DataBoxEdge Client. :ivar operations: Operations operations @@ -52,13 +33,15 @@ class DataBoxEdgeManagementClient(object): :ivar alerts: AlertsOperations operations :vartype alerts: azure.mgmt.databoxedge.v2020_12_01.operations.AlertsOperations :ivar bandwidth_schedules: BandwidthSchedulesOperations operations - :vartype bandwidth_schedules: azure.mgmt.databoxedge.v2020_12_01.operations.BandwidthSchedulesOperations + :vartype bandwidth_schedules: + azure.mgmt.databoxedge.v2020_12_01.operations.BandwidthSchedulesOperations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.databoxedge.v2020_12_01.operations.JobsOperations :ivar nodes: NodesOperations operations :vartype nodes: azure.mgmt.databoxedge.v2020_12_01.operations.NodesOperations :ivar operations_status: OperationsStatusOperations operations - :vartype operations_status: azure.mgmt.databoxedge.v2020_12_01.operations.OperationsStatusOperations + :vartype operations_status: + azure.mgmt.databoxedge.v2020_12_01.operations.OperationsStatusOperations :ivar orders: OrdersOperations operations :vartype orders: azure.mgmt.databoxedge.v2020_12_01.operations.OrdersOperations :ivar roles: RolesOperations operations @@ -66,13 +49,16 @@ class DataBoxEdgeManagementClient(object): :ivar addons: AddonsOperations operations :vartype addons: azure.mgmt.databoxedge.v2020_12_01.operations.AddonsOperations :ivar monitoring_config: MonitoringConfigOperations operations - :vartype monitoring_config: azure.mgmt.databoxedge.v2020_12_01.operations.MonitoringConfigOperations + :vartype monitoring_config: + azure.mgmt.databoxedge.v2020_12_01.operations.MonitoringConfigOperations :ivar shares: SharesOperations operations :vartype shares: azure.mgmt.databoxedge.v2020_12_01.operations.SharesOperations :ivar storage_account_credentials: StorageAccountCredentialsOperations operations - :vartype storage_account_credentials: azure.mgmt.databoxedge.v2020_12_01.operations.StorageAccountCredentialsOperations + :vartype storage_account_credentials: + azure.mgmt.databoxedge.v2020_12_01.operations.StorageAccountCredentialsOperations :ivar storage_accounts: StorageAccountsOperations operations - :vartype storage_accounts: azure.mgmt.databoxedge.v2020_12_01.operations.StorageAccountsOperations + :vartype storage_accounts: + azure.mgmt.databoxedge.v2020_12_01.operations.StorageAccountsOperations :ivar containers: ContainersOperations operations :vartype containers: azure.mgmt.databoxedge.v2020_12_01.operations.ContainersOperations :ivar triggers: TriggersOperations operations @@ -83,82 +69,71 @@ class DataBoxEdgeManagementClient(object): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = DataBoxEdgeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = DataBoxEdgeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.available_skus = AvailableSkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.orders = OrdersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.addons = AddonsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.monitoring_config = MonitoringConfigOperations( - self._client, self._config, self._serialize, self._deserialize) - self.shares = SharesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.containers = ContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.available_skus = AvailableSkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bandwidth_schedules = BandwidthSchedulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations_status = OperationsStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) + self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize) + self.monitoring_config = MonitoringConfigOperations(self._client, self._config, self._serialize, self._deserialize) + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_account_credentials = StorageAccountCredentialsOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/_metadata.json b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/_metadata.json index f677ec50bfde..53828698d4bd 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/_metadata.json +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/_metadata.json @@ -5,13 +5,13 @@ "name": "DataBoxEdgeManagementClient", "filename": "_data_box_edge_management_client", "description": "The DataBoxEdge Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "operations": "Operations", diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/_patch.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/_vendor.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/_version.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/__init__.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/__init__.py index c33d46ee91d8..f33cac1fd9b0 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/__init__.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/__init__.py @@ -8,3 +8,8 @@ from ._data_box_edge_management_client import DataBoxEdgeManagementClient __all__ = ['DataBoxEdgeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/_configuration.py index 52416ed19fd9..70a07099e1d4 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/_configuration.py @@ -10,13 +10,14 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class DataBoxEdgeManagementClientConfiguration(Configuration): """Configuration for DataBoxEdgeManagementClient. @@ -36,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -63,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/_data_box_edge_management_client.py index 0cb209c359c9..ea2ce64d4444 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/_data_box_edge_management_client.py @@ -6,57 +6,43 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import DataBoxEdgeManagementClientConfiguration +from .operations import AddonsOperations, AlertsOperations, AvailableSkusOperations, BandwidthSchedulesOperations, ContainersOperations, DevicesOperations, JobsOperations, MonitoringConfigOperations, NodesOperations, Operations, OperationsStatusOperations, OrdersOperations, RolesOperations, SharesOperations, StorageAccountCredentialsOperations, StorageAccountsOperations, TriggersOperations, UsersOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import DataBoxEdgeManagementClientConfiguration -from .operations import Operations -from .operations import AvailableSkusOperations -from .operations import DevicesOperations -from .operations import AlertsOperations -from .operations import BandwidthSchedulesOperations -from .operations import JobsOperations -from .operations import NodesOperations -from .operations import OperationsStatusOperations -from .operations import OrdersOperations -from .operations import RolesOperations -from .operations import AddonsOperations -from .operations import MonitoringConfigOperations -from .operations import SharesOperations -from .operations import StorageAccountCredentialsOperations -from .operations import StorageAccountsOperations -from .operations import ContainersOperations -from .operations import TriggersOperations -from .operations import UsersOperations -from .. import models - - -class DataBoxEdgeManagementClient(object): +class DataBoxEdgeManagementClient: """The DataBoxEdge Client. :ivar operations: Operations operations :vartype operations: azure.mgmt.databoxedge.v2020_12_01.aio.operations.Operations :ivar available_skus: AvailableSkusOperations operations - :vartype available_skus: azure.mgmt.databoxedge.v2020_12_01.aio.operations.AvailableSkusOperations + :vartype available_skus: + azure.mgmt.databoxedge.v2020_12_01.aio.operations.AvailableSkusOperations :ivar devices: DevicesOperations operations :vartype devices: azure.mgmt.databoxedge.v2020_12_01.aio.operations.DevicesOperations :ivar alerts: AlertsOperations operations :vartype alerts: azure.mgmt.databoxedge.v2020_12_01.aio.operations.AlertsOperations :ivar bandwidth_schedules: BandwidthSchedulesOperations operations - :vartype bandwidth_schedules: azure.mgmt.databoxedge.v2020_12_01.aio.operations.BandwidthSchedulesOperations + :vartype bandwidth_schedules: + azure.mgmt.databoxedge.v2020_12_01.aio.operations.BandwidthSchedulesOperations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.databoxedge.v2020_12_01.aio.operations.JobsOperations :ivar nodes: NodesOperations operations :vartype nodes: azure.mgmt.databoxedge.v2020_12_01.aio.operations.NodesOperations :ivar operations_status: OperationsStatusOperations operations - :vartype operations_status: azure.mgmt.databoxedge.v2020_12_01.aio.operations.OperationsStatusOperations + :vartype operations_status: + azure.mgmt.databoxedge.v2020_12_01.aio.operations.OperationsStatusOperations :ivar orders: OrdersOperations operations :vartype orders: azure.mgmt.databoxedge.v2020_12_01.aio.operations.OrdersOperations :ivar roles: RolesOperations operations @@ -64,13 +50,16 @@ class DataBoxEdgeManagementClient(object): :ivar addons: AddonsOperations operations :vartype addons: azure.mgmt.databoxedge.v2020_12_01.aio.operations.AddonsOperations :ivar monitoring_config: MonitoringConfigOperations operations - :vartype monitoring_config: azure.mgmt.databoxedge.v2020_12_01.aio.operations.MonitoringConfigOperations + :vartype monitoring_config: + azure.mgmt.databoxedge.v2020_12_01.aio.operations.MonitoringConfigOperations :ivar shares: SharesOperations operations :vartype shares: azure.mgmt.databoxedge.v2020_12_01.aio.operations.SharesOperations :ivar storage_account_credentials: StorageAccountCredentialsOperations operations - :vartype storage_account_credentials: azure.mgmt.databoxedge.v2020_12_01.aio.operations.StorageAccountCredentialsOperations + :vartype storage_account_credentials: + azure.mgmt.databoxedge.v2020_12_01.aio.operations.StorageAccountCredentialsOperations :ivar storage_accounts: StorageAccountsOperations operations - :vartype storage_accounts: azure.mgmt.databoxedge.v2020_12_01.aio.operations.StorageAccountsOperations + :vartype storage_accounts: + azure.mgmt.databoxedge.v2020_12_01.aio.operations.StorageAccountsOperations :ivar containers: ContainersOperations operations :vartype containers: azure.mgmt.databoxedge.v2020_12_01.aio.operations.ContainersOperations :ivar triggers: TriggersOperations operations @@ -81,80 +70,71 @@ class DataBoxEdgeManagementClient(object): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = DataBoxEdgeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = DataBoxEdgeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.available_skus = AvailableSkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bandwidth_schedules = BandwidthSchedulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations_status = OperationsStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) + self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize) + self.monitoring_config = MonitoringConfigOperations(self._client, self._config, self._serialize, self._deserialize) + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_account_credentials = StorageAccountCredentialsOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) + - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.available_skus = AvailableSkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.orders = OrdersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.addons = AddonsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.monitoring_config = MonitoringConfigOperations( - self._client, self._config, self._serialize, self._deserialize) - self.shares = SharesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.containers = ContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/_patch.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_addons_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_addons_operations.py index 7287aec3b494..03b0af9356c7 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_addons_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_addons_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._addons_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_role_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_role( self, device_name: str, role_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.AddonList"]: """Lists all the addons configured in the role. @@ -60,7 +66,8 @@ def list_by_role( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AddonList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.AddonList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.AddonList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AddonList"] @@ -68,37 +75,35 @@ def list_by_role( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_role.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_role_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_role.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_role_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AddonList', pipeline_response) + deserialized = self._deserialize("AddonList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -116,18 +121,20 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_role.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, role_name: str, addon_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Addon": """Gets a specific addon by name. @@ -149,29 +156,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,8 +182,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, @@ -194,41 +193,31 @@ async def _create_or_update_initial( addon_name: str, resource_group_name: str, addon: "_models.Addon", - **kwargs + **kwargs: Any ) -> Optional["_models.Addon"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Addon"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(addon, 'Addon') + + request = build_create_or_update_request_initial( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(addon, 'Addon') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -244,8 +233,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, @@ -253,7 +245,7 @@ async def begin_create_or_update( addon_name: str, resource_group_name: str, addon: "_models.Addon", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Addon"]: """Create or update a addon. @@ -269,15 +261,18 @@ async def begin_create_or_update( :type addon: ~azure.mgmt.databoxedge.v2020_12_01.models.Addon :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Addon or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.Addon] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Addon"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,29 +286,21 @@ async def begin_create_or_update( addon_name=addon_name, resource_group_name=resource_group_name, addon=addon, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Addon', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -325,6 +312,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore async def _delete_initial( @@ -333,36 +321,26 @@ async def _delete_initial( role_name: str, addon_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -375,13 +353,15 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, role_name: str, addon_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the addon on the device. @@ -395,15 +375,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -419,23 +401,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -447,4 +420,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_alerts_operations.py index bd674460d0ac..c1cf2db1b096 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_alerts_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._alerts_operations import build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,11 +46,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.AlertList"]: """Gets all the alerts for a Data Box Edge/Data Box Gateway device. @@ -55,7 +61,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AlertList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.AlertList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.AlertList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertList"] @@ -63,36 +70,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AlertList', pipeline_response) + deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,17 +114,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Alert": """Gets an alert by name. @@ -142,28 +148,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,4 +173,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_available_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_available_skus_operations.py index 06b8e32035ae..60501c5ad56c 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_available_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_available_skus_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._available_skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,9 +46,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.DataBoxEdgeSkuList"]: """List all the available Skus and information related to them. @@ -51,7 +57,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DataBoxEdgeSkuList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.DataBoxEdgeSkuList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.DataBoxEdgeSkuList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeSkuList"] @@ -59,34 +66,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeSkuList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeSkuList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -104,6 +106,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_bandwidth_schedules_operations.py index 3e4bc7a09474..bf1220742232 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_bandwidth_schedules_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._bandwidth_schedules_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.BandwidthSchedulesList"]: """Gets all the bandwidth schedules for a Data Box Edge/Data Box Gateway device. @@ -56,8 +62,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BandwidthSchedulesList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.BandwidthSchedulesList] + :return: An iterator like instance of either BandwidthSchedulesList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.BandwidthSchedulesList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedulesList"] @@ -65,36 +73,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BandwidthSchedulesList', pipeline_response) + deserialized = self._deserialize("BandwidthSchedulesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,17 +117,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.BandwidthSchedule": """Gets the properties of the specified bandwidth schedule. @@ -142,28 +149,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,48 +174,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, parameters: "_models.BandwidthSchedule", - **kwargs + **kwargs: Any ) -> Optional["_models.BandwidthSchedule"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BandwidthSchedule"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BandwidthSchedule') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BandwidthSchedule') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -234,15 +223,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, parameters: "_models.BandwidthSchedule", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.BandwidthSchedule"]: """Creates or updates a bandwidth schedule. @@ -256,15 +248,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.databoxedge.v2020_12_01.models.BandwidthSchedule :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BandwidthSchedule or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.BandwidthSchedule] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BandwidthSchedule or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.BandwidthSchedule] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedule"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,28 +274,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BandwidthSchedule', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -310,6 +300,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore async def _delete_initial( @@ -317,35 +308,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -358,12 +339,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the specified bandwidth schedule. @@ -375,15 +358,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -398,22 +383,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -425,4 +402,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_containers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_containers_operations.py index 31fc7b531c68..4e7bd8890c0a 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_containers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_containers_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._containers_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_storage_account_request, build_refresh_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_storage_account( self, device_name: str, storage_account_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ContainerList"]: """Lists all the containers of a storage Account in a Data Box Edge/Data Box Gateway device. @@ -62,7 +68,8 @@ def list_by_storage_account( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ContainerList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.ContainerList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.ContainerList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerList"] @@ -70,37 +77,35 @@ def list_by_storage_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_storage_account.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_account_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_storage_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_account_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ContainerList', pipeline_response) + deserialized = self._deserialize("ContainerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,18 +123,20 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_storage_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, storage_account_name: str, container_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Container": """Gets a container by name. @@ -153,29 +160,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -189,8 +186,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, @@ -198,41 +197,31 @@ async def _create_or_update_initial( container_name: str, resource_group_name: str, container: "_models.Container", - **kwargs + **kwargs: Any ) -> Optional["_models.Container"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Container"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(container, 'Container') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(container, 'Container') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -248,8 +237,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, @@ -257,7 +249,7 @@ async def begin_create_or_update( container_name: str, resource_group_name: str, container: "_models.Container", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Container"]: """Creates a new container or updates an existing container on the device. @@ -275,15 +267,20 @@ async def begin_create_or_update( :type container: ~azure.mgmt.databoxedge.v2020_12_01.models.Container :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Container or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.Container] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Container or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.Container] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Container"] lro_delay = kwargs.pop( 'polling_interval', @@ -297,29 +294,21 @@ async def begin_create_or_update( container_name=container_name, resource_group_name=resource_group_name, container=container, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Container', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -331,6 +320,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore async def _delete_initial( @@ -339,36 +329,26 @@ async def _delete_initial( storage_account_name: str, container_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -381,13 +361,15 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, storage_account_name: str, container_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the container on the Data Box Edge/Data Box Gateway device. @@ -401,15 +383,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -425,23 +409,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -453,6 +428,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore async def _refresh_initial( @@ -461,36 +437,26 @@ async def _refresh_initial( storage_account_name: str, container_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -503,13 +469,15 @@ async def _refresh_initial( _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh'} # type: ignore + + @distributed_trace_async async def begin_refresh( self, device_name: str, storage_account_name: str, container_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Refreshes the container metadata with the data from the cloud. @@ -525,15 +493,17 @@ async def begin_refresh( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -549,23 +519,14 @@ async def begin_refresh( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -577,4 +538,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_devices_operations.py index f3bc67df017d..a1b4afc08592 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_devices_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._devices_operations import build_create_or_update_request_initial, build_create_or_update_security_settings_request_initial, build_delete_request_initial, build_download_updates_request_initial, build_generate_certificate_request, build_get_extended_information_request, build_get_network_settings_request, build_get_request, build_get_update_summary_request, build_install_updates_request_initial, build_list_by_resource_group_request, build_list_by_subscription_request, build_scan_for_updates_request_initial, build_update_extended_information_request, build_update_request, build_upload_certificate_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,10 +48,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, expand: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.DataBoxEdgeDeviceList"]: """Gets all the Data Box Edge/Data Box Gateway devices in a subscription. @@ -54,8 +60,10 @@ def list_by_subscription( Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -63,36 +71,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,16 +113,18 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, expand: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.DataBoxEdgeDeviceList"]: """Gets all the Data Box Edge/Data Box Gateway devices in a resource group. @@ -129,8 +134,10 @@ def list_by_resource_group( Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -138,37 +145,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -186,16 +189,18 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDevice": """Gets the properties of the Data Box Edge/Data Box Gateway device. @@ -213,27 +218,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,46 +242,38 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, resource_group_name: str, data_box_edge_device: "_models.DataBoxEdgeDevice", - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDevice": cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') + + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -300,14 +287,17 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, resource_group_name: str, data_box_edge_device: "_models.DataBoxEdgeDevice", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.DataBoxEdgeDevice"]: """Creates or updates a Data Box Edge/Data Box Gateway resource. @@ -319,15 +309,20 @@ async def begin_create_or_update( :type data_box_edge_device: ~azure.mgmt.databoxedge.v2020_12_01.models.DataBoxEdgeDevice :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DataBoxEdgeDevice or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.DataBoxEdgeDevice] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DataBoxEdgeDevice or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.DataBoxEdgeDevice] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] lro_delay = kwargs.pop( 'polling_interval', @@ -339,27 +334,21 @@ async def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, data_box_edge_device=data_box_edge_device, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DataBoxEdgeDevice', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -371,40 +360,31 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore async def _delete_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -417,11 +397,13 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the Data Box Edge/Data Box Gateway device. @@ -431,15 +413,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -453,21 +437,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -479,14 +456,16 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + @distributed_trace_async async def update( self, device_name: str, resource_group_name: str, parameters: "_models.DataBoxEdgeDevicePatch", - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDevice": """Modifies a Data Box Edge/Data Box Gateway resource. @@ -506,32 +485,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -545,40 +514,32 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + async def _download_updates_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._download_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_download_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._download_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -591,11 +552,13 @@ async def _download_updates_initial( _download_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + + @distributed_trace_async async def begin_download_updates( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Downloads the updates on a Data Box Edge/Data Box Gateway device. @@ -607,15 +570,17 @@ async def begin_download_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -629,21 +594,14 @@ async def begin_download_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -655,13 +613,15 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_download_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + @distributed_trace_async async def generate_certificate( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.GenerateCertResponse": """Generates certificate for activation key. @@ -679,27 +639,17 @@ async def generate_certificate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.generate_certificate.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_generate_certificate_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.generate_certificate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -713,13 +663,16 @@ async def generate_certificate( return cls(pipeline_response, deserialized, {}) return deserialized + generate_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/generateCertificate'} # type: ignore + + @distributed_trace_async async def get_extended_information( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDeviceExtendedInfo": """Gets additional information for the specified Azure Stack Edge/Data Box Gateway device. @@ -737,27 +690,17 @@ async def get_extended_information( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_extended_information.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_extended_information_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_extended_information.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -771,40 +714,32 @@ async def get_extended_information( return cls(pipeline_response, deserialized, {}) return deserialized + get_extended_information.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation'} # type: ignore + async def _install_updates_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._install_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_install_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._install_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -817,11 +752,13 @@ async def _install_updates_initial( _install_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + + @distributed_trace_async async def begin_install_updates( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Installs the updates on the Data Box Edge/Data Box Gateway device. @@ -833,15 +770,17 @@ async def begin_install_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -855,21 +794,14 @@ async def begin_install_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -881,13 +813,15 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_install_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + @distributed_trace_async async def get_network_settings( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.NetworkSettings": """Gets the network settings of the specified Data Box Edge/Data Box Gateway device. @@ -905,27 +839,17 @@ async def get_network_settings( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_network_settings.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_network_settings_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_network_settings.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -939,40 +863,32 @@ async def get_network_settings( return cls(pipeline_response, deserialized, {}) return deserialized + get_network_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/networkSettings/default'} # type: ignore + async def _scan_for_updates_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._scan_for_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_scan_for_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._scan_for_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -985,11 +901,13 @@ async def _scan_for_updates_initial( _scan_for_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore + + @distributed_trace_async async def begin_scan_for_updates( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Scans for updates on a Data Box Edge/Data Box Gateway device. @@ -1001,15 +919,17 @@ async def begin_scan_for_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1023,21 +943,14 @@ async def begin_scan_for_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1049,6 +962,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_scan_for_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore async def _create_or_update_security_settings_initial( @@ -1056,39 +970,29 @@ async def _create_or_update_security_settings_initial( device_name: str, resource_group_name: str, security_settings: "_models.SecuritySettings", - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_security_settings_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(security_settings, 'SecuritySettings') + + request = build_create_or_update_security_settings_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_security_settings_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(security_settings, 'SecuritySettings') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1101,12 +1005,14 @@ async def _create_or_update_security_settings_initial( _create_or_update_security_settings_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + + @distributed_trace_async async def begin_create_or_update_security_settings( self, device_name: str, resource_group_name: str, security_settings: "_models.SecuritySettings", - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Updates the security settings on a Data Box Edge/Data Box Gateway device. @@ -1118,15 +1024,18 @@ async def begin_create_or_update_security_settings( :type security_settings: ~azure.mgmt.databoxedge.v2020_12_01.models.SecuritySettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1138,24 +1047,18 @@ async def begin_create_or_update_security_settings( device_name=device_name, resource_group_name=resource_group_name, security_settings=security_settings, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1167,14 +1070,16 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_security_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + @distributed_trace_async async def update_extended_information( self, device_name: str, resource_group_name: str, parameters: "_models.DataBoxEdgeDeviceExtendedInfoPatch", - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDeviceExtendedInfo": """Gets additional information for the specified Data Box Edge/Data Box Gateway device. @@ -1194,32 +1099,22 @@ async def update_extended_information( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update_extended_information.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'DataBoxEdgeDeviceExtendedInfoPatch') + + request = build_update_extended_information_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.update_extended_information.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataBoxEdgeDeviceExtendedInfoPatch') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1233,15 +1128,19 @@ async def update_extended_information( return cls(pipeline_response, deserialized, {}) return deserialized + update_extended_information.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateExtendedInformation'} # type: ignore + + @distributed_trace_async async def get_update_summary( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.UpdateSummary": - """Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. + """Gets information about the availability of updates based on the last scan of the device. It + also gets information about any ongoing download or install jobs on the device. Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. @@ -1260,27 +1159,17 @@ async def get_update_summary( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_update_summary.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_update_summary_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_update_summary.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1294,14 +1183,17 @@ async def get_update_summary( return cls(pipeline_response, deserialized, {}) return deserialized + get_update_summary.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default'} # type: ignore + + @distributed_trace_async async def upload_certificate( self, device_name: str, resource_group_name: str, parameters: "_models.UploadCertificateRequest", - **kwargs + **kwargs: Any ) -> "_models.UploadCertificateResponse": """Uploads registration certificate for the device. @@ -1321,32 +1213,22 @@ async def upload_certificate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.upload_certificate.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'UploadCertificateRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_upload_certificate_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.upload_certificate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'UploadCertificateRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1360,4 +1242,6 @@ async def upload_certificate( return cls(pipeline_response, deserialized, {}) return deserialized + upload_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/uploadCertificate'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_jobs_operations.py index 792da56690ad..ed7b3ba8060c 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_jobs_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._jobs_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,12 +44,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Job": """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. @@ -67,28 +72,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -102,4 +97,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_monitoring_config_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_monitoring_config_operations.py index 23fd343f2ac8..c3c563a454b9 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_monitoring_config_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_monitoring_config_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._monitoring_config_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, device_name: str, role_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.MonitoringMetricConfigurationList"]: """Lists metric configurations in a role. @@ -61,8 +67,10 @@ def list( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MonitoringMetricConfigurationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.MonitoringMetricConfigurationList] + :return: An iterator like instance of either MonitoringMetricConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.MonitoringMetricConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringMetricConfigurationList"] @@ -70,37 +78,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('MonitoringMetricConfigurationList', pipeline_response) + deserialized = self._deserialize("MonitoringMetricConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,17 +124,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, role_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.MonitoringMetricConfiguration": """Gets a metric configuration of a role. @@ -150,28 +158,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,48 +183,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + async def _create_or_update_initial( self, device_name: str, role_name: str, resource_group_name: str, monitoring_metric_configuration: "_models.MonitoringMetricConfiguration", - **kwargs + **kwargs: Any ) -> Optional["_models.MonitoringMetricConfiguration"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MonitoringMetricConfiguration"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(monitoring_metric_configuration, 'MonitoringMetricConfiguration') + + request = build_create_or_update_request_initial( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(monitoring_metric_configuration, 'MonitoringMetricConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -242,15 +232,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, role_name: str, resource_group_name: str, monitoring_metric_configuration: "_models.MonitoringMetricConfiguration", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.MonitoringMetricConfiguration"]: """Creates a new metric configuration or updates an existing one for a role. @@ -263,18 +256,24 @@ async def begin_create_or_update( :param resource_group_name: The resource group name. :type resource_group_name: str :param monitoring_metric_configuration: The metric configuration. - :type monitoring_metric_configuration: ~azure.mgmt.databoxedge.v2020_12_01.models.MonitoringMetricConfiguration + :type monitoring_metric_configuration: + ~azure.mgmt.databoxedge.v2020_12_01.models.MonitoringMetricConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MonitoringMetricConfiguration or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.MonitoringMetricConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringMetricConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.MonitoringMetricConfiguration] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringMetricConfiguration"] lro_delay = kwargs.pop( 'polling_interval', @@ -287,28 +286,21 @@ async def begin_create_or_update( role_name=role_name, resource_group_name=resource_group_name, monitoring_metric_configuration=monitoring_metric_configuration, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MonitoringMetricConfiguration', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -320,6 +312,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore async def _delete_initial( @@ -327,35 +320,25 @@ async def _delete_initial( device_name: str, role_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -368,12 +351,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, role_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """deletes a new metric configuration for a role. @@ -387,15 +372,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -410,22 +397,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -437,4 +416,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_nodes_operations.py index fb78384ebf77..f50c68bf8bfd 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_nodes_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._nodes_operations import build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,11 +46,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.NodeList"]: """Gets all the nodes currently configured under this Data Box Edge device. @@ -55,7 +61,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either NodeList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.NodeList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.NodeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeList"] @@ -63,36 +70,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('NodeList', pipeline_response) + deserialized = self._deserialize("NodeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,6 +114,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_operations.py index 9b025645c727..c28b624c69b7 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,9 +46,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OperationsList"]: """List all the supported operations. @@ -51,7 +57,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.OperationsList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.OperationsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationsList"] @@ -59,30 +66,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationsList', pipeline_response) + deserialized = self._deserialize("OperationsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -100,6 +104,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_operations_status_operations.py index 7b3bd3020a35..6d059252f58b 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_operations_status_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations_status_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,12 +44,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Job": """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. @@ -67,28 +72,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -102,4 +97,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/operationsStatus/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_orders_operations.py index 13461d449752..87303cd29114 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_orders_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._orders_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request, build_list_dc_access_code_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OrderList"]: """Lists all the orders related to a Data Box Edge/Data Box Gateway device. @@ -59,7 +65,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OrderList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.OrderList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.OrderList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OrderList"] @@ -67,36 +74,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OrderList', pipeline_response) + deserialized = self._deserialize("OrderList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,16 +118,18 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Order": """Gets a specific order by name. @@ -143,27 +149,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,46 +173,38 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + async def _create_or_update_initial( self, device_name: str, resource_group_name: str, order: "_models.Order", - **kwargs + **kwargs: Any ) -> Optional["_models.Order"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Order"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(order, 'Order') + + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(order, 'Order') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -232,14 +220,17 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, resource_group_name: str, order: "_models.Order", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Order"]: """Creates or updates an order. @@ -253,15 +244,18 @@ async def begin_create_or_update( :type order: ~azure.mgmt.databoxedge.v2020_12_01.models.Order :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Order or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.Order] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Order"] lro_delay = kwargs.pop( 'polling_interval', @@ -273,27 +267,21 @@ async def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, order=order, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Order', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -305,40 +293,31 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore async def _delete_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -351,11 +330,13 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the order related to the device. @@ -367,15 +348,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -389,21 +372,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -415,13 +391,15 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + @distributed_trace_async async def list_dc_access_code( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.DCAccessCode": """Gets the DCAccess Code. @@ -441,27 +419,17 @@ async def list_dc_access_code( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_dc_access_code.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_dc_access_code_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_dc_access_code.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -475,4 +443,6 @@ async def list_dc_access_code( return cls(pipeline_response, deserialized, {}) return deserialized + list_dc_access_code.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default/listDCAccessCode'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_roles_operations.py index c48fb03eb036..3e2ee8d4c8dc 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_roles_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._roles_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.RoleList"]: """Lists all the roles configured in a Data Box Edge/Data Box Gateway device. @@ -57,7 +63,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RoleList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.RoleList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.RoleList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleList"] @@ -65,36 +72,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RoleList', pipeline_response) + deserialized = self._deserialize("RoleList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,17 +116,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Role": """Gets a specific role by name. @@ -142,28 +148,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,48 +173,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, role: "_models.Role", - **kwargs + **kwargs: Any ) -> Optional["_models.Role"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Role"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(role, 'Role') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(role, 'Role') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -234,15 +222,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, role: "_models.Role", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Role"]: """Create or update a role. @@ -256,15 +247,18 @@ async def begin_create_or_update( :type role: ~azure.mgmt.databoxedge.v2020_12_01.models.Role :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Role or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.Role] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Role"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,28 +271,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, role=role, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Role', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -310,6 +297,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore async def _delete_initial( @@ -317,35 +305,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -358,12 +336,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the role on the device. @@ -375,15 +355,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -398,22 +380,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -425,4 +399,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_shares_operations.py index 2dd990265729..a6d6f616499a 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_shares_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._shares_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request, build_refresh_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ShareList"]: """Lists all the shares in a Data Box Edge/Data Box Gateway device. @@ -59,7 +65,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ShareList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.ShareList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.ShareList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ShareList"] @@ -67,36 +74,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ShareList', pipeline_response) + deserialized = self._deserialize("ShareList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,17 +118,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Share": """Gets a share by name. @@ -146,28 +152,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -181,48 +177,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, share: "_models.Share", - **kwargs + **kwargs: Any ) -> Optional["_models.Share"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Share"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(share, 'Share') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(share, 'Share') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -238,15 +226,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, share: "_models.Share", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Share"]: """Creates a new share or updates an existing share on the device. @@ -262,15 +253,18 @@ async def begin_create_or_update( :type share: ~azure.mgmt.databoxedge.v2020_12_01.models.Share :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Share or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.Share] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Share"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,28 +277,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, share=share, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Share', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -316,6 +303,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore async def _delete_initial( @@ -323,35 +311,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,12 +342,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the share on the Data Box Edge/Data Box Gateway device. @@ -381,15 +361,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -404,22 +386,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -431,6 +405,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore async def _refresh_initial( @@ -438,35 +413,25 @@ async def _refresh_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -479,12 +444,14 @@ async def _refresh_initial( _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore + + @distributed_trace_async async def begin_refresh( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Refreshes the share metadata with the data from the cloud. @@ -498,15 +465,17 @@ async def begin_refresh( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -521,22 +490,14 @@ async def begin_refresh( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -548,4 +509,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_storage_account_credentials_operations.py index 3289fffa87df..75c3d16bf4e1 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_storage_account_credentials_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._storage_account_credentials_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.StorageAccountCredentialList"]: """Gets all the storage account credentials in a Data Box Edge/Data Box Gateway device. @@ -58,8 +64,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountCredentialList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.StorageAccountCredentialList] + :return: An iterator like instance of either StorageAccountCredentialList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.StorageAccountCredentialList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredentialList"] @@ -67,36 +75,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('StorageAccountCredentialList', pipeline_response) + deserialized = self._deserialize("StorageAccountCredentialList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,17 +119,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.StorageAccountCredential": """Gets the properties of the specified storage account credential. @@ -144,28 +151,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -179,48 +176,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, storage_account_credential: "_models.StorageAccountCredential", - **kwargs + **kwargs: Any ) -> Optional["_models.StorageAccountCredential"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccountCredential"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(storage_account_credential, 'StorageAccountCredential') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_account_credential, 'StorageAccountCredential') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -236,15 +225,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, storage_account_credential: "_models.StorageAccountCredential", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.StorageAccountCredential"]: """Creates or updates the storage account credential. @@ -255,18 +247,24 @@ async def begin_create_or_update( :param resource_group_name: The resource group name. :type resource_group_name: str :param storage_account_credential: The storage account credential. - :type storage_account_credential: ~azure.mgmt.databoxedge.v2020_12_01.models.StorageAccountCredential + :type storage_account_credential: + ~azure.mgmt.databoxedge.v2020_12_01.models.StorageAccountCredential :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either StorageAccountCredential or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.StorageAccountCredential] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageAccountCredential or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.StorageAccountCredential] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredential"] lro_delay = kwargs.pop( 'polling_interval', @@ -279,28 +277,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, storage_account_credential=storage_account_credential, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccountCredential', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -312,6 +303,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore async def _delete_initial( @@ -319,35 +311,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -360,12 +342,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the storage account credential. @@ -377,15 +361,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -400,22 +386,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -427,4 +405,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_storage_accounts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_storage_accounts_operations.py index 6cc6cd15314f..fc1651f36e53 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_storage_accounts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_storage_accounts_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._storage_accounts_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.StorageAccountList"]: """Lists all the StorageAccounts in a Data Box Edge/Data Box Gateway device. @@ -59,7 +65,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either StorageAccountList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.StorageAccountList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.StorageAccountList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountList"] @@ -67,36 +74,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('StorageAccountList', pipeline_response) + deserialized = self._deserialize("StorageAccountList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,17 +118,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, storage_account_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.StorageAccount": """Gets a StorageAccount by name. @@ -146,28 +152,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -181,48 +177,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, storage_account_name: str, resource_group_name: str, storage_account: "_models.StorageAccount", - **kwargs + **kwargs: Any ) -> Optional["_models.StorageAccount"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(storage_account, 'StorageAccount') + + request = build_create_or_update_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_account, 'StorageAccount') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -238,15 +226,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, storage_account_name: str, resource_group_name: str, storage_account: "_models.StorageAccount", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.StorageAccount"]: """Creates a new StorageAccount or updates an existing StorageAccount on the device. @@ -262,15 +253,20 @@ async def begin_create_or_update( :type storage_account: ~azure.mgmt.databoxedge.v2020_12_01.models.StorageAccount :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either StorageAccount or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,28 +279,21 @@ async def begin_create_or_update( storage_account_name=storage_account_name, resource_group_name=resource_group_name, storage_account=storage_account, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -316,6 +305,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore async def _delete_initial( @@ -323,35 +313,25 @@ async def _delete_initial( device_name: str, storage_account_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,12 +344,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, storage_account_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the StorageAccount on the Data Box Edge/Data Box Gateway device. @@ -381,15 +363,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -404,22 +388,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -431,4 +407,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_triggers_operations.py index 9eab91ee9da8..c73c5ef75fc9 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_triggers_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._triggers_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, filter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.TriggerList"]: """Lists all the triggers configured in the device. @@ -61,7 +67,8 @@ def list_by_data_box_edge_device( :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TriggerList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.TriggerList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.TriggerList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TriggerList"] @@ -69,38 +76,35 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TriggerList', pipeline_response) + deserialized = self._deserialize("TriggerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,17 +122,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Trigger": """Get a specific trigger by name. @@ -148,28 +154,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,48 +179,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, trigger: "_models.Trigger", - **kwargs + **kwargs: Any ) -> Optional["_models.Trigger"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Trigger"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(trigger, 'Trigger') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(trigger, 'Trigger') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,15 +228,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, trigger: "_models.Trigger", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Trigger"]: """Creates or updates a trigger. @@ -262,15 +253,19 @@ async def begin_create_or_update( :type trigger: ~azure.mgmt.databoxedge.v2020_12_01.models.Trigger :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Trigger or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Trigger or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.Trigger] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Trigger"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,28 +278,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, trigger=trigger, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Trigger', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -316,6 +304,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore async def _delete_initial( @@ -323,35 +312,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,12 +343,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the trigger on the gateway device. @@ -381,15 +362,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -404,22 +387,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -431,4 +406,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_users_operations.py index b3666cb2e9c5..dbff3a205b59 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/aio/operations/_users_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._users_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, filter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.UserList"]: """Gets all the users registered on a Data Box Edge/Data Box Gateway device. @@ -60,7 +66,8 @@ def list_by_data_box_edge_device( :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.UserList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.UserList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UserList"] @@ -68,38 +75,35 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('UserList', pipeline_response) + deserialized = self._deserialize("UserList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,17 +121,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.User": """Gets the properties of the specified user. @@ -147,28 +153,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -182,48 +178,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, user: "_models.User", - **kwargs + **kwargs: Any ) -> Optional["_models.User"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.User"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(user, 'User') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(user, 'User') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,15 +227,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, user: "_models.User", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.User"]: """Creates a new user or updates an existing user's information on a Data Box Edge/Data Box Gateway device. @@ -262,15 +253,18 @@ async def begin_create_or_update( :type user: ~azure.mgmt.databoxedge.v2020_12_01.models.User :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either User or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.User] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.User"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,28 +277,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, user=user, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('User', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -316,6 +303,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore async def _delete_initial( @@ -323,35 +311,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,12 +342,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the user on a databox edge/gateway device. @@ -381,15 +361,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -404,22 +386,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -431,4 +405,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/models/__init__.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/models/__init__.py index dbf0ba0fe2be..1a2a3c0610f9 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/models/__init__.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/models/__init__.py @@ -6,246 +6,126 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ARMBaseModel - from ._models_py3 import Addon - from ._models_py3 import AddonList - from ._models_py3 import Address - from ._models_py3 import Alert - from ._models_py3 import AlertErrorDetails - from ._models_py3 import AlertList - from ._models_py3 import ArcAddon - from ._models_py3 import AsymmetricEncryptedSecret - from ._models_py3 import Authentication - from ._models_py3 import AzureContainerInfo - from ._models_py3 import BandwidthSchedule - from ._models_py3 import BandwidthSchedulesList - from ._models_py3 import ClientAccessRight - from ._models_py3 import CloudEdgeManagementRole - from ._models_py3 import CloudErrorBody - from ._models_py3 import CniConfig - from ._models_py3 import ComputeResource - from ._models_py3 import ContactDetails - from ._models_py3 import Container - from ._models_py3 import ContainerList - from ._models_py3 import DCAccessCode - from ._models_py3 import DataBoxEdgeDevice - from ._models_py3 import DataBoxEdgeDeviceExtendedInfo - from ._models_py3 import DataBoxEdgeDeviceExtendedInfoPatch - from ._models_py3 import DataBoxEdgeDeviceList - from ._models_py3 import DataBoxEdgeDevicePatch - from ._models_py3 import DataBoxEdgeMoveRequest - from ._models_py3 import DataBoxEdgeSku - from ._models_py3 import DataBoxEdgeSkuList - from ._models_py3 import DeviceSecrets - from ._models_py3 import EdgeProfile - from ._models_py3 import EdgeProfilePatch - from ._models_py3 import EdgeProfileSubscription - from ._models_py3 import EdgeProfileSubscriptionPatch - from ._models_py3 import EtcdInfo - from ._models_py3 import FileEventTrigger - from ._models_py3 import FileSourceInfo - from ._models_py3 import GenerateCertResponse - from ._models_py3 import ImageRepositoryCredential - from ._models_py3 import IoTAddon - from ._models_py3 import IoTDeviceInfo - from ._models_py3 import IoTEdgeAgentInfo - from ._models_py3 import IoTRole - from ._models_py3 import Ipv4Config - from ._models_py3 import Ipv6Config - from ._models_py3 import Job - from ._models_py3 import JobErrorDetails - from ._models_py3 import JobErrorItem - from ._models_py3 import KubernetesClusterInfo - from ._models_py3 import KubernetesIPConfiguration - from ._models_py3 import KubernetesRole - from ._models_py3 import KubernetesRoleCompute - from ._models_py3 import KubernetesRoleNetwork - from ._models_py3 import KubernetesRoleResources - from ._models_py3 import KubernetesRoleStorage - from ._models_py3 import KubernetesRoleStorageClassInfo - from ._models_py3 import LoadBalancerConfig - from ._models_py3 import MECRole - from ._models_py3 import MetricConfiguration - from ._models_py3 import MetricCounter - from ._models_py3 import MetricCounterSet - from ._models_py3 import MetricDimension - from ._models_py3 import MetricDimensionV1 - from ._models_py3 import MetricSpecificationV1 - from ._models_py3 import MonitoringMetricConfiguration - from ._models_py3 import MonitoringMetricConfigurationList - from ._models_py3 import MountPointMap - from ._models_py3 import NetworkAdapter - from ._models_py3 import NetworkAdapterPosition - from ._models_py3 import NetworkSettings - from ._models_py3 import Node - from ._models_py3 import NodeInfo - from ._models_py3 import NodeList - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationsList - from ._models_py3 import Order - from ._models_py3 import OrderList - from ._models_py3 import OrderStatus - from ._models_py3 import PeriodicTimerEventTrigger - from ._models_py3 import PeriodicTimerSourceInfo - from ._models_py3 import RefreshDetails - from ._models_py3 import ResourceIdentity - from ._models_py3 import ResourceMoveDetails - from ._models_py3 import ResourceTypeSku - from ._models_py3 import Role - from ._models_py3 import RoleList - from ._models_py3 import RoleSinkInfo - from ._models_py3 import Secret - from ._models_py3 import SecuritySettings - from ._models_py3 import ServiceSpecification - from ._models_py3 import Share - from ._models_py3 import ShareAccessRight - from ._models_py3 import ShareList - from ._models_py3 import Sku - from ._models_py3 import SkuCapability - from ._models_py3 import SkuCost - from ._models_py3 import SkuInformation - from ._models_py3 import SkuInformationList - from ._models_py3 import SkuLocationInfo - from ._models_py3 import StorageAccount - from ._models_py3 import StorageAccountCredential - from ._models_py3 import StorageAccountCredentialList - from ._models_py3 import StorageAccountList - from ._models_py3 import SubscriptionRegisteredFeatures - from ._models_py3 import SymmetricKey - from ._models_py3 import SystemData - from ._models_py3 import TrackingInfo - from ._models_py3 import Trigger - from ._models_py3 import TriggerList - from ._models_py3 import UpdateDownloadProgress - from ._models_py3 import UpdateInstallProgress - from ._models_py3 import UpdateSummary - from ._models_py3 import UploadCertificateRequest - from ._models_py3 import UploadCertificateResponse - from ._models_py3 import User - from ._models_py3 import UserAccessRight - from ._models_py3 import UserList -except (SyntaxError, ImportError): - from ._models import ARMBaseModel # type: ignore - from ._models import Addon # type: ignore - from ._models import AddonList # type: ignore - from ._models import Address # type: ignore - from ._models import Alert # type: ignore - from ._models import AlertErrorDetails # type: ignore - from ._models import AlertList # type: ignore - from ._models import ArcAddon # type: ignore - from ._models import AsymmetricEncryptedSecret # type: ignore - from ._models import Authentication # type: ignore - from ._models import AzureContainerInfo # type: ignore - from ._models import BandwidthSchedule # type: ignore - from ._models import BandwidthSchedulesList # type: ignore - from ._models import ClientAccessRight # type: ignore - from ._models import CloudEdgeManagementRole # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import CniConfig # type: ignore - from ._models import ComputeResource # type: ignore - from ._models import ContactDetails # type: ignore - from ._models import Container # type: ignore - from ._models import ContainerList # type: ignore - from ._models import DCAccessCode # type: ignore - from ._models import DataBoxEdgeDevice # type: ignore - from ._models import DataBoxEdgeDeviceExtendedInfo # type: ignore - from ._models import DataBoxEdgeDeviceExtendedInfoPatch # type: ignore - from ._models import DataBoxEdgeDeviceList # type: ignore - from ._models import DataBoxEdgeDevicePatch # type: ignore - from ._models import DataBoxEdgeMoveRequest # type: ignore - from ._models import DataBoxEdgeSku # type: ignore - from ._models import DataBoxEdgeSkuList # type: ignore - from ._models import DeviceSecrets # type: ignore - from ._models import EdgeProfile # type: ignore - from ._models import EdgeProfilePatch # type: ignore - from ._models import EdgeProfileSubscription # type: ignore - from ._models import EdgeProfileSubscriptionPatch # type: ignore - from ._models import EtcdInfo # type: ignore - from ._models import FileEventTrigger # type: ignore - from ._models import FileSourceInfo # type: ignore - from ._models import GenerateCertResponse # type: ignore - from ._models import ImageRepositoryCredential # type: ignore - from ._models import IoTAddon # type: ignore - from ._models import IoTDeviceInfo # type: ignore - from ._models import IoTEdgeAgentInfo # type: ignore - from ._models import IoTRole # type: ignore - from ._models import Ipv4Config # type: ignore - from ._models import Ipv6Config # type: ignore - from ._models import Job # type: ignore - from ._models import JobErrorDetails # type: ignore - from ._models import JobErrorItem # type: ignore - from ._models import KubernetesClusterInfo # type: ignore - from ._models import KubernetesIPConfiguration # type: ignore - from ._models import KubernetesRole # type: ignore - from ._models import KubernetesRoleCompute # type: ignore - from ._models import KubernetesRoleNetwork # type: ignore - from ._models import KubernetesRoleResources # type: ignore - from ._models import KubernetesRoleStorage # type: ignore - from ._models import KubernetesRoleStorageClassInfo # type: ignore - from ._models import LoadBalancerConfig # type: ignore - from ._models import MECRole # type: ignore - from ._models import MetricConfiguration # type: ignore - from ._models import MetricCounter # type: ignore - from ._models import MetricCounterSet # type: ignore - from ._models import MetricDimension # type: ignore - from ._models import MetricDimensionV1 # type: ignore - from ._models import MetricSpecificationV1 # type: ignore - from ._models import MonitoringMetricConfiguration # type: ignore - from ._models import MonitoringMetricConfigurationList # type: ignore - from ._models import MountPointMap # type: ignore - from ._models import NetworkAdapter # type: ignore - from ._models import NetworkAdapterPosition # type: ignore - from ._models import NetworkSettings # type: ignore - from ._models import Node # type: ignore - from ._models import NodeInfo # type: ignore - from ._models import NodeList # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationsList # type: ignore - from ._models import Order # type: ignore - from ._models import OrderList # type: ignore - from ._models import OrderStatus # type: ignore - from ._models import PeriodicTimerEventTrigger # type: ignore - from ._models import PeriodicTimerSourceInfo # type: ignore - from ._models import RefreshDetails # type: ignore - from ._models import ResourceIdentity # type: ignore - from ._models import ResourceMoveDetails # type: ignore - from ._models import ResourceTypeSku # type: ignore - from ._models import Role # type: ignore - from ._models import RoleList # type: ignore - from ._models import RoleSinkInfo # type: ignore - from ._models import Secret # type: ignore - from ._models import SecuritySettings # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Share # type: ignore - from ._models import ShareAccessRight # type: ignore - from ._models import ShareList # type: ignore - from ._models import Sku # type: ignore - from ._models import SkuCapability # type: ignore - from ._models import SkuCost # type: ignore - from ._models import SkuInformation # type: ignore - from ._models import SkuInformationList # type: ignore - from ._models import SkuLocationInfo # type: ignore - from ._models import StorageAccount # type: ignore - from ._models import StorageAccountCredential # type: ignore - from ._models import StorageAccountCredentialList # type: ignore - from ._models import StorageAccountList # type: ignore - from ._models import SubscriptionRegisteredFeatures # type: ignore - from ._models import SymmetricKey # type: ignore - from ._models import SystemData # type: ignore - from ._models import TrackingInfo # type: ignore - from ._models import Trigger # type: ignore - from ._models import TriggerList # type: ignore - from ._models import UpdateDownloadProgress # type: ignore - from ._models import UpdateInstallProgress # type: ignore - from ._models import UpdateSummary # type: ignore - from ._models import UploadCertificateRequest # type: ignore - from ._models import UploadCertificateResponse # type: ignore - from ._models import User # type: ignore - from ._models import UserAccessRight # type: ignore - from ._models import UserList # type: ignore +from ._models_py3 import ARMBaseModel +from ._models_py3 import Addon +from ._models_py3 import AddonList +from ._models_py3 import Address +from ._models_py3 import Alert +from ._models_py3 import AlertErrorDetails +from ._models_py3 import AlertList +from ._models_py3 import ArcAddon +from ._models_py3 import AsymmetricEncryptedSecret +from ._models_py3 import Authentication +from ._models_py3 import AzureContainerInfo +from ._models_py3 import BandwidthSchedule +from ._models_py3 import BandwidthSchedulesList +from ._models_py3 import ClientAccessRight +from ._models_py3 import CloudEdgeManagementRole +from ._models_py3 import CloudErrorBody +from ._models_py3 import CniConfig +from ._models_py3 import ComputeResource +from ._models_py3 import ContactDetails +from ._models_py3 import Container +from ._models_py3 import ContainerList +from ._models_py3 import DCAccessCode +from ._models_py3 import DataBoxEdgeDevice +from ._models_py3 import DataBoxEdgeDeviceExtendedInfo +from ._models_py3 import DataBoxEdgeDeviceExtendedInfoPatch +from ._models_py3 import DataBoxEdgeDeviceList +from ._models_py3 import DataBoxEdgeDevicePatch +from ._models_py3 import DataBoxEdgeMoveRequest +from ._models_py3 import DataBoxEdgeSku +from ._models_py3 import DataBoxEdgeSkuList +from ._models_py3 import DeviceSecrets +from ._models_py3 import EdgeProfile +from ._models_py3 import EdgeProfilePatch +from ._models_py3 import EdgeProfileSubscription +from ._models_py3 import EdgeProfileSubscriptionPatch +from ._models_py3 import EtcdInfo +from ._models_py3 import FileEventTrigger +from ._models_py3 import FileSourceInfo +from ._models_py3 import GenerateCertResponse +from ._models_py3 import ImageRepositoryCredential +from ._models_py3 import IoTAddon +from ._models_py3 import IoTDeviceInfo +from ._models_py3 import IoTEdgeAgentInfo +from ._models_py3 import IoTRole +from ._models_py3 import Ipv4Config +from ._models_py3 import Ipv6Config +from ._models_py3 import Job +from ._models_py3 import JobErrorDetails +from ._models_py3 import JobErrorItem +from ._models_py3 import KubernetesClusterInfo +from ._models_py3 import KubernetesIPConfiguration +from ._models_py3 import KubernetesRole +from ._models_py3 import KubernetesRoleCompute +from ._models_py3 import KubernetesRoleNetwork +from ._models_py3 import KubernetesRoleResources +from ._models_py3 import KubernetesRoleStorage +from ._models_py3 import KubernetesRoleStorageClassInfo +from ._models_py3 import LoadBalancerConfig +from ._models_py3 import MECRole +from ._models_py3 import MetricConfiguration +from ._models_py3 import MetricCounter +from ._models_py3 import MetricCounterSet +from ._models_py3 import MetricDimension +from ._models_py3 import MetricDimensionV1 +from ._models_py3 import MetricSpecificationV1 +from ._models_py3 import MonitoringMetricConfiguration +from ._models_py3 import MonitoringMetricConfigurationList +from ._models_py3 import MountPointMap +from ._models_py3 import NetworkAdapter +from ._models_py3 import NetworkAdapterPosition +from ._models_py3 import NetworkSettings +from ._models_py3 import Node +from ._models_py3 import NodeInfo +from ._models_py3 import NodeList +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationsList +from ._models_py3 import Order +from ._models_py3 import OrderList +from ._models_py3 import OrderStatus +from ._models_py3 import PeriodicTimerEventTrigger +from ._models_py3 import PeriodicTimerSourceInfo +from ._models_py3 import RefreshDetails +from ._models_py3 import ResourceIdentity +from ._models_py3 import ResourceMoveDetails +from ._models_py3 import ResourceTypeSku +from ._models_py3 import Role +from ._models_py3 import RoleList +from ._models_py3 import RoleSinkInfo +from ._models_py3 import Secret +from ._models_py3 import SecuritySettings +from ._models_py3 import ServiceSpecification +from ._models_py3 import Share +from ._models_py3 import ShareAccessRight +from ._models_py3 import ShareList +from ._models_py3 import Sku +from ._models_py3 import SkuCapability +from ._models_py3 import SkuCost +from ._models_py3 import SkuInformation +from ._models_py3 import SkuInformationList +from ._models_py3 import SkuLocationInfo +from ._models_py3 import StorageAccount +from ._models_py3 import StorageAccountCredential +from ._models_py3 import StorageAccountCredentialList +from ._models_py3 import StorageAccountList +from ._models_py3 import SubscriptionRegisteredFeatures +from ._models_py3 import SymmetricKey +from ._models_py3 import SystemData +from ._models_py3 import TrackingInfo +from ._models_py3 import Trigger +from ._models_py3 import TriggerList +from ._models_py3 import UpdateDownloadProgress +from ._models_py3 import UpdateInstallProgress +from ._models_py3 import UpdateSummary +from ._models_py3 import UploadCertificateRequest +from ._models_py3 import UploadCertificateResponse +from ._models_py3 import User +from ._models_py3 import UserAccessRight +from ._models_py3 import UserList + from ._data_box_edge_management_client_enums import ( AccountType, diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/models/_data_box_edge_management_client_enums.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/models/_data_box_edge_management_client_enums.py index 8bf52f24f0f2..e59263ac594c 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/models/_data_box_edge_management_client_enums.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/models/_data_box_edge_management_client_enums.py @@ -6,34 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccountType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of storage accessed on the storage account. """ GENERAL_PURPOSE_STORAGE = "GeneralPurposeStorage" BLOB_STORAGE = "BlobStorage" -class AddonState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AddonState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Addon Provisioning State """ @@ -45,14 +30,14 @@ class AddonState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" DELETING = "Deleting" -class AddonType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AddonType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Addon type. """ IOT_EDGE = "IotEdge" ARC_FOR_KUBERNETES = "ArcForKubernetes" -class AlertSeverity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AlertSeverity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Severity of the alert. """ @@ -60,14 +45,14 @@ class AlertSeverity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" CRITICAL = "Critical" -class AuthenticationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AuthenticationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The authentication type. """ INVALID = "Invalid" AZURE_ACTIVE_DIRECTORY = "AzureActiveDirectory" -class AzureContainerDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AzureContainerDataFormat(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Storage format used for the file represented by the share. """ @@ -75,7 +60,7 @@ class AzureContainerDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu PAGE_BLOB = "PageBlob" AZURE_FILE = "AzureFile" -class ClientPermissionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ClientPermissionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of access to be allowed for the client. """ @@ -83,7 +68,7 @@ class ClientPermissionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ_ONLY = "ReadOnly" READ_WRITE = "ReadWrite" -class ContainerStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ContainerStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current status of the container. """ @@ -93,7 +78,7 @@ class ContainerStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UPDATING = "Updating" NEEDS_ATTENTION = "NeedsAttention" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -102,7 +87,7 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class DataBoxEdgeDeviceKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DataBoxEdgeDeviceKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The etag for the devices. """ @@ -111,7 +96,7 @@ class DataBoxEdgeDeviceKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) AZURE_STACK_HUB = "AzureStackHub" AZURE_MODULAR_DATA_CENTRE = "AzureModularDataCentre" -class DataBoxEdgeDeviceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DataBoxEdgeDeviceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the Data Box Edge/Gateway device. """ @@ -123,14 +108,14 @@ class DataBoxEdgeDeviceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum PARTIALLY_DISCONNECTED = "PartiallyDisconnected" MAINTENANCE = "Maintenance" -class DataPolicy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DataPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Data policy of the share. """ CLOUD = "Cloud" LOCAL = "Local" -class DayOfWeek(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DayOfWeek(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SUNDAY = "Sunday" MONDAY = "Monday" @@ -140,13 +125,13 @@ class DayOfWeek(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FRIDAY = "Friday" SATURDAY = "Saturday" -class DeviceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeviceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the Data Box Edge/Gateway device. """ DATA_BOX_EDGE_DEVICE = "DataBoxEdgeDevice" -class DownloadPhase(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DownloadPhase(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The download phase. """ @@ -155,7 +140,7 @@ class DownloadPhase(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DOWNLOADING = "Downloading" VERIFYING = "Verifying" -class EncryptionAlgorithm(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The algorithm used to encrypt "Value". """ @@ -163,14 +148,14 @@ class EncryptionAlgorithm(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AES256 = "AES256" RSAES_PKCS1_V1_5 = "RSAES_PKCS1_v_1_5" -class HostPlatformType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HostPlatformType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Platform where the runtime is hosted. """ KUBERNETES_CLUSTER = "KubernetesCluster" LINUX_VM = "LinuxVM" -class InstallRebootBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InstallRebootBehavior(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates if updates are available and at least one of the updates needs a reboot. """ @@ -178,7 +163,7 @@ class InstallRebootBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) REQUIRES_REBOOT = "RequiresReboot" REQUEST_REBOOT = "RequestReboot" -class JobStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JobStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current status of the job. """ @@ -190,7 +175,7 @@ class JobStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PAUSED = "Paused" SCHEDULED = "Scheduled" -class JobType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JobType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the job. """ @@ -204,7 +189,7 @@ class JobType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESTORE = "Restore" TRIGGER_SUPPORT_PACKAGE = "TriggerSupportPackage" -class KeyVaultSyncStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeyVaultSyncStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """For changing or to initiate the resync to key-vault set the status to KeyVaultSyncPending, rest of the status will not be applicable. """ @@ -215,7 +200,7 @@ class KeyVaultSyncStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): KEY_VAULT_SYNC_PENDING = "KeyVaultSyncPending" KEY_VAULT_SYNCING = "KeyVaultSyncing" -class KubernetesNodeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KubernetesNodeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Node type - Master/Worker """ @@ -223,7 +208,7 @@ class KubernetesNodeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MASTER = "Master" WORKER = "Worker" -class KubernetesState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KubernetesState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """State of Kubernetes deployment """ @@ -235,7 +220,7 @@ class KubernetesState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" DELETING = "Deleting" -class MetricAggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricAggregationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Metric aggregation type. """ @@ -247,14 +232,14 @@ class MetricAggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) TOTAL = "Total" COUNT = "Count" -class MetricCategory(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricCategory(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Metric category. """ CAPACITY = "Capacity" TRANSACTION = "Transaction" -class MetricUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Metric units. """ @@ -267,21 +252,21 @@ class MetricUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BYTES_PER_SECOND = "BytesPerSecond" COUNT_PER_SECOND = "CountPerSecond" -class MonitoringStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MonitoringStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current monitoring status of the share. """ ENABLED = "Enabled" DISABLED = "Disabled" -class MountType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MountType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Mounting type. """ VOLUME = "Volume" HOST_PATH = "HostPath" -class MsiIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MsiIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Identity type """ @@ -289,28 +274,28 @@ class MsiIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED = "SystemAssigned" USER_ASSIGNED = "UserAssigned" -class NetworkAdapterDHCPStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkAdapterDHCPStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Value indicating whether this adapter has DHCP enabled. """ DISABLED = "Disabled" ENABLED = "Enabled" -class NetworkAdapterRDMAStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkAdapterRDMAStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Value indicating whether this adapter is RDMA capable. """ INCAPABLE = "Incapable" CAPABLE = "Capable" -class NetworkAdapterStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkAdapterStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Value indicating whether this adapter is valid. """ INACTIVE = "Inactive" ACTIVE = "Active" -class NetworkGroup(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkGroup(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The network group. """ @@ -318,7 +303,7 @@ class NetworkGroup(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): NON_RDMA = "NonRDMA" RDMA = "RDMA" -class NodeStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NodeStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current status of the individual node """ @@ -328,7 +313,7 @@ class NodeStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): REBOOTING = "Rebooting" SHUTTING_DOWN = "ShuttingDown" -class OrderState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OrderState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the order as per the allowed status types. """ @@ -350,14 +335,14 @@ class OrderState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PICKUP_COMPLETED = "PickupCompleted" AWAITING_DROP = "AwaitingDrop" -class PlatformType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PlatformType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Host OS supported by the Arc addon. """ WINDOWS = "Windows" LINUX = "Linux" -class PosixComplianceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PosixComplianceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """If provisioned storage is posix compliant. """ @@ -365,7 +350,7 @@ class PosixComplianceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) ENABLED = "Enabled" DISABLED = "Disabled" -class ResourceMoveStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceMoveStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Denotes whether move operation is in progress """ @@ -373,14 +358,14 @@ class ResourceMoveStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESOURCE_MOVE_IN_PROGRESS = "ResourceMoveInProgress" RESOURCE_MOVE_FAILED = "ResourceMoveFailed" -class RoleStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RoleStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Local Edge Management Status """ ENABLED = "Enabled" DISABLED = "Disabled" -class RoleTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RoleTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): IOT = "IOT" ASA = "ASA" @@ -390,14 +375,14 @@ class RoleTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): CLOUD_EDGE_MANAGEMENT = "CloudEdgeManagement" KUBERNETES = "Kubernetes" -class ShareAccessProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareAccessProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Access protocol to be used by the share. """ SMB = "SMB" NFS = "NFS" -class ShareAccessType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareAccessType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of access to be allowed on the share for this user. """ @@ -405,7 +390,7 @@ class ShareAccessType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ = "Read" CUSTOM = "Custom" -class ShareStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current status of the share. """ @@ -415,20 +400,20 @@ class ShareStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UPDATING = "Updating" NEEDS_ATTENTION = "NeedsAttention" -class ShipmentType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShipmentType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NOT_APPLICABLE = "NotApplicable" SHIPPED_TO_CUSTOMER = "ShippedToCustomer" SELF_PICKUP = "SelfPickup" -class SkuAvailability(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuAvailability(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Links to the next set of results """ AVAILABLE = "Available" UNAVAILABLE = "Unavailable" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Sku name. """ @@ -454,34 +439,34 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RCA_LARGE = "RCA_Large" RDC = "RDC" -class SkuSignupOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuSignupOption(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Sku can be signed up by customer or not. """ NONE = "None" AVAILABLE = "Available" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Sku tier. """ STANDARD = "Standard" -class SkuVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Availability of the Sku as preview/stable. """ STABLE = "Stable" PREVIEW = "Preview" -class SSLStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SSLStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Signifies whether SSL needs to be enabled or not. """ ENABLED = "Enabled" DISABLED = "Disabled" -class StorageAccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current status of the storage account """ @@ -491,7 +476,7 @@ class StorageAccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UPDATING = "Updating" NEEDS_ATTENTION = "NeedsAttention" -class SubscriptionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SubscriptionState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REGISTERED = "Registered" WARNED = "Warned" @@ -499,7 +484,7 @@ class SubscriptionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DELETED = "Deleted" UNREGISTERED = "Unregistered" -class TimeGrain(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TimeGrain(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PT1_M = "PT1M" PT5_M = "PT5M" @@ -510,14 +495,14 @@ class TimeGrain(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PT12_H = "PT12H" PT1_D = "PT1D" -class TriggerEventType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TriggerEventType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Trigger Kind. """ FILE_EVENT = "FileEvent" PERIODIC_TIMER_EVENT = "PeriodicTimerEvent" -class UpdateOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpdateOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current update operation. """ @@ -526,7 +511,7 @@ class UpdateOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DOWNLOAD = "Download" INSTALL = "Install" -class UpdateOperationStage(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpdateOperationStage(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current stage of the update operation. """ @@ -548,7 +533,7 @@ class UpdateOperationStage(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESCAN_COMPLETE = "RescanComplete" RESCAN_FAILED = "RescanFailed" -class UserType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UserType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the user. """ diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/models/_models.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/models/_models.py deleted file mode 100644 index 88a49cb1ce06..000000000000 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/models/_models.py +++ /dev/null @@ -1,5119 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class ARMBaseModel(msrest.serialization.Model): - """Represents the base class for all object models. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ARMBaseModel, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class Addon(ARMBaseModel): - """Role Addon. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ArcAddon, IoTAddon. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Addon type.Constant filled by server. Possible values include: - "IotEdge", "ArcForKubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.AddonType - :ivar system_data: Addon type. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - _subtype_map = { - 'kind': {'ArcForKubernetes': 'ArcAddon', 'IotEdge': 'IoTAddon'} - } - - def __init__( - self, - **kwargs - ): - super(Addon, self).__init__(**kwargs) - self.kind = 'Addon' # type: str - self.system_data = None - - -class AddonList(msrest.serialization.Model): - """Collection of all the Role addon on the Azure Stack Edge device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The Value. - :vartype value: list[~azure.mgmt.databoxedge.v2020_12_01.models.Addon] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Addon]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AddonList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class Address(msrest.serialization.Model): - """The shipping address of the customer. - - All required parameters must be populated in order to send to Azure. - - :param address_line1: The address line1. - :type address_line1: str - :param address_line2: The address line2. - :type address_line2: str - :param address_line3: The address line3. - :type address_line3: str - :param postal_code: The postal code. - :type postal_code: str - :param city: The city name. - :type city: str - :param state: The state name. - :type state: str - :param country: Required. The country name. - :type country: str - """ - - _validation = { - 'country': {'required': True}, - } - - _attribute_map = { - 'address_line1': {'key': 'addressLine1', 'type': 'str'}, - 'address_line2': {'key': 'addressLine2', 'type': 'str'}, - 'address_line3': {'key': 'addressLine3', 'type': 'str'}, - 'postal_code': {'key': 'postalCode', 'type': 'str'}, - 'city': {'key': 'city', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'country': {'key': 'country', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Address, self).__init__(**kwargs) - self.address_line1 = kwargs.get('address_line1', None) - self.address_line2 = kwargs.get('address_line2', None) - self.address_line3 = kwargs.get('address_line3', None) - self.postal_code = kwargs.get('postal_code', None) - self.city = kwargs.get('city', None) - self.state = kwargs.get('state', None) - self.country = kwargs['country'] - - -class Alert(ARMBaseModel): - """Alert on the data box edge/gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar system_data: Alert generated in the resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - :ivar title: Alert title. - :vartype title: str - :ivar alert_type: Alert type. - :vartype alert_type: str - :ivar appeared_at_date_time: UTC time when the alert appeared. - :vartype appeared_at_date_time: ~datetime.datetime - :ivar recommendation: Alert recommendation. - :vartype recommendation: str - :ivar severity: Severity of the alert. Possible values include: "Informational", "Warning", - "Critical". - :vartype severity: str or ~azure.mgmt.databoxedge.v2020_12_01.models.AlertSeverity - :ivar error_details: Error details of the alert. - :vartype error_details: ~azure.mgmt.databoxedge.v2020_12_01.models.AlertErrorDetails - :ivar detailed_information: Alert details. - :vartype detailed_information: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'title': {'readonly': True}, - 'alert_type': {'readonly': True}, - 'appeared_at_date_time': {'readonly': True}, - 'recommendation': {'readonly': True}, - 'severity': {'readonly': True}, - 'error_details': {'readonly': True}, - 'detailed_information': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'title': {'key': 'properties.title', 'type': 'str'}, - 'alert_type': {'key': 'properties.alertType', 'type': 'str'}, - 'appeared_at_date_time': {'key': 'properties.appearedAtDateTime', 'type': 'iso-8601'}, - 'recommendation': {'key': 'properties.recommendation', 'type': 'str'}, - 'severity': {'key': 'properties.severity', 'type': 'str'}, - 'error_details': {'key': 'properties.errorDetails', 'type': 'AlertErrorDetails'}, - 'detailed_information': {'key': 'properties.detailedInformation', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(Alert, self).__init__(**kwargs) - self.system_data = None - self.title = None - self.alert_type = None - self.appeared_at_date_time = None - self.recommendation = None - self.severity = None - self.error_details = None - self.detailed_information = None - - -class AlertErrorDetails(msrest.serialization.Model): - """Error details for the alert. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error_code: Error code. - :vartype error_code: str - :ivar error_message: Error Message. - :vartype error_message: str - :ivar occurrences: Number of occurrences. - :vartype occurrences: int - """ - - _validation = { - 'error_code': {'readonly': True}, - 'error_message': {'readonly': True}, - 'occurrences': {'readonly': True}, - } - - _attribute_map = { - 'error_code': {'key': 'errorCode', 'type': 'str'}, - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - 'occurrences': {'key': 'occurrences', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(AlertErrorDetails, self).__init__(**kwargs) - self.error_code = None - self.error_message = None - self.occurrences = None - - -class AlertList(msrest.serialization.Model): - """Collection of alerts. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The value. - :vartype value: list[~azure.mgmt.databoxedge.v2020_12_01.models.Alert] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Alert]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AlertList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ArcAddon(Addon): - """Arc Addon. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Addon type.Constant filled by server. Possible values include: - "IotEdge", "ArcForKubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.AddonType - :ivar system_data: Addon type. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - :param subscription_id: Required. Arc resource subscription Id. - :type subscription_id: str - :param resource_group_name: Required. Arc resource group name. - :type resource_group_name: str - :param resource_name: Required. Arc resource Name. - :type resource_name: str - :param resource_location: Required. Arc resource location. - :type resource_location: str - :ivar version: Arc resource version. - :vartype version: str - :ivar host_platform: Host OS supported by the Arc addon. Possible values include: "Windows", - "Linux". - :vartype host_platform: str or ~azure.mgmt.databoxedge.v2020_12_01.models.PlatformType - :ivar host_platform_type: Platform where the runtime is hosted. Possible values include: - "KubernetesCluster", "LinuxVM". - :vartype host_platform_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.HostPlatformType - :ivar provisioning_state: Addon Provisioning State. Possible values include: "Invalid", - "Creating", "Created", "Updating", "Reconfiguring", "Failed", "Deleting". - :vartype provisioning_state: str or ~azure.mgmt.databoxedge.v2020_12_01.models.AddonState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - 'subscription_id': {'required': True}, - 'resource_group_name': {'required': True}, - 'resource_name': {'required': True}, - 'resource_location': {'required': True}, - 'version': {'readonly': True}, - 'host_platform': {'readonly': True}, - 'host_platform_type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'subscription_id': {'key': 'properties.subscriptionId', 'type': 'str'}, - 'resource_group_name': {'key': 'properties.resourceGroupName', 'type': 'str'}, - 'resource_name': {'key': 'properties.resourceName', 'type': 'str'}, - 'resource_location': {'key': 'properties.resourceLocation', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'host_platform': {'key': 'properties.hostPlatform', 'type': 'str'}, - 'host_platform_type': {'key': 'properties.hostPlatformType', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ArcAddon, self).__init__(**kwargs) - self.kind = 'ArcForKubernetes' # type: str - self.subscription_id = kwargs['subscription_id'] - self.resource_group_name = kwargs['resource_group_name'] - self.resource_name = kwargs['resource_name'] - self.resource_location = kwargs['resource_location'] - self.version = None - self.host_platform = None - self.host_platform_type = None - self.provisioning_state = None - - -class AsymmetricEncryptedSecret(msrest.serialization.Model): - """Represent the secrets intended for encryption with asymmetric key pair. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The value of the secret. - :type value: str - :param encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the - value is unencrypted, it will be null. - :type encryption_cert_thumbprint: str - :param encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values - include: "None", "AES256", "RSAES_PKCS1_v_1_5". - :type encryption_algorithm: str or - ~azure.mgmt.databoxedge.v2020_12_01.models.EncryptionAlgorithm - """ - - _validation = { - 'value': {'required': True}, - 'encryption_algorithm': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'encryption_cert_thumbprint': {'key': 'encryptionCertThumbprint', 'type': 'str'}, - 'encryption_algorithm': {'key': 'encryptionAlgorithm', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AsymmetricEncryptedSecret, self).__init__(**kwargs) - self.value = kwargs['value'] - self.encryption_cert_thumbprint = kwargs.get('encryption_cert_thumbprint', None) - self.encryption_algorithm = kwargs['encryption_algorithm'] - - -class Authentication(msrest.serialization.Model): - """Authentication mechanism for IoT devices. - - :param symmetric_key: Symmetric key for authentication. - :type symmetric_key: ~azure.mgmt.databoxedge.v2020_12_01.models.SymmetricKey - """ - - _attribute_map = { - 'symmetric_key': {'key': 'symmetricKey', 'type': 'SymmetricKey'}, - } - - def __init__( - self, - **kwargs - ): - super(Authentication, self).__init__(**kwargs) - self.symmetric_key = kwargs.get('symmetric_key', None) - - -class AzureContainerInfo(msrest.serialization.Model): - """Azure container mapping of the endpoint. - - All required parameters must be populated in order to send to Azure. - - :param storage_account_credential_id: Required. ID of the storage account credential used to - access storage. - :type storage_account_credential_id: str - :param container_name: Required. Container name (Based on the data format specified, this - represents the name of Azure Files/Page blob/Block blob). - :type container_name: str - :param data_format: Required. Storage format used for the file represented by the share. - Possible values include: "BlockBlob", "PageBlob", "AzureFile". - :type data_format: str or ~azure.mgmt.databoxedge.v2020_12_01.models.AzureContainerDataFormat - """ - - _validation = { - 'storage_account_credential_id': {'required': True}, - 'container_name': {'required': True}, - 'data_format': {'required': True}, - } - - _attribute_map = { - 'storage_account_credential_id': {'key': 'storageAccountCredentialId', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'data_format': {'key': 'dataFormat', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureContainerInfo, self).__init__(**kwargs) - self.storage_account_credential_id = kwargs['storage_account_credential_id'] - self.container_name = kwargs['container_name'] - self.data_format = kwargs['data_format'] - - -class BandwidthSchedule(ARMBaseModel): - """The bandwidth schedule details. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar system_data: Bandwidth object related to ASE resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - :param start: Required. The start time of the schedule in UTC. - :type start: str - :param stop: Required. The stop time of the schedule in UTC. - :type stop: str - :param rate_in_mbps: Required. The bandwidth rate in Mbps. - :type rate_in_mbps: int - :param days: Required. The days of the week when this schedule is applicable. - :type days: list[str or ~azure.mgmt.databoxedge.v2020_12_01.models.DayOfWeek] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'start': {'required': True}, - 'stop': {'required': True}, - 'rate_in_mbps': {'required': True}, - 'days': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'start': {'key': 'properties.start', 'type': 'str'}, - 'stop': {'key': 'properties.stop', 'type': 'str'}, - 'rate_in_mbps': {'key': 'properties.rateInMbps', 'type': 'int'}, - 'days': {'key': 'properties.days', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(BandwidthSchedule, self).__init__(**kwargs) - self.system_data = None - self.start = kwargs['start'] - self.stop = kwargs['stop'] - self.rate_in_mbps = kwargs['rate_in_mbps'] - self.days = kwargs['days'] - - -class BandwidthSchedulesList(msrest.serialization.Model): - """The collection of bandwidth schedules. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of bandwidth schedules. - :vartype value: list[~azure.mgmt.databoxedge.v2020_12_01.models.BandwidthSchedule] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BandwidthSchedule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BandwidthSchedulesList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ClientAccessRight(msrest.serialization.Model): - """The mapping between a particular client IP and the type of access client has on the NFS share. - - All required parameters must be populated in order to send to Azure. - - :param client: Required. IP of the client. - :type client: str - :param access_permission: Required. Type of access to be allowed for the client. Possible - values include: "NoAccess", "ReadOnly", "ReadWrite". - :type access_permission: str or ~azure.mgmt.databoxedge.v2020_12_01.models.ClientPermissionType - """ - - _validation = { - 'client': {'required': True}, - 'access_permission': {'required': True}, - } - - _attribute_map = { - 'client': {'key': 'client', 'type': 'str'}, - 'access_permission': {'key': 'accessPermission', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClientAccessRight, self).__init__(**kwargs) - self.client = kwargs['client'] - self.access_permission = kwargs['access_permission'] - - -class Role(ARMBaseModel): - """Compute role. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: CloudEdgeManagementRole, IoTRole, KubernetesRole, MECRole. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", - "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleTypes - :ivar system_data: Role configured on ASE resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - _subtype_map = { - 'kind': {'CloudEdgeManagement': 'CloudEdgeManagementRole', 'IOT': 'IoTRole', 'Kubernetes': 'KubernetesRole', 'MEC': 'MECRole'} - } - - def __init__( - self, - **kwargs - ): - super(Role, self).__init__(**kwargs) - self.kind = 'Role' # type: str - self.system_data = None - - -class CloudEdgeManagementRole(Role): - """CloudEdgeManagementRole role. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", - "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleTypes - :ivar system_data: Role configured on ASE resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - :ivar local_management_status: Local Edge Management Status. Possible values include: - "Enabled", "Disabled". - :vartype local_management_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleStatus - :ivar edge_profile: Edge Profile of the resource. - :vartype edge_profile: ~azure.mgmt.databoxedge.v2020_12_01.models.EdgeProfile - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - 'local_management_status': {'readonly': True}, - 'edge_profile': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'local_management_status': {'key': 'properties.localManagementStatus', 'type': 'str'}, - 'edge_profile': {'key': 'properties.edgeProfile', 'type': 'EdgeProfile'}, - 'role_status': {'key': 'properties.roleStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudEdgeManagementRole, self).__init__(**kwargs) - self.kind = 'CloudEdgeManagement' # type: str - self.local_management_status = None - self.edge_profile = None - self.role_status = kwargs.get('role_status', None) - - -class CloudErrorBody(msrest.serialization.Model): - """An error response from the service. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.databoxedge.v2020_12_01.models.CloudErrorBody] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudErrorBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.details = kwargs.get('details', None) - - -class CniConfig(msrest.serialization.Model): - """Cni configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: Cni type. - :vartype type: str - :ivar version: Cni version. - :vartype version: str - :ivar pod_subnet: Pod Subnet. - :vartype pod_subnet: str - :ivar service_subnet: Service subnet. - :vartype service_subnet: str - """ - - _validation = { - 'type': {'readonly': True}, - 'version': {'readonly': True}, - 'pod_subnet': {'readonly': True}, - 'service_subnet': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'pod_subnet': {'key': 'podSubnet', 'type': 'str'}, - 'service_subnet': {'key': 'serviceSubnet', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CniConfig, self).__init__(**kwargs) - self.type = None - self.version = None - self.pod_subnet = None - self.service_subnet = None - - -class ComputeResource(msrest.serialization.Model): - """Compute infrastructure Resource. - - All required parameters must be populated in order to send to Azure. - - :param processor_count: Required. Processor count. - :type processor_count: int - :param memory_in_gb: Required. Memory in GB. - :type memory_in_gb: long - """ - - _validation = { - 'processor_count': {'required': True}, - 'memory_in_gb': {'required': True}, - } - - _attribute_map = { - 'processor_count': {'key': 'processorCount', 'type': 'int'}, - 'memory_in_gb': {'key': 'memoryInGB', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(ComputeResource, self).__init__(**kwargs) - self.processor_count = kwargs['processor_count'] - self.memory_in_gb = kwargs['memory_in_gb'] - - -class ContactDetails(msrest.serialization.Model): - """Contains all the contact details of the customer. - - All required parameters must be populated in order to send to Azure. - - :param contact_person: Required. The contact person name. - :type contact_person: str - :param company_name: Required. The name of the company. - :type company_name: str - :param phone: Required. The phone number. - :type phone: str - :param email_list: Required. The email list. - :type email_list: list[str] - """ - - _validation = { - 'contact_person': {'required': True}, - 'company_name': {'required': True}, - 'phone': {'required': True}, - 'email_list': {'required': True}, - } - - _attribute_map = { - 'contact_person': {'key': 'contactPerson', 'type': 'str'}, - 'company_name': {'key': 'companyName', 'type': 'str'}, - 'phone': {'key': 'phone', 'type': 'str'}, - 'email_list': {'key': 'emailList', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ContactDetails, self).__init__(**kwargs) - self.contact_person = kwargs['contact_person'] - self.company_name = kwargs['company_name'] - self.phone = kwargs['phone'] - self.email_list = kwargs['email_list'] - - -class Container(ARMBaseModel): - """Represents a container on the Data Box Edge/Gateway device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar system_data: Container in DataBoxEdge Resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - :ivar container_status: Current status of the container. Possible values include: "OK", - "Offline", "Unknown", "Updating", "NeedsAttention". - :vartype container_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.ContainerStatus - :param data_format: Required. DataFormat for Container. Possible values include: "BlockBlob", - "PageBlob", "AzureFile". - :type data_format: str or ~azure.mgmt.databoxedge.v2020_12_01.models.AzureContainerDataFormat - :ivar refresh_details: Details of the refresh job on this container. - :vartype refresh_details: ~azure.mgmt.databoxedge.v2020_12_01.models.RefreshDetails - :ivar created_date_time: The UTC time when container got created. - :vartype created_date_time: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'container_status': {'readonly': True}, - 'data_format': {'required': True}, - 'refresh_details': {'readonly': True}, - 'created_date_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'container_status': {'key': 'properties.containerStatus', 'type': 'str'}, - 'data_format': {'key': 'properties.dataFormat', 'type': 'str'}, - 'refresh_details': {'key': 'properties.refreshDetails', 'type': 'RefreshDetails'}, - 'created_date_time': {'key': 'properties.createdDateTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(Container, self).__init__(**kwargs) - self.system_data = None - self.container_status = None - self.data_format = kwargs['data_format'] - self.refresh_details = None - self.created_date_time = None - - -class ContainerList(msrest.serialization.Model): - """Collection of all the containers on the Data Box Edge/Gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of containers. - :vartype value: list[~azure.mgmt.databoxedge.v2020_12_01.models.Container] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Container]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContainerList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class DataBoxEdgeDevice(ARMBaseModel): - """The Data Box Edge/Gateway device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param location: Required. The location of the device. This is a supported and registered Azure - geographical region (for example, West US, East US, or Southeast Asia). The geographical region - of a device cannot be changed once it is created, but if an identical geographical region is - specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. The list of tags that describe the device. These tags can be used - to view and group this device (across resource groups). - :type tags: dict[str, str] - :param sku: The SKU type. - :type sku: ~azure.mgmt.databoxedge.v2020_12_01.models.Sku - :param etag: The etag for the devices. - :type etag: str - :param identity: Msi identity of the resource. - :type identity: ~azure.mgmt.databoxedge.v2020_12_01.models.ResourceIdentity - :ivar kind: The etag for the devices. Possible values include: "AzureDataBoxGateway", - "AzureStackEdge", "AzureStackHub", "AzureModularDataCentre". - :vartype kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.DataBoxEdgeDeviceKind - :ivar system_data: DataBoxEdge Resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - :param data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible - values include: "ReadyToSetup", "Online", "Offline", "NeedsAttention", "Disconnected", - "PartiallyDisconnected", "Maintenance". - :type data_box_edge_device_status: str or - ~azure.mgmt.databoxedge.v2020_12_01.models.DataBoxEdgeDeviceStatus - :ivar serial_number: The Serial Number of Data Box Edge/Gateway device. - :vartype serial_number: str - :ivar description: The Description of the Data Box Edge/Gateway device. - :vartype description: str - :ivar model_description: The description of the Data Box Edge/Gateway device model. - :vartype model_description: str - :ivar device_type: The type of the Data Box Edge/Gateway device. Possible values include: - "DataBoxEdgeDevice". - :vartype device_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.DeviceType - :ivar friendly_name: The Data Box Edge/Gateway device name. - :vartype friendly_name: str - :ivar culture: The Data Box Edge/Gateway device culture. - :vartype culture: str - :ivar device_model: The Data Box Edge/Gateway device model. - :vartype device_model: str - :ivar device_software_version: The Data Box Edge/Gateway device software version. - :vartype device_software_version: str - :ivar device_local_capacity: The Data Box Edge/Gateway device local capacity in MB. - :vartype device_local_capacity: long - :ivar time_zone: The Data Box Edge/Gateway device timezone. - :vartype time_zone: str - :ivar device_hcs_version: The device software version number of the device (eg: 1.2.18105.6). - :vartype device_hcs_version: str - :ivar configured_role_types: Type of compute roles configured. - :vartype configured_role_types: list[str or - ~azure.mgmt.databoxedge.v2020_12_01.models.RoleTypes] - :ivar node_count: The number of nodes in the cluster. - :vartype node_count: int - :ivar resource_move_details: The details of the move operation on this resource. - :vartype resource_move_details: ~azure.mgmt.databoxedge.v2020_12_01.models.ResourceMoveDetails - :ivar edge_profile: The details of Edge Profile for this resource. - :vartype edge_profile: ~azure.mgmt.databoxedge.v2020_12_01.models.EdgeProfile - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'kind': {'readonly': True}, - 'system_data': {'readonly': True}, - 'serial_number': {'readonly': True}, - 'description': {'readonly': True}, - 'model_description': {'readonly': True}, - 'device_type': {'readonly': True}, - 'friendly_name': {'readonly': True}, - 'culture': {'readonly': True}, - 'device_model': {'readonly': True}, - 'device_software_version': {'readonly': True}, - 'device_local_capacity': {'readonly': True}, - 'time_zone': {'readonly': True}, - 'device_hcs_version': {'readonly': True}, - 'configured_role_types': {'readonly': True}, - 'node_count': {'readonly': True}, - 'resource_move_details': {'readonly': True}, - 'edge_profile': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'ResourceIdentity'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'data_box_edge_device_status': {'key': 'properties.dataBoxEdgeDeviceStatus', 'type': 'str'}, - 'serial_number': {'key': 'properties.serialNumber', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'model_description': {'key': 'properties.modelDescription', 'type': 'str'}, - 'device_type': {'key': 'properties.deviceType', 'type': 'str'}, - 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, - 'culture': {'key': 'properties.culture', 'type': 'str'}, - 'device_model': {'key': 'properties.deviceModel', 'type': 'str'}, - 'device_software_version': {'key': 'properties.deviceSoftwareVersion', 'type': 'str'}, - 'device_local_capacity': {'key': 'properties.deviceLocalCapacity', 'type': 'long'}, - 'time_zone': {'key': 'properties.timeZone', 'type': 'str'}, - 'device_hcs_version': {'key': 'properties.deviceHcsVersion', 'type': 'str'}, - 'configured_role_types': {'key': 'properties.configuredRoleTypes', 'type': '[str]'}, - 'node_count': {'key': 'properties.nodeCount', 'type': 'int'}, - 'resource_move_details': {'key': 'properties.resourceMoveDetails', 'type': 'ResourceMoveDetails'}, - 'edge_profile': {'key': 'properties.edgeProfile', 'type': 'EdgeProfile'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeDevice, self).__init__(**kwargs) - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.etag = kwargs.get('etag', None) - self.identity = kwargs.get('identity', None) - self.kind = None - self.system_data = None - self.data_box_edge_device_status = kwargs.get('data_box_edge_device_status', None) - self.serial_number = None - self.description = None - self.model_description = None - self.device_type = None - self.friendly_name = None - self.culture = None - self.device_model = None - self.device_software_version = None - self.device_local_capacity = None - self.time_zone = None - self.device_hcs_version = None - self.configured_role_types = None - self.node_count = None - self.resource_move_details = None - self.edge_profile = None - - -class DataBoxEdgeDeviceExtendedInfo(ARMBaseModel): - """The extended Info of the Data Box Edge/Gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param encryption_key_thumbprint: The digital signature of encrypted certificate. - :type encryption_key_thumbprint: str - :param encryption_key: The public part of the encryption certificate. Client uses this to - encrypt any secret. - :type encryption_key: str - :ivar resource_key: The Resource ID of the Resource. - :vartype resource_key: str - :param client_secret_store_id: The Key Vault ARM Id for client secrets. - :type client_secret_store_id: str - :param client_secret_store_url: The url to access the Client Key Vault. - :type client_secret_store_url: str - :param channel_integrity_key_name: The name of Channel Integrity Key stored in the Client Key - Vault. - :type channel_integrity_key_name: str - :param channel_integrity_key_version: The version of Channel Integrity Key stored in the Client - Key Vault. - :type channel_integrity_key_version: str - :param key_vault_sync_status: Key vault sync status. Possible values include: "KeyVaultSynced", - "KeyVaultSyncFailed", "KeyVaultNotConfigured", "KeyVaultSyncPending", "KeyVaultSyncing". - :type key_vault_sync_status: str or - ~azure.mgmt.databoxedge.v2020_12_01.models.KeyVaultSyncStatus - :ivar device_secrets: Device secrets, will be returned only with ODataFilter - $expand=deviceSecrets. - :vartype device_secrets: ~azure.mgmt.databoxedge.v2020_12_01.models.DeviceSecrets - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'resource_key': {'readonly': True}, - 'device_secrets': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'encryption_key_thumbprint': {'key': 'properties.encryptionKeyThumbprint', 'type': 'str'}, - 'encryption_key': {'key': 'properties.encryptionKey', 'type': 'str'}, - 'resource_key': {'key': 'properties.resourceKey', 'type': 'str'}, - 'client_secret_store_id': {'key': 'properties.clientSecretStoreId', 'type': 'str'}, - 'client_secret_store_url': {'key': 'properties.clientSecretStoreUrl', 'type': 'str'}, - 'channel_integrity_key_name': {'key': 'properties.channelIntegrityKeyName', 'type': 'str'}, - 'channel_integrity_key_version': {'key': 'properties.channelIntegrityKeyVersion', 'type': 'str'}, - 'key_vault_sync_status': {'key': 'properties.keyVaultSyncStatus', 'type': 'str'}, - 'device_secrets': {'key': 'properties.deviceSecrets', 'type': 'DeviceSecrets'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeDeviceExtendedInfo, self).__init__(**kwargs) - self.encryption_key_thumbprint = kwargs.get('encryption_key_thumbprint', None) - self.encryption_key = kwargs.get('encryption_key', None) - self.resource_key = None - self.client_secret_store_id = kwargs.get('client_secret_store_id', None) - self.client_secret_store_url = kwargs.get('client_secret_store_url', None) - self.channel_integrity_key_name = kwargs.get('channel_integrity_key_name', None) - self.channel_integrity_key_version = kwargs.get('channel_integrity_key_version', None) - self.key_vault_sync_status = kwargs.get('key_vault_sync_status', None) - self.device_secrets = None - - -class DataBoxEdgeDeviceExtendedInfoPatch(msrest.serialization.Model): - """The Data Box Edge/Gateway device extended info patch. - - :param client_secret_store_id: The Key Vault ARM Id for client secrets. - :type client_secret_store_id: str - :param client_secret_store_url: The url to access the Client Key Vault. - :type client_secret_store_url: str - :param channel_integrity_key_name: The name for Channel Integrity Key stored in the Client Key - Vault. - :type channel_integrity_key_name: str - :param channel_integrity_key_version: The version of Channel Integrity Key stored in the Client - Key Vault. - :type channel_integrity_key_version: str - :param sync_status: For changing or to initiate the resync to key-vault set the status to - KeyVaultSyncPending, rest of the status will not be applicable. Possible values include: - "KeyVaultSynced", "KeyVaultSyncFailed", "KeyVaultNotConfigured", "KeyVaultSyncPending", - "KeyVaultSyncing". - :type sync_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.KeyVaultSyncStatus - """ - - _attribute_map = { - 'client_secret_store_id': {'key': 'clientSecretStoreId', 'type': 'str'}, - 'client_secret_store_url': {'key': 'clientSecretStoreUrl', 'type': 'str'}, - 'channel_integrity_key_name': {'key': 'channelIntegrityKeyName', 'type': 'str'}, - 'channel_integrity_key_version': {'key': 'channelIntegrityKeyVersion', 'type': 'str'}, - 'sync_status': {'key': 'syncStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeDeviceExtendedInfoPatch, self).__init__(**kwargs) - self.client_secret_store_id = kwargs.get('client_secret_store_id', None) - self.client_secret_store_url = kwargs.get('client_secret_store_url', None) - self.channel_integrity_key_name = kwargs.get('channel_integrity_key_name', None) - self.channel_integrity_key_version = kwargs.get('channel_integrity_key_version', None) - self.sync_status = kwargs.get('sync_status', None) - - -class DataBoxEdgeDeviceList(msrest.serialization.Model): - """The collection of Data Box Edge/Gateway devices. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of Data Box Edge/Gateway devices. - :vartype value: list[~azure.mgmt.databoxedge.v2020_12_01.models.DataBoxEdgeDevice] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DataBoxEdgeDevice]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeDeviceList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class DataBoxEdgeDevicePatch(msrest.serialization.Model): - """The Data Box Edge/Gateway device patch. - - :param tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. - :type tags: dict[str, str] - :param identity: Msi identity of the resource. - :type identity: ~azure.mgmt.databoxedge.v2020_12_01.models.ResourceIdentity - :param edge_profile: Edge Profile property of the Data Box Edge/Gateway device. - :type edge_profile: ~azure.mgmt.databoxedge.v2020_12_01.models.EdgeProfilePatch - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ResourceIdentity'}, - 'edge_profile': {'key': 'properties.edgeProfile', 'type': 'EdgeProfilePatch'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeDevicePatch, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.edge_profile = kwargs.get('edge_profile', None) - - -class DataBoxEdgeMoveRequest(msrest.serialization.Model): - """Resource Move details. - - All required parameters must be populated in order to send to Azure. - - :param target_resource_group: Required. Target resource group ARMId. - :type target_resource_group: str - :param resources: Required. List of resources to be moved. - :type resources: list[str] - """ - - _validation = { - 'target_resource_group': {'required': True}, - 'resources': {'required': True}, - } - - _attribute_map = { - 'target_resource_group': {'key': 'targetResourceGroup', 'type': 'str'}, - 'resources': {'key': 'resources', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeMoveRequest, self).__init__(**kwargs) - self.target_resource_group = kwargs['target_resource_group'] - self.resources = kwargs['resources'] - - -class DataBoxEdgeSku(msrest.serialization.Model): - """The Sku information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar resource_type: The type of the resource. - :vartype resource_type: str - :ivar name: The Sku name. Possible values include: "Gateway", "Edge", "TEA_1Node", - "TEA_1Node_UPS", "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", - "TEA_4Node_UPS_Heater", "TMA", "TDC", "TCA_Small", "GPU", "TCA_Large", "EdgeP_Base", - "EdgeP_High", "EdgePR_Base", "EdgePR_Base_UPS", "EdgeMR_Mini", "RCA_Small", "RCA_Large", "RDC". - :vartype name: str or ~azure.mgmt.databoxedge.v2020_12_01.models.SkuName - :ivar kind: The Sku kind. - :vartype kind: str - :ivar tier: The Sku tier. Possible values include: "Standard". - :vartype tier: str or ~azure.mgmt.databoxedge.v2020_12_01.models.SkuTier - :ivar size: The Sku kind. - :vartype size: str - :ivar family: The Sku family. - :vartype family: str - :ivar locations: Availability of the Sku for the region. - :vartype locations: list[str] - :ivar api_versions: The API versions in which Sku is available. - :vartype api_versions: list[str] - :ivar location_info: Availability of the Sku for the location/zone/site. - :vartype location_info: list[~azure.mgmt.databoxedge.v2020_12_01.models.SkuLocationInfo] - :ivar costs: The pricing info of the Sku. - :vartype costs: list[~azure.mgmt.databoxedge.v2020_12_01.models.SkuCost] - :ivar signup_option: Sku can be signed up by customer or not. Possible values include: "None", - "Available". - :vartype signup_option: str or ~azure.mgmt.databoxedge.v2020_12_01.models.SkuSignupOption - :ivar version: Availability of the Sku as preview/stable. Possible values include: "Stable", - "Preview". - :vartype version: str or ~azure.mgmt.databoxedge.v2020_12_01.models.SkuVersion - :ivar availability: Links to the next set of results. Possible values include: "Available", - "Unavailable". - :vartype availability: str or ~azure.mgmt.databoxedge.v2020_12_01.models.SkuAvailability - :ivar shipment_types: List of Shipment Types supported by this SKU. - :vartype shipment_types: list[str or ~azure.mgmt.databoxedge.v2020_12_01.models.ShipmentType] - :ivar capabilities: The capability info of the SKU. - :vartype capabilities: list[~azure.mgmt.databoxedge.v2020_12_01.models.SkuCapability] - """ - - _validation = { - 'resource_type': {'readonly': True}, - 'name': {'readonly': True}, - 'kind': {'readonly': True}, - 'tier': {'readonly': True}, - 'size': {'readonly': True}, - 'family': {'readonly': True}, - 'locations': {'readonly': True}, - 'api_versions': {'readonly': True}, - 'location_info': {'readonly': True}, - 'costs': {'readonly': True}, - 'signup_option': {'readonly': True}, - 'version': {'readonly': True}, - 'availability': {'readonly': True}, - 'shipment_types': {'readonly': True}, - 'capabilities': {'readonly': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'str'}, - 'family': {'key': 'family', 'type': 'str'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'api_versions': {'key': 'apiVersions', 'type': '[str]'}, - 'location_info': {'key': 'locationInfo', 'type': '[SkuLocationInfo]'}, - 'costs': {'key': 'costs', 'type': '[SkuCost]'}, - 'signup_option': {'key': 'signupOption', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'availability': {'key': 'availability', 'type': 'str'}, - 'shipment_types': {'key': 'shipmentTypes', 'type': '[str]'}, - 'capabilities': {'key': 'capabilities', 'type': '[SkuCapability]'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeSku, self).__init__(**kwargs) - self.resource_type = None - self.name = None - self.kind = None - self.tier = None - self.size = None - self.family = None - self.locations = None - self.api_versions = None - self.location_info = None - self.costs = None - self.signup_option = None - self.version = None - self.availability = None - self.shipment_types = None - self.capabilities = None - - -class DataBoxEdgeSkuList(msrest.serialization.Model): - """List of SKU Information objects. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of ResourceType Sku. - :vartype value: list[~azure.mgmt.databoxedge.v2020_12_01.models.DataBoxEdgeSku] - :ivar next_link: Links to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DataBoxEdgeSku]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeSkuList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class DCAccessCode(msrest.serialization.Model): - """DC Access code in the case of Self Managed Shipping. - - :param auth_code: DCAccess Code for the Self Managed shipment. - :type auth_code: str - """ - - _attribute_map = { - 'auth_code': {'key': 'properties.authCode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DCAccessCode, self).__init__(**kwargs) - self.auth_code = kwargs.get('auth_code', None) - - -class DeviceSecrets(msrest.serialization.Model): - """Device Secrets. - - :param hcs_data_volume_bit_locker_external_key: Keyvault Id of - HcsDataVolumeBitLockerExternalKey. - :type hcs_data_volume_bit_locker_external_key: - ~azure.mgmt.databoxedge.v2020_12_01.models.Secret - :param hcs_internal_volume_bit_locker_external_key: Keyvault Id of - HcsInternalVolumeBitLockerExternalKey. - :type hcs_internal_volume_bit_locker_external_key: - ~azure.mgmt.databoxedge.v2020_12_01.models.Secret - :param system_volume_bit_locker_recovery_key: Keyvault Id of SystemVolumeBitLockerRecoveryKey. - :type system_volume_bit_locker_recovery_key: ~azure.mgmt.databoxedge.v2020_12_01.models.Secret - :param sed_encryption_external_key_id: Keyvault Id of SEDEncryptionExternalKeyId. - :type sed_encryption_external_key_id: ~azure.mgmt.databoxedge.v2020_12_01.models.Secret - :param sed_encryption_external_key: Keyvault Id of SEDEncryptionExternalKey. - :type sed_encryption_external_key: ~azure.mgmt.databoxedge.v2020_12_01.models.Secret - :param bmc_default_user_password: Keyvault Id of BMCDefaultUserPassword. - :type bmc_default_user_password: ~azure.mgmt.databoxedge.v2020_12_01.models.Secret - :param rotate_key_for_data_volume_bitlocker: Keyvault Id of RotateKeyForDataVolumeBitlocker. - :type rotate_key_for_data_volume_bitlocker: ~azure.mgmt.databoxedge.v2020_12_01.models.Secret - :param rotate_keys_for_sed_drives_serialized: Keyvault Id of RotateKeysForSedDrivesSerialized. - :type rotate_keys_for_sed_drives_serialized: ~azure.mgmt.databoxedge.v2020_12_01.models.Secret - """ - - _attribute_map = { - 'hcs_data_volume_bit_locker_external_key': {'key': 'hcsDataVolumeBitLockerExternalKey', 'type': 'Secret'}, - 'hcs_internal_volume_bit_locker_external_key': {'key': 'hcsInternalVolumeBitLockerExternalKey', 'type': 'Secret'}, - 'system_volume_bit_locker_recovery_key': {'key': 'systemVolumeBitLockerRecoveryKey', 'type': 'Secret'}, - 'sed_encryption_external_key_id': {'key': 'sedEncryptionExternalKeyId', 'type': 'Secret'}, - 'sed_encryption_external_key': {'key': 'sedEncryptionExternalKey', 'type': 'Secret'}, - 'bmc_default_user_password': {'key': 'bmcDefaultUserPassword', 'type': 'Secret'}, - 'rotate_key_for_data_volume_bitlocker': {'key': 'rotateKeyForDataVolumeBitlocker', 'type': 'Secret'}, - 'rotate_keys_for_sed_drives_serialized': {'key': 'rotateKeysForSedDrivesSerialized', 'type': 'Secret'}, - } - - def __init__( - self, - **kwargs - ): - super(DeviceSecrets, self).__init__(**kwargs) - self.hcs_data_volume_bit_locker_external_key = kwargs.get('hcs_data_volume_bit_locker_external_key', None) - self.hcs_internal_volume_bit_locker_external_key = kwargs.get('hcs_internal_volume_bit_locker_external_key', None) - self.system_volume_bit_locker_recovery_key = kwargs.get('system_volume_bit_locker_recovery_key', None) - self.sed_encryption_external_key_id = kwargs.get('sed_encryption_external_key_id', None) - self.sed_encryption_external_key = kwargs.get('sed_encryption_external_key', None) - self.bmc_default_user_password = kwargs.get('bmc_default_user_password', None) - self.rotate_key_for_data_volume_bitlocker = kwargs.get('rotate_key_for_data_volume_bitlocker', None) - self.rotate_keys_for_sed_drives_serialized = kwargs.get('rotate_keys_for_sed_drives_serialized', None) - - -class EdgeProfile(msrest.serialization.Model): - """Details about Edge Profile for the resource. - - :param subscription: Edge Profile Subscription. - :type subscription: ~azure.mgmt.databoxedge.v2020_12_01.models.EdgeProfileSubscription - """ - - _attribute_map = { - 'subscription': {'key': 'subscription', 'type': 'EdgeProfileSubscription'}, - } - - def __init__( - self, - **kwargs - ): - super(EdgeProfile, self).__init__(**kwargs) - self.subscription = kwargs.get('subscription', None) - - -class EdgeProfilePatch(msrest.serialization.Model): - """The Data Box Edge/Gateway Edge Profile patch. - - :param subscription: The Data Box Edge/Gateway Edge Profile Subscription patch. - :type subscription: ~azure.mgmt.databoxedge.v2020_12_01.models.EdgeProfileSubscriptionPatch - """ - - _attribute_map = { - 'subscription': {'key': 'subscription', 'type': 'EdgeProfileSubscriptionPatch'}, - } - - def __init__( - self, - **kwargs - ): - super(EdgeProfilePatch, self).__init__(**kwargs) - self.subscription = kwargs.get('subscription', None) - - -class EdgeProfileSubscription(msrest.serialization.Model): - """Subscription details for the Edge Profile. - - :param registration_id: Edge Subscription Registration ID. - :type registration_id: str - :param id: ARM ID of the subscription. - :type id: str - :param state: Possible values include: "Registered", "Warned", "Suspended", "Deleted", - "Unregistered". - :type state: str or ~azure.mgmt.databoxedge.v2020_12_01.models.SubscriptionState - :param registration_date: - :type registration_date: str - :param subscription_id: - :type subscription_id: str - :param tenant_id: - :type tenant_id: str - :param location_placement_id: - :type location_placement_id: str - :param quota_id: - :type quota_id: str - :param serialized_details: - :type serialized_details: str - :param registered_features: - :type registered_features: - list[~azure.mgmt.databoxedge.v2020_12_01.models.SubscriptionRegisteredFeatures] - """ - - _attribute_map = { - 'registration_id': {'key': 'registrationId', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'registration_date': {'key': 'registrationDate', 'type': 'str'}, - 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, - 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, - 'location_placement_id': {'key': 'properties.locationPlacementId', 'type': 'str'}, - 'quota_id': {'key': 'properties.quotaId', 'type': 'str'}, - 'serialized_details': {'key': 'properties.serializedDetails', 'type': 'str'}, - 'registered_features': {'key': 'properties.registeredFeatures', 'type': '[SubscriptionRegisteredFeatures]'}, - } - - def __init__( - self, - **kwargs - ): - super(EdgeProfileSubscription, self).__init__(**kwargs) - self.registration_id = kwargs.get('registration_id', None) - self.id = kwargs.get('id', None) - self.state = kwargs.get('state', None) - self.registration_date = kwargs.get('registration_date', None) - self.subscription_id = kwargs.get('subscription_id', None) - self.tenant_id = kwargs.get('tenant_id', None) - self.location_placement_id = kwargs.get('location_placement_id', None) - self.quota_id = kwargs.get('quota_id', None) - self.serialized_details = kwargs.get('serialized_details', None) - self.registered_features = kwargs.get('registered_features', None) - - -class EdgeProfileSubscriptionPatch(msrest.serialization.Model): - """The Data Box Edge/Gateway Edge Profile Subscription patch. - - :param id: The path ID that uniquely identifies the subscription of the edge profile. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EdgeProfileSubscriptionPatch, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class EtcdInfo(msrest.serialization.Model): - """Etcd configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: Etcd type. - :vartype type: str - :ivar version: Etcd version. - :vartype version: str - """ - - _validation = { - 'type': {'readonly': True}, - 'version': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EtcdInfo, self).__init__(**kwargs) - self.type = None - self.version = None - - -class Trigger(ARMBaseModel): - """Trigger details. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: FileEventTrigger, PeriodicTimerEventTrigger. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar system_data: Trigger in DataBoxEdge Resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: - "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.TriggerEventType - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'kind': {'key': 'kind', 'type': 'str'}, - } - - _subtype_map = { - 'kind': {'FileEvent': 'FileEventTrigger', 'PeriodicTimerEvent': 'PeriodicTimerEventTrigger'} - } - - def __init__( - self, - **kwargs - ): - super(Trigger, self).__init__(**kwargs) - self.system_data = None - self.kind = 'Trigger' # type: str - - -class FileEventTrigger(Trigger): - """Trigger details. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar system_data: Trigger in DataBoxEdge Resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: - "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.TriggerEventType - :param source_info: Required. File event source details. - :type source_info: ~azure.mgmt.databoxedge.v2020_12_01.models.FileSourceInfo - :param sink_info: Required. Role sink info. - :type sink_info: ~azure.mgmt.databoxedge.v2020_12_01.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against - its usage. For example, if a periodic timer trigger is intended for certain specific IoT - modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'kind': {'required': True}, - 'source_info': {'required': True}, - 'sink_info': {'required': True}, - 'custom_context_tag': {'max_length': 192, 'min_length': 0}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'source_info': {'key': 'properties.sourceInfo', 'type': 'FileSourceInfo'}, - 'sink_info': {'key': 'properties.sinkInfo', 'type': 'RoleSinkInfo'}, - 'custom_context_tag': {'key': 'properties.customContextTag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FileEventTrigger, self).__init__(**kwargs) - self.kind = 'FileEvent' # type: str - self.source_info = kwargs['source_info'] - self.sink_info = kwargs['sink_info'] - self.custom_context_tag = kwargs.get('custom_context_tag', None) - - -class FileSourceInfo(msrest.serialization.Model): - """File source details. - - All required parameters must be populated in order to send to Azure. - - :param share_id: Required. File share ID. - :type share_id: str - """ - - _validation = { - 'share_id': {'required': True}, - } - - _attribute_map = { - 'share_id': {'key': 'shareId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FileSourceInfo, self).__init__(**kwargs) - self.share_id = kwargs['share_id'] - - -class GenerateCertResponse(msrest.serialization.Model): - """Used in activation key generation flow. - - :param public_key: Gets or sets base64 encoded certificate raw data, - this is the public part needed to be uploaded to cert vault. - :type public_key: str - :param private_key: Gets or sets base64 encoded private part of the certificate, - needed to form the activation key. - :type private_key: str - :param expiry_time_in_utc: Gets or sets expiry time in UTC. - :type expiry_time_in_utc: str - """ - - _attribute_map = { - 'public_key': {'key': 'publicKey', 'type': 'str'}, - 'private_key': {'key': 'privateKey', 'type': 'str'}, - 'expiry_time_in_utc': {'key': 'expiryTimeInUTC', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GenerateCertResponse, self).__init__(**kwargs) - self.public_key = kwargs.get('public_key', None) - self.private_key = kwargs.get('private_key', None) - self.expiry_time_in_utc = kwargs.get('expiry_time_in_utc', None) - - -class ImageRepositoryCredential(msrest.serialization.Model): - """Image repository credential. - - All required parameters must be populated in order to send to Azure. - - :param image_repository_url: Required. Image repository url (e.g.: mcr.microsoft.com). - :type image_repository_url: str - :param user_name: Required. Repository user name. - :type user_name: str - :param password: Repository user password. - :type password: ~azure.mgmt.databoxedge.v2020_12_01.models.AsymmetricEncryptedSecret - """ - - _validation = { - 'image_repository_url': {'required': True}, - 'user_name': {'required': True}, - } - - _attribute_map = { - 'image_repository_url': {'key': 'imageRepositoryUrl', 'type': 'str'}, - 'user_name': {'key': 'userName', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'AsymmetricEncryptedSecret'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageRepositoryCredential, self).__init__(**kwargs) - self.image_repository_url = kwargs['image_repository_url'] - self.user_name = kwargs['user_name'] - self.password = kwargs.get('password', None) - - -class IoTAddon(Addon): - """IoT Addon. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Addon type.Constant filled by server. Possible values include: - "IotEdge", "ArcForKubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.AddonType - :ivar system_data: Addon type. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - :param io_t_device_details: Required. IoT device metadata to which appliance needs to be - connected. - :type io_t_device_details: ~azure.mgmt.databoxedge.v2020_12_01.models.IoTDeviceInfo - :param io_t_edge_device_details: Required. IoT edge device to which the IoT Addon needs to be - configured. - :type io_t_edge_device_details: ~azure.mgmt.databoxedge.v2020_12_01.models.IoTDeviceInfo - :ivar version: Version of IoT running on the appliance. - :vartype version: str - :ivar host_platform: Host OS supported by the IoT addon. Possible values include: "Windows", - "Linux". - :vartype host_platform: str or ~azure.mgmt.databoxedge.v2020_12_01.models.PlatformType - :ivar host_platform_type: Platform where the runtime is hosted. Possible values include: - "KubernetesCluster", "LinuxVM". - :vartype host_platform_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.HostPlatformType - :ivar provisioning_state: Addon Provisioning State. Possible values include: "Invalid", - "Creating", "Created", "Updating", "Reconfiguring", "Failed", "Deleting". - :vartype provisioning_state: str or ~azure.mgmt.databoxedge.v2020_12_01.models.AddonState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - 'io_t_device_details': {'required': True}, - 'io_t_edge_device_details': {'required': True}, - 'version': {'readonly': True}, - 'host_platform': {'readonly': True}, - 'host_platform_type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'io_t_device_details': {'key': 'properties.ioTDeviceDetails', 'type': 'IoTDeviceInfo'}, - 'io_t_edge_device_details': {'key': 'properties.ioTEdgeDeviceDetails', 'type': 'IoTDeviceInfo'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'host_platform': {'key': 'properties.hostPlatform', 'type': 'str'}, - 'host_platform_type': {'key': 'properties.hostPlatformType', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IoTAddon, self).__init__(**kwargs) - self.kind = 'IotEdge' # type: str - self.io_t_device_details = kwargs['io_t_device_details'] - self.io_t_edge_device_details = kwargs['io_t_edge_device_details'] - self.version = None - self.host_platform = None - self.host_platform_type = None - self.provisioning_state = None - - -class IoTDeviceInfo(msrest.serialization.Model): - """Metadata of IoT device/IoT Edge device to be configured. - - All required parameters must be populated in order to send to Azure. - - :param device_id: Required. ID of the IoT device/edge device. - :type device_id: str - :param io_t_host_hub: Required. Host name for the IoT hub associated to the device. - :type io_t_host_hub: str - :param io_t_host_hub_id: Id for the IoT hub associated to the device. - :type io_t_host_hub_id: str - :param authentication: Encrypted IoT device/IoT edge device connection string. - :type authentication: ~azure.mgmt.databoxedge.v2020_12_01.models.Authentication - """ - - _validation = { - 'device_id': {'required': True}, - 'io_t_host_hub': {'required': True}, - } - - _attribute_map = { - 'device_id': {'key': 'deviceId', 'type': 'str'}, - 'io_t_host_hub': {'key': 'ioTHostHub', 'type': 'str'}, - 'io_t_host_hub_id': {'key': 'ioTHostHubId', 'type': 'str'}, - 'authentication': {'key': 'authentication', 'type': 'Authentication'}, - } - - def __init__( - self, - **kwargs - ): - super(IoTDeviceInfo, self).__init__(**kwargs) - self.device_id = kwargs['device_id'] - self.io_t_host_hub = kwargs['io_t_host_hub'] - self.io_t_host_hub_id = kwargs.get('io_t_host_hub_id', None) - self.authentication = kwargs.get('authentication', None) - - -class IoTEdgeAgentInfo(msrest.serialization.Model): - """IoT edge agent details is optional, this will be used for download system Agent module while bootstrapping IoT Role if specified. - - All required parameters must be populated in order to send to Azure. - - :param image_name: Required. Name of the IoT edge agent image. - :type image_name: str - :param tag: Required. Image Tag. - :type tag: str - :param image_repository: Image repository details. - :type image_repository: ~azure.mgmt.databoxedge.v2020_12_01.models.ImageRepositoryCredential - """ - - _validation = { - 'image_name': {'required': True}, - 'tag': {'required': True}, - } - - _attribute_map = { - 'image_name': {'key': 'imageName', 'type': 'str'}, - 'tag': {'key': 'tag', 'type': 'str'}, - 'image_repository': {'key': 'imageRepository', 'type': 'ImageRepositoryCredential'}, - } - - def __init__( - self, - **kwargs - ): - super(IoTEdgeAgentInfo, self).__init__(**kwargs) - self.image_name = kwargs['image_name'] - self.tag = kwargs['tag'] - self.image_repository = kwargs.get('image_repository', None) - - -class IoTRole(Role): - """Compute role. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", - "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleTypes - :ivar system_data: Role configured on ASE resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - :param host_platform: Host OS supported by the IoT role. Possible values include: "Windows", - "Linux". - :type host_platform: str or ~azure.mgmt.databoxedge.v2020_12_01.models.PlatformType - :param io_t_device_details: IoT device metadata to which data box edge device needs to be - connected. - :type io_t_device_details: ~azure.mgmt.databoxedge.v2020_12_01.models.IoTDeviceInfo - :param io_t_edge_device_details: IoT edge device to which the IoT role needs to be configured. - :type io_t_edge_device_details: ~azure.mgmt.databoxedge.v2020_12_01.models.IoTDeviceInfo - :param share_mappings: Mount points of shares in role(s). - :type share_mappings: list[~azure.mgmt.databoxedge.v2020_12_01.models.MountPointMap] - :param io_t_edge_agent_info: Iot edge agent details to download the agent and bootstrap iot - runtime. - :type io_t_edge_agent_info: ~azure.mgmt.databoxedge.v2020_12_01.models.IoTEdgeAgentInfo - :ivar host_platform_type: Platform where the Iot runtime is hosted. Possible values include: - "KubernetesCluster", "LinuxVM". - :vartype host_platform_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.HostPlatformType - :param compute_resource: Resource allocation. - :type compute_resource: ~azure.mgmt.databoxedge.v2020_12_01.models.ComputeResource - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - 'host_platform_type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'host_platform': {'key': 'properties.hostPlatform', 'type': 'str'}, - 'io_t_device_details': {'key': 'properties.ioTDeviceDetails', 'type': 'IoTDeviceInfo'}, - 'io_t_edge_device_details': {'key': 'properties.ioTEdgeDeviceDetails', 'type': 'IoTDeviceInfo'}, - 'share_mappings': {'key': 'properties.shareMappings', 'type': '[MountPointMap]'}, - 'io_t_edge_agent_info': {'key': 'properties.ioTEdgeAgentInfo', 'type': 'IoTEdgeAgentInfo'}, - 'host_platform_type': {'key': 'properties.hostPlatformType', 'type': 'str'}, - 'compute_resource': {'key': 'properties.computeResource', 'type': 'ComputeResource'}, - 'role_status': {'key': 'properties.roleStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IoTRole, self).__init__(**kwargs) - self.kind = 'IOT' # type: str - self.host_platform = kwargs.get('host_platform', None) - self.io_t_device_details = kwargs.get('io_t_device_details', None) - self.io_t_edge_device_details = kwargs.get('io_t_edge_device_details', None) - self.share_mappings = kwargs.get('share_mappings', None) - self.io_t_edge_agent_info = kwargs.get('io_t_edge_agent_info', None) - self.host_platform_type = None - self.compute_resource = kwargs.get('compute_resource', None) - self.role_status = kwargs.get('role_status', None) - - -class Ipv4Config(msrest.serialization.Model): - """Details related to the IPv4 address configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar ip_address: The IPv4 address of the network adapter. - :vartype ip_address: str - :ivar subnet: The IPv4 subnet of the network adapter. - :vartype subnet: str - :ivar gateway: The IPv4 gateway of the network adapter. - :vartype gateway: str - """ - - _validation = { - 'ip_address': {'readonly': True}, - 'subnet': {'readonly': True}, - 'gateway': {'readonly': True}, - } - - _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'subnet': {'key': 'subnet', 'type': 'str'}, - 'gateway': {'key': 'gateway', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Ipv4Config, self).__init__(**kwargs) - self.ip_address = None - self.subnet = None - self.gateway = None - - -class Ipv6Config(msrest.serialization.Model): - """Details related to the IPv6 address configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar ip_address: The IPv6 address of the network adapter. - :vartype ip_address: str - :ivar prefix_length: The IPv6 prefix of the network adapter. - :vartype prefix_length: int - :ivar gateway: The IPv6 gateway of the network adapter. - :vartype gateway: str - """ - - _validation = { - 'ip_address': {'readonly': True}, - 'prefix_length': {'readonly': True}, - 'gateway': {'readonly': True}, - } - - _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'prefix_length': {'key': 'prefixLength', 'type': 'int'}, - 'gateway': {'key': 'gateway', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Ipv6Config, self).__init__(**kwargs) - self.ip_address = None - self.prefix_length = None - self.gateway = None - - -class Job(msrest.serialization.Model): - """A device job. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The name of the object. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar status: The current status of the job. Possible values include: "Invalid", "Running", - "Succeeded", "Failed", "Canceled", "Paused", "Scheduled". - :vartype status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.JobStatus - :ivar start_time: The UTC date and time at which the job started. - :vartype start_time: ~datetime.datetime - :ivar end_time: The UTC date and time at which the job completed. - :vartype end_time: ~datetime.datetime - :ivar percent_complete: The percentage of the job that is complete. - :vartype percent_complete: int - :ivar error: The error details. - :vartype error: ~azure.mgmt.databoxedge.v2020_12_01.models.JobErrorDetails - :ivar job_type: The type of the job. Possible values include: "Invalid", "ScanForUpdates", - "DownloadUpdates", "InstallUpdates", "RefreshShare", "RefreshContainer", "Backup", "Restore", - "TriggerSupportPackage". - :vartype job_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.JobType - :ivar current_stage: Current stage of the update operation. Possible values include: "Unknown", - "Initial", "ScanStarted", "ScanComplete", "ScanFailed", "DownloadStarted", "DownloadComplete", - "DownloadFailed", "InstallStarted", "InstallComplete", "InstallFailed", "RebootInitiated", - "Success", "Failure", "RescanStarted", "RescanComplete", "RescanFailed". - :vartype current_stage: str or ~azure.mgmt.databoxedge.v2020_12_01.models.UpdateOperationStage - :ivar download_progress: The download progress. - :vartype download_progress: ~azure.mgmt.databoxedge.v2020_12_01.models.UpdateDownloadProgress - :ivar install_progress: The install progress. - :vartype install_progress: ~azure.mgmt.databoxedge.v2020_12_01.models.UpdateInstallProgress - :ivar total_refresh_errors: Total number of errors encountered during the refresh process. - :vartype total_refresh_errors: int - :ivar error_manifest_file: Local share/remote container relative path to the error manifest - file of the refresh. - :vartype error_manifest_file: str - :ivar refreshed_entity_id: ARM ID of the entity that was refreshed. - :vartype refreshed_entity_id: str - :param folder: If only subfolders need to be refreshed, then the subfolder path inside the - share or container. (The path is empty if there are no subfolders.). - :type folder: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'status': {'readonly': True}, - 'start_time': {'readonly': True}, - 'end_time': {'readonly': True}, - 'percent_complete': {'readonly': True}, - 'error': {'readonly': True}, - 'job_type': {'readonly': True}, - 'current_stage': {'readonly': True}, - 'download_progress': {'readonly': True}, - 'install_progress': {'readonly': True}, - 'total_refresh_errors': {'readonly': True}, - 'error_manifest_file': {'readonly': True}, - 'refreshed_entity_id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'percent_complete': {'key': 'percentComplete', 'type': 'int'}, - 'error': {'key': 'error', 'type': 'JobErrorDetails'}, - 'job_type': {'key': 'properties.jobType', 'type': 'str'}, - 'current_stage': {'key': 'properties.currentStage', 'type': 'str'}, - 'download_progress': {'key': 'properties.downloadProgress', 'type': 'UpdateDownloadProgress'}, - 'install_progress': {'key': 'properties.installProgress', 'type': 'UpdateInstallProgress'}, - 'total_refresh_errors': {'key': 'properties.totalRefreshErrors', 'type': 'int'}, - 'error_manifest_file': {'key': 'properties.errorManifestFile', 'type': 'str'}, - 'refreshed_entity_id': {'key': 'properties.refreshedEntityId', 'type': 'str'}, - 'folder': {'key': 'properties.folder', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Job, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.status = None - self.start_time = None - self.end_time = None - self.percent_complete = None - self.error = None - self.job_type = None - self.current_stage = None - self.download_progress = None - self.install_progress = None - self.total_refresh_errors = None - self.error_manifest_file = None - self.refreshed_entity_id = None - self.folder = kwargs.get('folder', None) - - -class JobErrorDetails(msrest.serialization.Model): - """The job error information containing the list of job errors. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error_details: The error details. - :vartype error_details: list[~azure.mgmt.databoxedge.v2020_12_01.models.JobErrorItem] - :ivar code: The code intended for programmatic access. - :vartype code: str - :ivar message: The message that describes the error in detail. - :vartype message: str - """ - - _validation = { - 'error_details': {'readonly': True}, - 'code': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'error_details': {'key': 'errorDetails', 'type': '[JobErrorItem]'}, - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(JobErrorDetails, self).__init__(**kwargs) - self.error_details = None - self.code = None - self.message = None - - -class JobErrorItem(msrest.serialization.Model): - """The job error items. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar recommendations: The recommended actions. - :vartype recommendations: list[str] - :ivar code: The code intended for programmatic access. - :vartype code: str - :ivar message: The message that describes the error in detail. - :vartype message: str - """ - - _validation = { - 'recommendations': {'readonly': True}, - 'code': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'recommendations': {'key': 'recommendations', 'type': '[str]'}, - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(JobErrorItem, self).__init__(**kwargs) - self.recommendations = None - self.code = None - self.message = None - - -class KubernetesClusterInfo(msrest.serialization.Model): - """Kubernetes cluster configuration. - - 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 etcd_info: Etcd configuration. - :vartype etcd_info: ~azure.mgmt.databoxedge.v2020_12_01.models.EtcdInfo - :ivar nodes: Kubernetes cluster nodes. - :vartype nodes: list[~azure.mgmt.databoxedge.v2020_12_01.models.NodeInfo] - :param version: Required. Kubernetes cluster version. - :type version: str - """ - - _validation = { - 'etcd_info': {'readonly': True}, - 'nodes': {'readonly': True}, - 'version': {'required': True}, - } - - _attribute_map = { - 'etcd_info': {'key': 'etcdInfo', 'type': 'EtcdInfo'}, - 'nodes': {'key': 'nodes', 'type': '[NodeInfo]'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KubernetesClusterInfo, self).__init__(**kwargs) - self.etcd_info = None - self.nodes = None - self.version = kwargs['version'] - - -class KubernetesIPConfiguration(msrest.serialization.Model): - """Kubernetes node IP configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar port: Port of the Kubernetes node. - :vartype port: str - :param ip_address: IP address of the Kubernetes node. - :type ip_address: str - """ - - _validation = { - 'port': {'readonly': True}, - } - - _attribute_map = { - 'port': {'key': 'port', 'type': 'str'}, - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KubernetesIPConfiguration, self).__init__(**kwargs) - self.port = None - self.ip_address = kwargs.get('ip_address', None) - - -class KubernetesRole(Role): - """Kubernetes role. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", - "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleTypes - :ivar system_data: Role configured on ASE resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - :param host_platform: Host OS supported by the Kubernetes role. Possible values include: - "Windows", "Linux". - :type host_platform: str or ~azure.mgmt.databoxedge.v2020_12_01.models.PlatformType - :ivar provisioning_state: State of Kubernetes deployment. Possible values include: "Invalid", - "Creating", "Created", "Updating", "Reconfiguring", "Failed", "Deleting". - :vartype provisioning_state: str or ~azure.mgmt.databoxedge.v2020_12_01.models.KubernetesState - :ivar host_platform_type: Platform where the runtime is hosted. Possible values include: - "KubernetesCluster", "LinuxVM". - :vartype host_platform_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.HostPlatformType - :param kubernetes_cluster_info: Kubernetes cluster configuration. - :type kubernetes_cluster_info: ~azure.mgmt.databoxedge.v2020_12_01.models.KubernetesClusterInfo - :param kubernetes_role_resources: Kubernetes role resources. - :type kubernetes_role_resources: - ~azure.mgmt.databoxedge.v2020_12_01.models.KubernetesRoleResources - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'host_platform_type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'host_platform': {'key': 'properties.hostPlatform', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'host_platform_type': {'key': 'properties.hostPlatformType', 'type': 'str'}, - 'kubernetes_cluster_info': {'key': 'properties.kubernetesClusterInfo', 'type': 'KubernetesClusterInfo'}, - 'kubernetes_role_resources': {'key': 'properties.kubernetesRoleResources', 'type': 'KubernetesRoleResources'}, - 'role_status': {'key': 'properties.roleStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KubernetesRole, self).__init__(**kwargs) - self.kind = 'Kubernetes' # type: str - self.host_platform = kwargs.get('host_platform', None) - self.provisioning_state = None - self.host_platform_type = None - self.kubernetes_cluster_info = kwargs.get('kubernetes_cluster_info', None) - self.kubernetes_role_resources = kwargs.get('kubernetes_role_resources', None) - self.role_status = kwargs.get('role_status', None) - - -class KubernetesRoleCompute(msrest.serialization.Model): - """Kubernetes role compute 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. - - :param vm_profile: Required. VM profile. - :type vm_profile: str - :ivar memory_in_bytes: Memory in bytes. - :vartype memory_in_bytes: long - :ivar processor_count: Processor count. - :vartype processor_count: int - """ - - _validation = { - 'vm_profile': {'required': True}, - 'memory_in_bytes': {'readonly': True}, - 'processor_count': {'readonly': True}, - } - - _attribute_map = { - 'vm_profile': {'key': 'vmProfile', 'type': 'str'}, - 'memory_in_bytes': {'key': 'memoryInBytes', 'type': 'long'}, - 'processor_count': {'key': 'processorCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(KubernetesRoleCompute, self).__init__(**kwargs) - self.vm_profile = kwargs['vm_profile'] - self.memory_in_bytes = None - self.processor_count = None - - -class KubernetesRoleNetwork(msrest.serialization.Model): - """Kubernetes role network resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cni_config: Cni configuration. - :vartype cni_config: ~azure.mgmt.databoxedge.v2020_12_01.models.CniConfig - :ivar load_balancer_config: Load balancer configuration. - :vartype load_balancer_config: ~azure.mgmt.databoxedge.v2020_12_01.models.LoadBalancerConfig - """ - - _validation = { - 'cni_config': {'readonly': True}, - 'load_balancer_config': {'readonly': True}, - } - - _attribute_map = { - 'cni_config': {'key': 'cniConfig', 'type': 'CniConfig'}, - 'load_balancer_config': {'key': 'loadBalancerConfig', 'type': 'LoadBalancerConfig'}, - } - - def __init__( - self, - **kwargs - ): - super(KubernetesRoleNetwork, self).__init__(**kwargs) - self.cni_config = None - self.load_balancer_config = None - - -class KubernetesRoleResources(msrest.serialization.Model): - """Kubernetes role resources. - - 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 storage: Kubernetes role storage resource. - :type storage: ~azure.mgmt.databoxedge.v2020_12_01.models.KubernetesRoleStorage - :param compute: Required. Kubernetes role compute resource. - :type compute: ~azure.mgmt.databoxedge.v2020_12_01.models.KubernetesRoleCompute - :ivar network: Kubernetes role network resource. - :vartype network: ~azure.mgmt.databoxedge.v2020_12_01.models.KubernetesRoleNetwork - """ - - _validation = { - 'compute': {'required': True}, - 'network': {'readonly': True}, - } - - _attribute_map = { - 'storage': {'key': 'storage', 'type': 'KubernetesRoleStorage'}, - 'compute': {'key': 'compute', 'type': 'KubernetesRoleCompute'}, - 'network': {'key': 'network', 'type': 'KubernetesRoleNetwork'}, - } - - def __init__( - self, - **kwargs - ): - super(KubernetesRoleResources, self).__init__(**kwargs) - self.storage = kwargs.get('storage', None) - self.compute = kwargs['compute'] - self.network = None - - -class KubernetesRoleStorage(msrest.serialization.Model): - """Kubernetes role storage resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar storage_classes: Kubernetes storage class info. - :vartype storage_classes: - list[~azure.mgmt.databoxedge.v2020_12_01.models.KubernetesRoleStorageClassInfo] - :param endpoints: Mount points of shares in role(s). - :type endpoints: list[~azure.mgmt.databoxedge.v2020_12_01.models.MountPointMap] - """ - - _validation = { - 'storage_classes': {'readonly': True}, - } - - _attribute_map = { - 'storage_classes': {'key': 'storageClasses', 'type': '[KubernetesRoleStorageClassInfo]'}, - 'endpoints': {'key': 'endpoints', 'type': '[MountPointMap]'}, - } - - def __init__( - self, - **kwargs - ): - super(KubernetesRoleStorage, self).__init__(**kwargs) - self.storage_classes = None - self.endpoints = kwargs.get('endpoints', None) - - -class KubernetesRoleStorageClassInfo(msrest.serialization.Model): - """Kubernetes storage class info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Storage class name. - :vartype name: str - :ivar type: Storage class type. - :vartype type: str - :ivar posix_compliant: If provisioned storage is posix compliant. Possible values include: - "Invalid", "Enabled", "Disabled". - :vartype posix_compliant: str or - ~azure.mgmt.databoxedge.v2020_12_01.models.PosixComplianceStatus - """ - - _validation = { - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'posix_compliant': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'posix_compliant': {'key': 'posixCompliant', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KubernetesRoleStorageClassInfo, self).__init__(**kwargs) - self.name = None - self.type = None - self.posix_compliant = None - - -class LoadBalancerConfig(msrest.serialization.Model): - """Load balancer configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: Load balancer type. - :vartype type: str - :ivar version: Load balancer version. - :vartype version: str - """ - - _validation = { - 'type': {'readonly': True}, - 'version': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LoadBalancerConfig, self).__init__(**kwargs) - self.type = None - self.version = None - - -class MECRole(Role): - """MEC role. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", - "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleTypes - :ivar system_data: Role configured on ASE resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - :param connection_string: Activation key of the MEC. - :type connection_string: ~azure.mgmt.databoxedge.v2020_12_01.models.AsymmetricEncryptedSecret - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'connection_string': {'key': 'properties.connectionString', 'type': 'AsymmetricEncryptedSecret'}, - 'role_status': {'key': 'properties.roleStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MECRole, self).__init__(**kwargs) - self.kind = 'MEC' # type: str - self.connection_string = kwargs.get('connection_string', None) - self.role_status = kwargs.get('role_status', None) - - -class MetricConfiguration(msrest.serialization.Model): - """Metric configuration. - - All required parameters must be populated in order to send to Azure. - - :param resource_id: Required. The Resource ID on which the metrics should be pushed. - :type resource_id: str - :param mdm_account: The MDM account to which the counters should be pushed. - :type mdm_account: str - :param metric_name_space: The MDM namespace to which the counters should be pushed. This is - required if MDMAccount is specified. - :type metric_name_space: str - :param counter_sets: Required. Host name for the IoT hub associated to the device. - :type counter_sets: list[~azure.mgmt.databoxedge.v2020_12_01.models.MetricCounterSet] - """ - - _validation = { - 'resource_id': {'required': True}, - 'counter_sets': {'required': True}, - } - - _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'mdm_account': {'key': 'mdmAccount', 'type': 'str'}, - 'metric_name_space': {'key': 'metricNameSpace', 'type': 'str'}, - 'counter_sets': {'key': 'counterSets', 'type': '[MetricCounterSet]'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricConfiguration, self).__init__(**kwargs) - self.resource_id = kwargs['resource_id'] - self.mdm_account = kwargs.get('mdm_account', None) - self.metric_name_space = kwargs.get('metric_name_space', None) - self.counter_sets = kwargs['counter_sets'] - - -class MetricCounter(msrest.serialization.Model): - """The metric counter. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The counter name. - :type name: str - :param instance: The instance from which counter should be collected. - :type instance: str - :param dimension_filter: The dimension filter. - :type dimension_filter: list[~azure.mgmt.databoxedge.v2020_12_01.models.MetricDimension] - :param additional_dimensions: The additional dimensions to be added to metric. - :type additional_dimensions: list[~azure.mgmt.databoxedge.v2020_12_01.models.MetricDimension] - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'instance': {'key': 'instance', 'type': 'str'}, - 'dimension_filter': {'key': 'dimensionFilter', 'type': '[MetricDimension]'}, - 'additional_dimensions': {'key': 'additionalDimensions', 'type': '[MetricDimension]'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricCounter, self).__init__(**kwargs) - self.name = kwargs['name'] - self.instance = kwargs.get('instance', None) - self.dimension_filter = kwargs.get('dimension_filter', None) - self.additional_dimensions = kwargs.get('additional_dimensions', None) - - -class MetricCounterSet(msrest.serialization.Model): - """The metric counter set. - - All required parameters must be populated in order to send to Azure. - - :param counters: Required. The counters that should be collected in this set. - :type counters: list[~azure.mgmt.databoxedge.v2020_12_01.models.MetricCounter] - """ - - _validation = { - 'counters': {'required': True}, - } - - _attribute_map = { - 'counters': {'key': 'counters', 'type': '[MetricCounter]'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricCounterSet, self).__init__(**kwargs) - self.counters = kwargs['counters'] - - -class MetricDimension(msrest.serialization.Model): - """The metric dimension. - - All required parameters must be populated in order to send to Azure. - - :param source_type: Required. The dimension type. - :type source_type: str - :param source_name: Required. The dimension value. - :type source_name: str - """ - - _validation = { - 'source_type': {'required': True}, - 'source_name': {'required': True}, - } - - _attribute_map = { - 'source_type': {'key': 'sourceType', 'type': 'str'}, - 'source_name': {'key': 'sourceName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricDimension, self).__init__(**kwargs) - self.source_type = kwargs['source_type'] - self.source_name = kwargs['source_name'] - - -class MetricDimensionV1(msrest.serialization.Model): - """Metric Dimension v1. - - :param name: Name of the metrics dimension. - :type name: str - :param display_name: Display name of the metrics dimension. - :type display_name: str - :param to_be_exported_for_shoebox: To be exported to shoe box. - :type to_be_exported_for_shoebox: bool - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricDimensionV1, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) - - -class MetricSpecificationV1(msrest.serialization.Model): - """Metric specification version 1. - - :param name: Name of the metric. - :type name: str - :param display_name: Display name of the metric. - :type display_name: str - :param display_description: Description of the metric to be displayed. - :type display_description: str - :param unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", - "Seconds", "Milliseconds", "Bytes", "BytesPerSecond", "CountPerSecond". - :type unit: str or ~azure.mgmt.databoxedge.v2020_12_01.models.MetricUnit - :param aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", - "None", "Average", "Minimum", "Maximum", "Total", "Count". - :type aggregation_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.MetricAggregationType - :param dimensions: Metric dimensions, other than default dimension which is resource. - :type dimensions: list[~azure.mgmt.databoxedge.v2020_12_01.models.MetricDimensionV1] - :param fill_gap_with_zero: Set true to fill the gaps with zero. - :type fill_gap_with_zero: bool - :param category: Metric category. Possible values include: "Capacity", "Transaction". - :type category: str or ~azure.mgmt.databoxedge.v2020_12_01.models.MetricCategory - :param resource_id_dimension_name_override: Resource name override. - :type resource_id_dimension_name_override: str - :param supported_time_grain_types: Support granularity of metrics. - :type supported_time_grain_types: list[str or - ~azure.mgmt.databoxedge.v2020_12_01.models.TimeGrain] - :param supported_aggregation_types: Support metric aggregation type. - :type supported_aggregation_types: list[str or - ~azure.mgmt.databoxedge.v2020_12_01.models.MetricAggregationType] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[MetricDimensionV1]'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'category': {'key': 'category', 'type': 'str'}, - 'resource_id_dimension_name_override': {'key': 'resourceIdDimensionNameOverride', 'type': 'str'}, - 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, - 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricSpecificationV1, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.dimensions = kwargs.get('dimensions', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.category = kwargs.get('category', None) - self.resource_id_dimension_name_override = kwargs.get('resource_id_dimension_name_override', None) - self.supported_time_grain_types = kwargs.get('supported_time_grain_types', None) - self.supported_aggregation_types = kwargs.get('supported_aggregation_types', None) - - -class MonitoringMetricConfiguration(ARMBaseModel): - """The metric setting details for the role. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param metric_configurations: Required. The metrics configuration details. - :type metric_configurations: - list[~azure.mgmt.databoxedge.v2020_12_01.models.MetricConfiguration] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'metric_configurations': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'metric_configurations': {'key': 'properties.metricConfigurations', 'type': '[MetricConfiguration]'}, - } - - def __init__( - self, - **kwargs - ): - super(MonitoringMetricConfiguration, self).__init__(**kwargs) - self.metric_configurations = kwargs['metric_configurations'] - - -class MonitoringMetricConfigurationList(msrest.serialization.Model): - """Collection of metric configurations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of metric configurations. - :vartype value: list[~azure.mgmt.databoxedge.v2020_12_01.models.MonitoringMetricConfiguration] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[MonitoringMetricConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MonitoringMetricConfigurationList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class MountPointMap(msrest.serialization.Model): - """The share mount point. - - 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 share_id: Required. ID of the share mounted to the role VM. - :type share_id: str - :ivar role_id: ID of the role to which share is mounted. - :vartype role_id: str - :ivar mount_point: Mount point for the share. - :vartype mount_point: str - :ivar mount_type: Mounting type. Possible values include: "Volume", "HostPath". - :vartype mount_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.MountType - :ivar role_type: Role type. Possible values include: "IOT", "ASA", "Functions", "Cognitive", - "MEC", "CloudEdgeManagement", "Kubernetes". - :vartype role_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleTypes - """ - - _validation = { - 'share_id': {'required': True}, - 'role_id': {'readonly': True}, - 'mount_point': {'readonly': True}, - 'mount_type': {'readonly': True}, - 'role_type': {'readonly': True}, - } - - _attribute_map = { - 'share_id': {'key': 'shareId', 'type': 'str'}, - 'role_id': {'key': 'roleId', 'type': 'str'}, - 'mount_point': {'key': 'mountPoint', 'type': 'str'}, - 'mount_type': {'key': 'mountType', 'type': 'str'}, - 'role_type': {'key': 'roleType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MountPointMap, self).__init__(**kwargs) - self.share_id = kwargs['share_id'] - self.role_id = None - self.mount_point = None - self.mount_type = None - self.role_type = None - - -class NetworkAdapter(msrest.serialization.Model): - """Represents the networkAdapter on a device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar adapter_id: Instance ID of network adapter. - :vartype adapter_id: str - :ivar adapter_position: Hardware position of network adapter. - :vartype adapter_position: ~azure.mgmt.databoxedge.v2020_12_01.models.NetworkAdapterPosition - :ivar index: Logical index of the adapter. - :vartype index: int - :ivar node_id: Node ID of the network adapter. - :vartype node_id: str - :ivar network_adapter_name: Network adapter name. - :vartype network_adapter_name: str - :ivar label: Hardware label for the adapter. - :vartype label: str - :ivar mac_address: MAC address. - :vartype mac_address: str - :ivar link_speed: Link speed. - :vartype link_speed: long - :ivar status: Value indicating whether this adapter is valid. Possible values include: - "Inactive", "Active". - :vartype status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.NetworkAdapterStatus - :param rdma_status: Value indicating whether this adapter is RDMA capable. Possible values - include: "Incapable", "Capable". - :type rdma_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.NetworkAdapterRDMAStatus - :param dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values - include: "Disabled", "Enabled". - :type dhcp_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.NetworkAdapterDHCPStatus - :ivar ipv4_configuration: The IPv4 configuration of the network adapter. - :vartype ipv4_configuration: ~azure.mgmt.databoxedge.v2020_12_01.models.Ipv4Config - :ivar ipv6_configuration: The IPv6 configuration of the network adapter. - :vartype ipv6_configuration: ~azure.mgmt.databoxedge.v2020_12_01.models.Ipv6Config - :ivar ipv6_link_local_address: The IPv6 local address. - :vartype ipv6_link_local_address: str - :ivar dns_servers: The list of DNS Servers of the device. - :vartype dns_servers: list[str] - """ - - _validation = { - 'adapter_id': {'readonly': True}, - 'adapter_position': {'readonly': True}, - 'index': {'readonly': True}, - 'node_id': {'readonly': True}, - 'network_adapter_name': {'readonly': True}, - 'label': {'readonly': True}, - 'mac_address': {'readonly': True}, - 'link_speed': {'readonly': True}, - 'status': {'readonly': True}, - 'ipv4_configuration': {'readonly': True}, - 'ipv6_configuration': {'readonly': True}, - 'ipv6_link_local_address': {'readonly': True}, - 'dns_servers': {'readonly': True}, - } - - _attribute_map = { - 'adapter_id': {'key': 'adapterId', 'type': 'str'}, - 'adapter_position': {'key': 'adapterPosition', 'type': 'NetworkAdapterPosition'}, - 'index': {'key': 'index', 'type': 'int'}, - 'node_id': {'key': 'nodeId', 'type': 'str'}, - 'network_adapter_name': {'key': 'networkAdapterName', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'mac_address': {'key': 'macAddress', 'type': 'str'}, - 'link_speed': {'key': 'linkSpeed', 'type': 'long'}, - 'status': {'key': 'status', 'type': 'str'}, - 'rdma_status': {'key': 'rdmaStatus', 'type': 'str'}, - 'dhcp_status': {'key': 'dhcpStatus', 'type': 'str'}, - 'ipv4_configuration': {'key': 'ipv4Configuration', 'type': 'Ipv4Config'}, - 'ipv6_configuration': {'key': 'ipv6Configuration', 'type': 'Ipv6Config'}, - 'ipv6_link_local_address': {'key': 'ipv6LinkLocalAddress', 'type': 'str'}, - 'dns_servers': {'key': 'dnsServers', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkAdapter, self).__init__(**kwargs) - self.adapter_id = None - self.adapter_position = None - self.index = None - self.node_id = None - self.network_adapter_name = None - self.label = None - self.mac_address = None - self.link_speed = None - self.status = None - self.rdma_status = kwargs.get('rdma_status', None) - self.dhcp_status = kwargs.get('dhcp_status', None) - self.ipv4_configuration = None - self.ipv6_configuration = None - self.ipv6_link_local_address = None - self.dns_servers = None - - -class NetworkAdapterPosition(msrest.serialization.Model): - """The network adapter position. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar network_group: The network group. Possible values include: "None", "NonRDMA", "RDMA". - :vartype network_group: str or ~azure.mgmt.databoxedge.v2020_12_01.models.NetworkGroup - :ivar port: The port. - :vartype port: int - """ - - _validation = { - 'network_group': {'readonly': True}, - 'port': {'readonly': True}, - } - - _attribute_map = { - 'network_group': {'key': 'networkGroup', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkAdapterPosition, self).__init__(**kwargs) - self.network_group = None - self.port = None - - -class NetworkSettings(ARMBaseModel): - """The network settings of a device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar network_adapters: The network adapter list on the device. - :vartype network_adapters: list[~azure.mgmt.databoxedge.v2020_12_01.models.NetworkAdapter] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'network_adapters': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'network_adapters': {'key': 'properties.networkAdapters', 'type': '[NetworkAdapter]'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkSettings, self).__init__(**kwargs) - self.network_adapters = None - - -class Node(ARMBaseModel): - """Represents a single node in a Data box Edge/Gateway device -Gateway devices, standalone Edge devices and a single node cluster Edge device will all have 1 node -Multi-node Edge devices will have more than 1 nodes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar node_status: The current status of the individual node. Possible values include: - "Unknown", "Up", "Down", "Rebooting", "ShuttingDown". - :vartype node_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.NodeStatus - :ivar node_chassis_serial_number: Serial number of the Chassis. - :vartype node_chassis_serial_number: str - :ivar node_serial_number: Serial number of the individual node. - :vartype node_serial_number: str - :ivar node_display_name: Display Name of the individual node. - :vartype node_display_name: str - :ivar node_friendly_software_version: Friendly software version name that is currently - installed on the node. - :vartype node_friendly_software_version: str - :ivar node_hcs_version: HCS version that is currently installed on the node. - :vartype node_hcs_version: str - :ivar node_instance_id: Guid instance id of the node. - :vartype node_instance_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'node_status': {'readonly': True}, - 'node_chassis_serial_number': {'readonly': True}, - 'node_serial_number': {'readonly': True}, - 'node_display_name': {'readonly': True}, - 'node_friendly_software_version': {'readonly': True}, - 'node_hcs_version': {'readonly': True}, - 'node_instance_id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'node_status': {'key': 'properties.nodeStatus', 'type': 'str'}, - 'node_chassis_serial_number': {'key': 'properties.nodeChassisSerialNumber', 'type': 'str'}, - 'node_serial_number': {'key': 'properties.nodeSerialNumber', 'type': 'str'}, - 'node_display_name': {'key': 'properties.nodeDisplayName', 'type': 'str'}, - 'node_friendly_software_version': {'key': 'properties.nodeFriendlySoftwareVersion', 'type': 'str'}, - 'node_hcs_version': {'key': 'properties.nodeHcsVersion', 'type': 'str'}, - 'node_instance_id': {'key': 'properties.nodeInstanceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Node, self).__init__(**kwargs) - self.node_status = None - self.node_chassis_serial_number = None - self.node_serial_number = None - self.node_display_name = None - self.node_friendly_software_version = None - self.node_hcs_version = None - self.node_instance_id = None - - -class NodeInfo(msrest.serialization.Model): - """Kubernetes node info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Node name. - :vartype name: str - :ivar type: Node type - Master/Worker. Possible values include: "Invalid", "Master", "Worker". - :vartype type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.KubernetesNodeType - :param ip_configuration: IP Configuration of the Kubernetes node. - :type ip_configuration: - list[~azure.mgmt.databoxedge.v2020_12_01.models.KubernetesIPConfiguration] - """ - - _validation = { - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'ip_configuration': {'key': 'ipConfiguration', 'type': '[KubernetesIPConfiguration]'}, - } - - def __init__( - self, - **kwargs - ): - super(NodeInfo, self).__init__(**kwargs) - self.name = None - self.type = None - self.ip_configuration = kwargs.get('ip_configuration', None) - - -class NodeList(msrest.serialization.Model): - """Collection of Nodes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of Nodes. - :vartype value: list[~azure.mgmt.databoxedge.v2020_12_01.models.Node] - :param next_link: Link to the next set of results. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Node]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NodeList, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class Operation(msrest.serialization.Model): - """Operations. - - :param name: Name of the operation. - :type name: str - :param is_data_action: Is data action. - :type is_data_action: bool - :param display: Properties displayed for the operation. - :type display: ~azure.mgmt.databoxedge.v2020_12_01.models.OperationDisplay - :param origin: Origin of the operation. - :type origin: str - :param service_specification: Service specification. - :type service_specification: ~azure.mgmt.databoxedge.v2020_12_01.models.ServiceSpecification - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.is_data_action = kwargs.get('is_data_action', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplay(msrest.serialization.Model): - """Operation display properties. - - :param provider: Provider name. - :type provider: str - :param resource: The type of resource in which the operation is performed. - :type resource: str - :param operation: Operation to be performed on the resource. - :type operation: str - :param description: Description of the operation to be performed. - :type description: str - """ - - _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 - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationsList(msrest.serialization.Model): - """The list of operations used for the discovery of available provider operations. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The value. - :type value: list[~azure.mgmt.databoxedge.v2020_12_01.models.Operation] - :param next_link: Link to the next set of results. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationsList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class Order(ARMBaseModel): - """The order details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param contact_information: The contact details. - :type contact_information: ~azure.mgmt.databoxedge.v2020_12_01.models.ContactDetails - :param shipping_address: The shipping address. - :type shipping_address: ~azure.mgmt.databoxedge.v2020_12_01.models.Address - :ivar current_status: Current status of the order. - :vartype current_status: ~azure.mgmt.databoxedge.v2020_12_01.models.OrderStatus - :ivar order_history: List of status changes in the order. - :vartype order_history: list[~azure.mgmt.databoxedge.v2020_12_01.models.OrderStatus] - :ivar serial_number: Serial number of the device. - :vartype serial_number: str - :ivar delivery_tracking_info: Tracking information for the package delivered to the customer - whether it has an original or a replacement device. - :vartype delivery_tracking_info: list[~azure.mgmt.databoxedge.v2020_12_01.models.TrackingInfo] - :ivar return_tracking_info: Tracking information for the package returned from the customer - whether it has an original or a replacement device. - :vartype return_tracking_info: list[~azure.mgmt.databoxedge.v2020_12_01.models.TrackingInfo] - :param shipment_type: ShipmentType of the order. Possible values include: "NotApplicable", - "ShippedToCustomer", "SelfPickup". - :type shipment_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.ShipmentType - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'current_status': {'readonly': True}, - 'order_history': {'readonly': True}, - 'serial_number': {'readonly': True}, - 'delivery_tracking_info': {'readonly': True}, - 'return_tracking_info': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'contact_information': {'key': 'properties.contactInformation', 'type': 'ContactDetails'}, - 'shipping_address': {'key': 'properties.shippingAddress', 'type': 'Address'}, - 'current_status': {'key': 'properties.currentStatus', 'type': 'OrderStatus'}, - 'order_history': {'key': 'properties.orderHistory', 'type': '[OrderStatus]'}, - 'serial_number': {'key': 'properties.serialNumber', 'type': 'str'}, - 'delivery_tracking_info': {'key': 'properties.deliveryTrackingInfo', 'type': '[TrackingInfo]'}, - 'return_tracking_info': {'key': 'properties.returnTrackingInfo', 'type': '[TrackingInfo]'}, - 'shipment_type': {'key': 'properties.shipmentType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Order, self).__init__(**kwargs) - self.contact_information = kwargs.get('contact_information', None) - self.shipping_address = kwargs.get('shipping_address', None) - self.current_status = None - self.order_history = None - self.serial_number = None - self.delivery_tracking_info = None - self.return_tracking_info = None - self.shipment_type = kwargs.get('shipment_type', None) - - -class OrderList(msrest.serialization.Model): - """List of order entities. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of orders. - :vartype value: list[~azure.mgmt.databoxedge.v2020_12_01.models.Order] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Order]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OrderList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class OrderStatus(msrest.serialization.Model): - """Represents a single status change. - - 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 status: Required. Status of the order as per the allowed status types. Possible values - include: "Untracked", "AwaitingFulfilment", "AwaitingPreparation", "AwaitingShipment", - "Shipped", "Arriving", "Delivered", "ReplacementRequested", "LostDevice", "Declined", - "ReturnInitiated", "AwaitingReturnShipment", "ShippedBack", "CollectedAtMicrosoft", - "AwaitingPickup", "PickupCompleted", "AwaitingDrop". - :type status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.OrderState - :ivar update_date_time: Time of status update. - :vartype update_date_time: ~datetime.datetime - :param comments: Comments related to this status change. - :type comments: str - :ivar tracking_information: Tracking information related to the state in the ordering flow. - :vartype tracking_information: ~azure.mgmt.databoxedge.v2020_12_01.models.TrackingInfo - :ivar additional_order_details: Dictionary to hold generic information which is not stored - by the already existing properties. - :vartype additional_order_details: dict[str, str] - """ - - _validation = { - 'status': {'required': True}, - 'update_date_time': {'readonly': True}, - 'tracking_information': {'readonly': True}, - 'additional_order_details': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'update_date_time': {'key': 'updateDateTime', 'type': 'iso-8601'}, - 'comments': {'key': 'comments', 'type': 'str'}, - 'tracking_information': {'key': 'trackingInformation', 'type': 'TrackingInfo'}, - 'additional_order_details': {'key': 'additionalOrderDetails', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(OrderStatus, self).__init__(**kwargs) - self.status = kwargs['status'] - self.update_date_time = None - self.comments = kwargs.get('comments', None) - self.tracking_information = None - self.additional_order_details = None - - -class PeriodicTimerEventTrigger(Trigger): - """Trigger details. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar system_data: Trigger in DataBoxEdge Resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: - "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.TriggerEventType - :param source_info: Required. Periodic timer details. - :type source_info: ~azure.mgmt.databoxedge.v2020_12_01.models.PeriodicTimerSourceInfo - :param sink_info: Required. Role Sink information. - :type sink_info: ~azure.mgmt.databoxedge.v2020_12_01.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against - its usage. For example, if a periodic timer trigger is intended for certain specific IoT - modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'kind': {'required': True}, - 'source_info': {'required': True}, - 'sink_info': {'required': True}, - 'custom_context_tag': {'max_length': 192, 'min_length': 0}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'source_info': {'key': 'properties.sourceInfo', 'type': 'PeriodicTimerSourceInfo'}, - 'sink_info': {'key': 'properties.sinkInfo', 'type': 'RoleSinkInfo'}, - 'custom_context_tag': {'key': 'properties.customContextTag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PeriodicTimerEventTrigger, self).__init__(**kwargs) - self.kind = 'PeriodicTimerEvent' # type: str - self.source_info = kwargs['source_info'] - self.sink_info = kwargs['sink_info'] - self.custom_context_tag = kwargs.get('custom_context_tag', None) - - -class PeriodicTimerSourceInfo(msrest.serialization.Model): - """Periodic timer event source. - - All required parameters must be populated in order to send to Azure. - - :param start_time: Required. The time of the day that results in a valid trigger. Schedule is - computed with reference to the time specified upto seconds. If timezone is not specified the - time will considered to be in device timezone. The value will always be returned as UTC time. - :type start_time: ~datetime.datetime - :param schedule: Required. Periodic frequency at which timer event needs to be raised. Supports - daily, hourly, minutes, and seconds. - :type schedule: str - :param topic: Topic where periodic events are published to IoT device. - :type topic: str - """ - - _validation = { - 'start_time': {'required': True}, - 'schedule': {'required': True}, - } - - _attribute_map = { - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'schedule': {'key': 'schedule', 'type': 'str'}, - 'topic': {'key': 'topic', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PeriodicTimerSourceInfo, self).__init__(**kwargs) - self.start_time = kwargs['start_time'] - self.schedule = kwargs['schedule'] - self.topic = kwargs.get('topic', None) - - -class RefreshDetails(msrest.serialization.Model): - """Fields for tracking refresh job on the share or container. - - :param in_progress_refresh_job_id: If a refresh job is currently in progress on this share or - container, this field indicates the ARM resource ID of that job. The field is empty if no job - is in progress. - :type in_progress_refresh_job_id: str - :param last_completed_refresh_job_time_in_utc: Indicates the completed time for the last - refresh job on this particular share or container, if any.This could be a failed job or a - successful job. - :type last_completed_refresh_job_time_in_utc: ~datetime.datetime - :param error_manifest_file: Indicates the relative path of the error xml for the last refresh - job on this particular share or container, if any. This could be a failed job or a successful - job. - :type error_manifest_file: str - :param last_job: Indicates the id of the last refresh job on this particular share or - container,if any. This could be a failed job or a successful job. - :type last_job: str - """ - - _attribute_map = { - 'in_progress_refresh_job_id': {'key': 'inProgressRefreshJobId', 'type': 'str'}, - 'last_completed_refresh_job_time_in_utc': {'key': 'lastCompletedRefreshJobTimeInUTC', 'type': 'iso-8601'}, - 'error_manifest_file': {'key': 'errorManifestFile', 'type': 'str'}, - 'last_job': {'key': 'lastJob', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RefreshDetails, self).__init__(**kwargs) - self.in_progress_refresh_job_id = kwargs.get('in_progress_refresh_job_id', None) - self.last_completed_refresh_job_time_in_utc = kwargs.get('last_completed_refresh_job_time_in_utc', None) - self.error_manifest_file = kwargs.get('error_manifest_file', None) - self.last_job = kwargs.get('last_job', None) - - -class ResourceIdentity(msrest.serialization.Model): - """Msi identity details of the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param type: Identity type. Possible values include: "None", "SystemAssigned", "UserAssigned". - :type type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.MsiIdentityType - :ivar principal_id: Service Principal Id backing the Msi. - :vartype principal_id: str - :ivar tenant_id: Home Tenant Id. - :vartype tenant_id: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceIdentity, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.principal_id = None - self.tenant_id = None - - -class ResourceMoveDetails(msrest.serialization.Model): - """Fields for tracking resource move. - - :param operation_in_progress: Denotes whether move operation is in progress. Possible values - include: "None", "ResourceMoveInProgress", "ResourceMoveFailed". - :type operation_in_progress: str or - ~azure.mgmt.databoxedge.v2020_12_01.models.ResourceMoveStatus - :param operation_in_progress_lock_timeout_in_utc: Denotes the timeout of the operation to - finish. - :type operation_in_progress_lock_timeout_in_utc: ~datetime.datetime - """ - - _attribute_map = { - 'operation_in_progress': {'key': 'operationInProgress', 'type': 'str'}, - 'operation_in_progress_lock_timeout_in_utc': {'key': 'operationInProgressLockTimeoutInUTC', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceMoveDetails, self).__init__(**kwargs) - self.operation_in_progress = kwargs.get('operation_in_progress', None) - self.operation_in_progress_lock_timeout_in_utc = kwargs.get('operation_in_progress_lock_timeout_in_utc', None) - - -class ResourceTypeSku(msrest.serialization.Model): - """Resource type Sku object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar resource_type: The resource type. - :vartype resource_type: str - :ivar skus: The skus. - :vartype skus: list[~azure.mgmt.databoxedge.v2020_12_01.models.SkuInformation] - """ - - _validation = { - 'resource_type': {'readonly': True}, - 'skus': {'readonly': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'skus': {'key': 'skus', 'type': '[SkuInformation]'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceTypeSku, self).__init__(**kwargs) - self.resource_type = None - self.skus = None - - -class RoleList(msrest.serialization.Model): - """Collection of all the roles on the Data Box Edge device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The Value. - :vartype value: list[~azure.mgmt.databoxedge.v2020_12_01.models.Role] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Role]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RoleList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class RoleSinkInfo(msrest.serialization.Model): - """Compute role against which events will be raised. - - All required parameters must be populated in order to send to Azure. - - :param role_id: Required. Compute role ID. - :type role_id: str - """ - - _validation = { - 'role_id': {'required': True}, - } - - _attribute_map = { - 'role_id': {'key': 'roleId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RoleSinkInfo, self).__init__(**kwargs) - self.role_id = kwargs['role_id'] - - -class Secret(msrest.serialization.Model): - """Holds device secret either as a KeyVault reference or as an encrypted value. - - :param encrypted_secret: Encrypted (using device public key) secret value. - :type encrypted_secret: ~azure.mgmt.databoxedge.v2020_12_01.models.AsymmetricEncryptedSecret - :param key_vault_id: Id of the Key-Vault where secret is stored (ex: - secrets/AuthClientSecret/82ef4346187a4033a10d629cde07d740). - :type key_vault_id: str - """ - - _attribute_map = { - 'encrypted_secret': {'key': 'encryptedSecret', 'type': 'AsymmetricEncryptedSecret'}, - 'key_vault_id': {'key': 'keyVaultId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Secret, self).__init__(**kwargs) - self.encrypted_secret = kwargs.get('encrypted_secret', None) - self.key_vault_id = kwargs.get('key_vault_id', None) - - -class SecuritySettings(ARMBaseModel): - """The security settings of a device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param device_admin_password: Required. Device administrator password as an encrypted string - (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual - password should have at least 8 characters that are a combination of uppercase, lowercase, - numeric, and special characters. - :type device_admin_password: - ~azure.mgmt.databoxedge.v2020_12_01.models.AsymmetricEncryptedSecret - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'device_admin_password': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'device_admin_password': {'key': 'properties.deviceAdminPassword', 'type': 'AsymmetricEncryptedSecret'}, - } - - def __init__( - self, - **kwargs - ): - super(SecuritySettings, self).__init__(**kwargs) - self.device_admin_password = kwargs['device_admin_password'] - - -class ServiceSpecification(msrest.serialization.Model): - """Service specification. - - :param metric_specifications: Metric specification as defined by shoebox. - :type metric_specifications: - list[~azure.mgmt.databoxedge.v2020_12_01.models.MetricSpecificationV1] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecificationV1]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class Share(ARMBaseModel): - """Represents a share on the Data Box Edge/Gateway device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar system_data: Share on ASE device. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - :param description: Description for the share. - :type description: str - :param share_status: Required. Current status of the share. Possible values include: "Offline", - "Unknown", "OK", "Updating", "NeedsAttention". - :type share_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.ShareStatus - :param monitoring_status: Required. Current monitoring status of the share. Possible values - include: "Enabled", "Disabled". - :type monitoring_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.MonitoringStatus - :param azure_container_info: Azure container mapping for the share. - :type azure_container_info: ~azure.mgmt.databoxedge.v2020_12_01.models.AzureContainerInfo - :param access_protocol: Required. Access protocol to be used by the share. Possible values - include: "SMB", "NFS". - :type access_protocol: str or ~azure.mgmt.databoxedge.v2020_12_01.models.ShareAccessProtocol - :param user_access_rights: Mapping of users and corresponding access rights on the share - (required for SMB protocol). - :type user_access_rights: list[~azure.mgmt.databoxedge.v2020_12_01.models.UserAccessRight] - :param client_access_rights: List of IP addresses and corresponding access rights on the - share(required for NFS protocol). - :type client_access_rights: list[~azure.mgmt.databoxedge.v2020_12_01.models.ClientAccessRight] - :param refresh_details: Details of the refresh job on this share. - :type refresh_details: ~azure.mgmt.databoxedge.v2020_12_01.models.RefreshDetails - :ivar share_mappings: Share mount point to the role. - :vartype share_mappings: list[~azure.mgmt.databoxedge.v2020_12_01.models.MountPointMap] - :param data_policy: Data policy of the share. Possible values include: "Cloud", "Local". - :type data_policy: str or ~azure.mgmt.databoxedge.v2020_12_01.models.DataPolicy - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'share_status': {'required': True}, - 'monitoring_status': {'required': True}, - 'access_protocol': {'required': True}, - 'share_mappings': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'share_status': {'key': 'properties.shareStatus', 'type': 'str'}, - 'monitoring_status': {'key': 'properties.monitoringStatus', 'type': 'str'}, - 'azure_container_info': {'key': 'properties.azureContainerInfo', 'type': 'AzureContainerInfo'}, - 'access_protocol': {'key': 'properties.accessProtocol', 'type': 'str'}, - 'user_access_rights': {'key': 'properties.userAccessRights', 'type': '[UserAccessRight]'}, - 'client_access_rights': {'key': 'properties.clientAccessRights', 'type': '[ClientAccessRight]'}, - 'refresh_details': {'key': 'properties.refreshDetails', 'type': 'RefreshDetails'}, - 'share_mappings': {'key': 'properties.shareMappings', 'type': '[MountPointMap]'}, - 'data_policy': {'key': 'properties.dataPolicy', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Share, self).__init__(**kwargs) - self.system_data = None - self.description = kwargs.get('description', None) - self.share_status = kwargs['share_status'] - self.monitoring_status = kwargs['monitoring_status'] - self.azure_container_info = kwargs.get('azure_container_info', None) - self.access_protocol = kwargs['access_protocol'] - self.user_access_rights = kwargs.get('user_access_rights', None) - self.client_access_rights = kwargs.get('client_access_rights', None) - self.refresh_details = kwargs.get('refresh_details', None) - self.share_mappings = None - self.data_policy = kwargs.get('data_policy', None) - - -class ShareAccessRight(msrest.serialization.Model): - """Specifies the mapping between this particular user and the type of access he has on shares on this device. - - All required parameters must be populated in order to send to Azure. - - :param share_id: Required. The share ID. - :type share_id: str - :param access_type: Required. Type of access to be allowed on the share for this user. Possible - values include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.ShareAccessType - """ - - _validation = { - 'share_id': {'required': True}, - 'access_type': {'required': True}, - } - - _attribute_map = { - 'share_id': {'key': 'shareId', 'type': 'str'}, - 'access_type': {'key': 'accessType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ShareAccessRight, self).__init__(**kwargs) - self.share_id = kwargs['share_id'] - self.access_type = kwargs['access_type'] - - -class ShareList(msrest.serialization.Model): - """Collection of all the shares on the Data Box Edge/Gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of shares. - :vartype value: list[~azure.mgmt.databoxedge.v2020_12_01.models.Share] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Share]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ShareList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class Sku(msrest.serialization.Model): - """The SKU type. - - :param name: SKU name. Possible values include: "Gateway", "Edge", "TEA_1Node", - "TEA_1Node_UPS", "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", - "TEA_4Node_UPS_Heater", "TMA", "TDC", "TCA_Small", "GPU", "TCA_Large", "EdgeP_Base", - "EdgeP_High", "EdgePR_Base", "EdgePR_Base_UPS", "EdgeMR_Mini", "RCA_Small", "RCA_Large", "RDC". - :type name: str or ~azure.mgmt.databoxedge.v2020_12_01.models.SkuName - :param tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard". - :type tier: str or ~azure.mgmt.databoxedge.v2020_12_01.models.SkuTier - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = kwargs.get('tier', None) - - -class SkuCapability(msrest.serialization.Model): - """The metadata to describe the capability. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: An invariant to describe the feature. - :vartype name: str - :ivar value: An invariant if the feature is measured by quantity. - :vartype value: str - """ - - _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuCapability, self).__init__(**kwargs) - self.name = None - self.value = None - - -class SkuCost(msrest.serialization.Model): - """The metadata for retrieving price info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar meter_id: Used for querying price from commerce. - :vartype meter_id: str - :ivar quantity: The cost quantity. - :vartype quantity: long - :ivar extended_unit: The extended unit. - :vartype extended_unit: str - """ - - _validation = { - 'meter_id': {'readonly': True}, - 'quantity': {'readonly': True}, - 'extended_unit': {'readonly': True}, - } - - _attribute_map = { - 'meter_id': {'key': 'meterId', 'type': 'str'}, - 'quantity': {'key': 'quantity', 'type': 'long'}, - 'extended_unit': {'key': 'extendedUnit', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuCost, self).__init__(**kwargs) - self.meter_id = None - self.quantity = None - self.extended_unit = None - - -class SkuInformation(msrest.serialization.Model): - """Sku information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The sku name. - :vartype name: str - :ivar tier: The sku tier. - :vartype tier: str - :ivar kind: The sku kind. - :vartype kind: str - :ivar family: The Sku family. - :vartype family: str - :ivar costs: The pricing info of the Sku. - :vartype costs: list[~azure.mgmt.databoxedge.v2020_12_01.models.SkuCost] - :ivar locations: The locations where Sku is available. - :vartype locations: list[str] - :ivar location_info: The locations where Sku is available with zones and sites info. - :vartype location_info: list[~azure.mgmt.databoxedge.v2020_12_01.models.SkuLocationInfo] - :ivar required_quota_ids: The required quotaIds for the sku to be available. - :vartype required_quota_ids: list[str] - :ivar required_features: The required features for the sku to be available. - :vartype required_features: list[str] - """ - - _validation = { - 'name': {'readonly': True}, - 'tier': {'readonly': True}, - 'kind': {'readonly': True}, - 'family': {'readonly': True}, - 'costs': {'readonly': True}, - 'locations': {'readonly': True}, - 'location_info': {'readonly': True}, - 'required_quota_ids': {'readonly': True}, - 'required_features': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'family': {'key': 'family', 'type': 'str'}, - 'costs': {'key': 'costs', 'type': '[SkuCost]'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'location_info': {'key': 'locationInfo', 'type': '[SkuLocationInfo]'}, - 'required_quota_ids': {'key': 'requiredQuotaIds', 'type': '[str]'}, - 'required_features': {'key': 'requiredFeatures', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuInformation, self).__init__(**kwargs) - self.name = None - self.tier = None - self.kind = None - self.family = None - self.costs = None - self.locations = None - self.location_info = None - self.required_quota_ids = None - self.required_features = None - - -class SkuInformationList(msrest.serialization.Model): - """List of SKU Information objects. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of ResourceTypeSku objects. - :vartype value: list[~azure.mgmt.databoxedge.v2020_12_01.models.ResourceTypeSku] - :ivar next_link: Links to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceTypeSku]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuInformationList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SkuLocationInfo(msrest.serialization.Model): - """The location info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar location: The location. - :vartype location: str - :ivar zones: The zones. - :vartype zones: list[str] - :ivar sites: The sites. - :vartype sites: list[str] - """ - - _validation = { - 'location': {'readonly': True}, - 'zones': {'readonly': True}, - 'sites': {'readonly': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'sites': {'key': 'sites', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuLocationInfo, self).__init__(**kwargs) - self.location = None - self.zones = None - self.sites = None - - -class StorageAccount(ARMBaseModel): - """Represents a Storage Account on the Data Box Edge/Gateway device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar system_data: StorageAccount object on ASE device. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - :param description: Description for the storage Account. - :type description: str - :param storage_account_status: Current status of the storage account. Possible values include: - "OK", "Offline", "Unknown", "Updating", "NeedsAttention". - :type storage_account_status: str or - ~azure.mgmt.databoxedge.v2020_12_01.models.StorageAccountStatus - :param data_policy: Required. Data policy of the storage Account. Possible values include: - "Cloud", "Local". - :type data_policy: str or ~azure.mgmt.databoxedge.v2020_12_01.models.DataPolicy - :param storage_account_credential_id: Storage Account Credential Id. - :type storage_account_credential_id: str - :ivar blob_endpoint: BlobEndpoint of Storage Account. - :vartype blob_endpoint: str - :ivar container_count: The Container Count. Present only for Storage Accounts with DataPolicy - set to Cloud. - :vartype container_count: int - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'data_policy': {'required': True}, - 'blob_endpoint': {'readonly': True}, - 'container_count': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'storage_account_status': {'key': 'properties.storageAccountStatus', 'type': 'str'}, - 'data_policy': {'key': 'properties.dataPolicy', 'type': 'str'}, - 'storage_account_credential_id': {'key': 'properties.storageAccountCredentialId', 'type': 'str'}, - 'blob_endpoint': {'key': 'properties.blobEndpoint', 'type': 'str'}, - 'container_count': {'key': 'properties.containerCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccount, self).__init__(**kwargs) - self.system_data = None - self.description = kwargs.get('description', None) - self.storage_account_status = kwargs.get('storage_account_status', None) - self.data_policy = kwargs['data_policy'] - self.storage_account_credential_id = kwargs.get('storage_account_credential_id', None) - self.blob_endpoint = None - self.container_count = None - - -class StorageAccountCredential(ARMBaseModel): - """The storage account credential. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar system_data: StorageAccountCredential object. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - :param alias: Required. Alias for the storage account. - :type alias: str - :param user_name: Username for the storage account. - :type user_name: str - :param account_key: Encrypted storage key. - :type account_key: ~azure.mgmt.databoxedge.v2020_12_01.models.AsymmetricEncryptedSecret - :param connection_string: Connection string for the storage account. Use this string if - username and account key are not specified. - :type connection_string: str - :param ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible values - include: "Enabled", "Disabled". - :type ssl_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.SSLStatus - :param blob_domain_name: Blob end point for private clouds. - :type blob_domain_name: str - :param account_type: Required. Type of storage accessed on the storage account. Possible values - include: "GeneralPurposeStorage", "BlobStorage". - :type account_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.AccountType - :param storage_account_id: Id of the storage account. - :type storage_account_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'alias': {'required': True}, - 'ssl_status': {'required': True}, - 'account_type': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'alias': {'key': 'properties.alias', 'type': 'str'}, - 'user_name': {'key': 'properties.userName', 'type': 'str'}, - 'account_key': {'key': 'properties.accountKey', 'type': 'AsymmetricEncryptedSecret'}, - 'connection_string': {'key': 'properties.connectionString', 'type': 'str'}, - 'ssl_status': {'key': 'properties.sslStatus', 'type': 'str'}, - 'blob_domain_name': {'key': 'properties.blobDomainName', 'type': 'str'}, - 'account_type': {'key': 'properties.accountType', 'type': 'str'}, - 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCredential, self).__init__(**kwargs) - self.system_data = None - self.alias = kwargs['alias'] - self.user_name = kwargs.get('user_name', None) - self.account_key = kwargs.get('account_key', None) - self.connection_string = kwargs.get('connection_string', None) - self.ssl_status = kwargs['ssl_status'] - self.blob_domain_name = kwargs.get('blob_domain_name', None) - self.account_type = kwargs['account_type'] - self.storage_account_id = kwargs.get('storage_account_id', None) - - -class StorageAccountCredentialList(msrest.serialization.Model): - """The collection of storage account credentials. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The value. - :vartype value: list[~azure.mgmt.databoxedge.v2020_12_01.models.StorageAccountCredential] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccountCredential]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCredentialList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class StorageAccountList(msrest.serialization.Model): - """Collection of all the Storage Accounts on the Data Box Edge/Gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of storageAccounts. - :vartype value: list[~azure.mgmt.databoxedge.v2020_12_01.models.StorageAccount] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccount]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SubscriptionRegisteredFeatures(msrest.serialization.Model): - """SubscriptionRegisteredFeatures. - - :param name: - :type name: str - :param state: - :type state: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SubscriptionRegisteredFeatures, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.state = kwargs.get('state', None) - - -class SymmetricKey(msrest.serialization.Model): - """Symmetric key for authentication. - - :param connection_string: Connection string based on the symmetric key. - :type connection_string: ~azure.mgmt.databoxedge.v2020_12_01.models.AsymmetricEncryptedSecret - """ - - _attribute_map = { - 'connection_string': {'key': 'connectionString', 'type': 'AsymmetricEncryptedSecret'}, - } - - def __init__( - self, - **kwargs - ): - super(SymmetricKey, self).__init__(**kwargs) - self.connection_string = kwargs.get('connection_string', None) - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.CreatedByType - :param last_modified_at: The type of identity that last modified the resource. - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class TrackingInfo(msrest.serialization.Model): - """Tracking courier information. - - :param serial_number: Serial number of the device being tracked. - :type serial_number: str - :param carrier_name: Name of the carrier used in the delivery. - :type carrier_name: str - :param tracking_id: Tracking ID of the shipment. - :type tracking_id: str - :param tracking_url: Tracking URL of the shipment. - :type tracking_url: str - """ - - _attribute_map = { - 'serial_number': {'key': 'serialNumber', 'type': 'str'}, - 'carrier_name': {'key': 'carrierName', 'type': 'str'}, - 'tracking_id': {'key': 'trackingId', 'type': 'str'}, - 'tracking_url': {'key': 'trackingUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackingInfo, self).__init__(**kwargs) - self.serial_number = kwargs.get('serial_number', None) - self.carrier_name = kwargs.get('carrier_name', None) - self.tracking_id = kwargs.get('tracking_id', None) - self.tracking_url = kwargs.get('tracking_url', None) - - -class TriggerList(msrest.serialization.Model): - """Collection of all trigger on the data box edge device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of triggers. - :vartype value: list[~azure.mgmt.databoxedge.v2020_12_01.models.Trigger] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Trigger]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TriggerList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class UpdateDownloadProgress(msrest.serialization.Model): - """Details about the download progress of update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar download_phase: The download phase. Possible values include: "Unknown", "Initializing", - "Downloading", "Verifying". - :vartype download_phase: str or ~azure.mgmt.databoxedge.v2020_12_01.models.DownloadPhase - :ivar percent_complete: Percentage of completion. - :vartype percent_complete: int - :ivar total_bytes_to_download: Total bytes to download. - :vartype total_bytes_to_download: float - :ivar total_bytes_downloaded: Total bytes downloaded. - :vartype total_bytes_downloaded: float - :ivar number_of_updates_to_download: Number of updates to download. - :vartype number_of_updates_to_download: int - :ivar number_of_updates_downloaded: Number of updates downloaded. - :vartype number_of_updates_downloaded: int - """ - - _validation = { - 'download_phase': {'readonly': True}, - 'percent_complete': {'readonly': True}, - 'total_bytes_to_download': {'readonly': True}, - 'total_bytes_downloaded': {'readonly': True}, - 'number_of_updates_to_download': {'readonly': True}, - 'number_of_updates_downloaded': {'readonly': True}, - } - - _attribute_map = { - 'download_phase': {'key': 'downloadPhase', 'type': 'str'}, - 'percent_complete': {'key': 'percentComplete', 'type': 'int'}, - 'total_bytes_to_download': {'key': 'totalBytesToDownload', 'type': 'float'}, - 'total_bytes_downloaded': {'key': 'totalBytesDownloaded', 'type': 'float'}, - 'number_of_updates_to_download': {'key': 'numberOfUpdatesToDownload', 'type': 'int'}, - 'number_of_updates_downloaded': {'key': 'numberOfUpdatesDownloaded', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateDownloadProgress, self).__init__(**kwargs) - self.download_phase = None - self.percent_complete = None - self.total_bytes_to_download = None - self.total_bytes_downloaded = None - self.number_of_updates_to_download = None - self.number_of_updates_downloaded = None - - -class UpdateInstallProgress(msrest.serialization.Model): - """Progress details during installation of updates. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar percent_complete: Percentage completed. - :vartype percent_complete: int - :ivar number_of_updates_to_install: Number of updates to install. - :vartype number_of_updates_to_install: int - :ivar number_of_updates_installed: Number of updates installed. - :vartype number_of_updates_installed: int - """ - - _validation = { - 'percent_complete': {'readonly': True}, - 'number_of_updates_to_install': {'readonly': True}, - 'number_of_updates_installed': {'readonly': True}, - } - - _attribute_map = { - 'percent_complete': {'key': 'percentComplete', 'type': 'int'}, - 'number_of_updates_to_install': {'key': 'numberOfUpdatesToInstall', 'type': 'int'}, - 'number_of_updates_installed': {'key': 'numberOfUpdatesInstalled', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateInstallProgress, self).__init__(**kwargs) - self.percent_complete = None - self.number_of_updates_to_install = None - self.number_of_updates_installed = None - - -class UpdateSummary(ARMBaseModel): - """Details about ongoing updates and availability of updates on the device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param device_version_number: The current version of the device in format: 1.2.17312.13.",. - :type device_version_number: str - :param friendly_device_version_name: The current version of the device in text format. - :type friendly_device_version_name: str - :param device_last_scanned_date_time: The last time when a scan was done on the device. - :type device_last_scanned_date_time: ~datetime.datetime - :param last_completed_scan_job_date_time: The time when the last scan job was completed - (success/cancelled/failed) on the appliance. - :type last_completed_scan_job_date_time: ~datetime.datetime - :ivar last_completed_download_job_date_time: The time when the last Download job was completed - (success/cancelled/failed) on the appliance. - :vartype last_completed_download_job_date_time: ~datetime.datetime - :ivar last_completed_install_job_date_time: The time when the last Install job was completed - (success/cancelled/failed) on the appliance. - :vartype last_completed_install_job_date_time: ~datetime.datetime - :ivar total_number_of_updates_available: The number of updates available for the current device - version as per the last device scan. - :vartype total_number_of_updates_available: int - :ivar total_number_of_updates_pending_download: The total number of items pending download. - :vartype total_number_of_updates_pending_download: int - :ivar total_number_of_updates_pending_install: The total number of items pending install. - :vartype total_number_of_updates_pending_install: int - :ivar reboot_behavior: Indicates if updates are available and at least one of the updates needs - a reboot. Possible values include: "NeverReboots", "RequiresReboot", "RequestReboot". - :vartype reboot_behavior: str or - ~azure.mgmt.databoxedge.v2020_12_01.models.InstallRebootBehavior - :ivar ongoing_update_operation: The current update operation. Possible values include: "None", - "Scan", "Download", "Install". - :vartype ongoing_update_operation: str or - ~azure.mgmt.databoxedge.v2020_12_01.models.UpdateOperation - :ivar in_progress_download_job_id: The job ID of the download job in progress. - :vartype in_progress_download_job_id: str - :ivar in_progress_install_job_id: The job ID of the install job in progress. - :vartype in_progress_install_job_id: str - :ivar in_progress_download_job_started_date_time: The time when the currently running download - (if any) started. - :vartype in_progress_download_job_started_date_time: ~datetime.datetime - :ivar in_progress_install_job_started_date_time: The time when the currently running install - (if any) started. - :vartype in_progress_install_job_started_date_time: ~datetime.datetime - :ivar update_titles: The list of updates available for install. - :vartype update_titles: list[str] - :ivar total_update_size_in_bytes: The total size of updates available for download in bytes. - :vartype total_update_size_in_bytes: float - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'last_completed_download_job_date_time': {'readonly': True}, - 'last_completed_install_job_date_time': {'readonly': True}, - 'total_number_of_updates_available': {'readonly': True}, - 'total_number_of_updates_pending_download': {'readonly': True}, - 'total_number_of_updates_pending_install': {'readonly': True}, - 'reboot_behavior': {'readonly': True}, - 'ongoing_update_operation': {'readonly': True}, - 'in_progress_download_job_id': {'readonly': True}, - 'in_progress_install_job_id': {'readonly': True}, - 'in_progress_download_job_started_date_time': {'readonly': True}, - 'in_progress_install_job_started_date_time': {'readonly': True}, - 'update_titles': {'readonly': True}, - 'total_update_size_in_bytes': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'device_version_number': {'key': 'properties.deviceVersionNumber', 'type': 'str'}, - 'friendly_device_version_name': {'key': 'properties.friendlyDeviceVersionName', 'type': 'str'}, - 'device_last_scanned_date_time': {'key': 'properties.deviceLastScannedDateTime', 'type': 'iso-8601'}, - 'last_completed_scan_job_date_time': {'key': 'properties.lastCompletedScanJobDateTime', 'type': 'iso-8601'}, - 'last_completed_download_job_date_time': {'key': 'properties.lastCompletedDownloadJobDateTime', 'type': 'iso-8601'}, - 'last_completed_install_job_date_time': {'key': 'properties.lastCompletedInstallJobDateTime', 'type': 'iso-8601'}, - 'total_number_of_updates_available': {'key': 'properties.totalNumberOfUpdatesAvailable', 'type': 'int'}, - 'total_number_of_updates_pending_download': {'key': 'properties.totalNumberOfUpdatesPendingDownload', 'type': 'int'}, - 'total_number_of_updates_pending_install': {'key': 'properties.totalNumberOfUpdatesPendingInstall', 'type': 'int'}, - 'reboot_behavior': {'key': 'properties.rebootBehavior', 'type': 'str'}, - 'ongoing_update_operation': {'key': 'properties.ongoingUpdateOperation', 'type': 'str'}, - 'in_progress_download_job_id': {'key': 'properties.inProgressDownloadJobId', 'type': 'str'}, - 'in_progress_install_job_id': {'key': 'properties.inProgressInstallJobId', 'type': 'str'}, - 'in_progress_download_job_started_date_time': {'key': 'properties.inProgressDownloadJobStartedDateTime', 'type': 'iso-8601'}, - 'in_progress_install_job_started_date_time': {'key': 'properties.inProgressInstallJobStartedDateTime', 'type': 'iso-8601'}, - 'update_titles': {'key': 'properties.updateTitles', 'type': '[str]'}, - 'total_update_size_in_bytes': {'key': 'properties.totalUpdateSizeInBytes', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateSummary, self).__init__(**kwargs) - self.device_version_number = kwargs.get('device_version_number', None) - self.friendly_device_version_name = kwargs.get('friendly_device_version_name', None) - self.device_last_scanned_date_time = kwargs.get('device_last_scanned_date_time', None) - self.last_completed_scan_job_date_time = kwargs.get('last_completed_scan_job_date_time', None) - self.last_completed_download_job_date_time = None - self.last_completed_install_job_date_time = None - self.total_number_of_updates_available = None - self.total_number_of_updates_pending_download = None - self.total_number_of_updates_pending_install = None - self.reboot_behavior = None - self.ongoing_update_operation = None - self.in_progress_download_job_id = None - self.in_progress_install_job_id = None - self.in_progress_download_job_started_date_time = None - self.in_progress_install_job_started_date_time = None - self.update_titles = None - self.total_update_size_in_bytes = None - - -class UploadCertificateRequest(msrest.serialization.Model): - """The upload certificate request. - - All required parameters must be populated in order to send to Azure. - - :param authentication_type: The authentication type. Possible values include: "Invalid", - "AzureActiveDirectory". - :type authentication_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.AuthenticationType - :param certificate: Required. The base64 encoded certificate raw data. - :type certificate: str - """ - - _validation = { - 'certificate': {'required': True}, - } - - _attribute_map = { - 'authentication_type': {'key': 'properties.authenticationType', 'type': 'str'}, - 'certificate': {'key': 'properties.certificate', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UploadCertificateRequest, self).__init__(**kwargs) - self.authentication_type = kwargs.get('authentication_type', None) - self.certificate = kwargs['certificate'] - - -class UploadCertificateResponse(msrest.serialization.Model): - """The upload registration certificate response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param auth_type: Specifies authentication type. Possible values include: "Invalid", - "AzureActiveDirectory". - :type auth_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.AuthenticationType - :ivar resource_id: The resource ID of the Data Box Edge/Gateway device. - :vartype resource_id: str - :ivar aad_authority: Azure Active Directory tenant authority. - :vartype aad_authority: str - :ivar aad_tenant_id: Azure Active Directory tenant ID. - :vartype aad_tenant_id: str - :ivar service_principal_client_id: Azure Active Directory service principal client ID. - :vartype service_principal_client_id: str - :ivar service_principal_object_id: Azure Active Directory service principal object ID. - :vartype service_principal_object_id: str - :ivar azure_management_endpoint_audience: The azure management endpoint audience. - :vartype azure_management_endpoint_audience: str - :ivar aad_audience: Identifier of the target resource that is the recipient of the requested - token. - :vartype aad_audience: str - """ - - _validation = { - 'resource_id': {'readonly': True}, - 'aad_authority': {'readonly': True}, - 'aad_tenant_id': {'readonly': True}, - 'service_principal_client_id': {'readonly': True}, - 'service_principal_object_id': {'readonly': True}, - 'azure_management_endpoint_audience': {'readonly': True}, - 'aad_audience': {'readonly': True}, - } - - _attribute_map = { - 'auth_type': {'key': 'authType', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'aad_authority': {'key': 'aadAuthority', 'type': 'str'}, - 'aad_tenant_id': {'key': 'aadTenantId', 'type': 'str'}, - 'service_principal_client_id': {'key': 'servicePrincipalClientId', 'type': 'str'}, - 'service_principal_object_id': {'key': 'servicePrincipalObjectId', 'type': 'str'}, - 'azure_management_endpoint_audience': {'key': 'azureManagementEndpointAudience', 'type': 'str'}, - 'aad_audience': {'key': 'aadAudience', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UploadCertificateResponse, self).__init__(**kwargs) - self.auth_type = kwargs.get('auth_type', None) - self.resource_id = None - self.aad_authority = None - self.aad_tenant_id = None - self.service_principal_client_id = None - self.service_principal_object_id = None - self.azure_management_endpoint_audience = None - self.aad_audience = None - - -class User(ARMBaseModel): - """Represents a user who has access to one or more shares on the Data Box Edge/Gateway device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar system_data: User in DataBoxEdge Resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - :param encrypted_password: The password details. - :type encrypted_password: ~azure.mgmt.databoxedge.v2020_12_01.models.AsymmetricEncryptedSecret - :ivar share_access_rights: List of shares that the user has rights on. This field should not be - specified during user creation. - :vartype share_access_rights: list[~azure.mgmt.databoxedge.v2020_12_01.models.ShareAccessRight] - :param user_type: Required. Type of the user. Possible values include: "Share", - "LocalManagement", "ARM". - :type user_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.UserType - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'share_access_rights': {'readonly': True}, - 'user_type': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'encrypted_password': {'key': 'properties.encryptedPassword', 'type': 'AsymmetricEncryptedSecret'}, - 'share_access_rights': {'key': 'properties.shareAccessRights', 'type': '[ShareAccessRight]'}, - 'user_type': {'key': 'properties.userType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(User, self).__init__(**kwargs) - self.system_data = None - self.encrypted_password = kwargs.get('encrypted_password', None) - self.share_access_rights = None - self.user_type = kwargs['user_type'] - - -class UserAccessRight(msrest.serialization.Model): - """The mapping between a particular user and the access type on the SMB share. - - All required parameters must be populated in order to send to Azure. - - :param user_id: Required. User ID (already existing in the device). - :type user_id: str - :param access_type: Required. Type of access to be allowed for the user. Possible values - include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.ShareAccessType - """ - - _validation = { - 'user_id': {'required': True}, - 'access_type': {'required': True}, - } - - _attribute_map = { - 'user_id': {'key': 'userId', 'type': 'str'}, - 'access_type': {'key': 'accessType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserAccessRight, self).__init__(**kwargs) - self.user_id = kwargs['user_id'] - self.access_type = kwargs['access_type'] - - -class UserList(msrest.serialization.Model): - """Collection of users. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of users. - :vartype value: list[~azure.mgmt.databoxedge.v2020_12_01.models.User] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[User]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserList, self).__init__(**kwargs) - self.value = None - self.next_link = None diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/models/_models_py3.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/models/_models_py3.py index dd497b64f9f8..46775312ad1f 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/models/_models_py3.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/models/_models_py3.py @@ -43,6 +43,8 @@ def __init__( self, **kwargs ): + """ + """ super(ARMBaseModel, self).__init__(**kwargs) self.id = None self.name = None @@ -65,9 +67,9 @@ class Addon(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Addon type.Constant filled by server. Possible values include: - "IotEdge", "ArcForKubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.AddonType + :ivar kind: Required. Addon type.Constant filled by server. Possible values include: "IotEdge", + "ArcForKubernetes". + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.AddonType :ivar system_data: Addon type. :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData """ @@ -96,6 +98,8 @@ def __init__( self, **kwargs ): + """ + """ super(Addon, self).__init__(**kwargs) self.kind = 'Addon' # type: str self.system_data = None @@ -126,6 +130,8 @@ def __init__( self, **kwargs ): + """ + """ super(AddonList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -136,20 +142,20 @@ class Address(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param address_line1: The address line1. - :type address_line1: str - :param address_line2: The address line2. - :type address_line2: str - :param address_line3: The address line3. - :type address_line3: str - :param postal_code: The postal code. - :type postal_code: str - :param city: The city name. - :type city: str - :param state: The state name. - :type state: str - :param country: Required. The country name. - :type country: str + :ivar address_line1: The address line1. + :vartype address_line1: str + :ivar address_line2: The address line2. + :vartype address_line2: str + :ivar address_line3: The address line3. + :vartype address_line3: str + :ivar postal_code: The postal code. + :vartype postal_code: str + :ivar city: The city name. + :vartype city: str + :ivar state: The state name. + :vartype state: str + :ivar country: Required. The country name. + :vartype country: str """ _validation = { @@ -178,6 +184,22 @@ def __init__( state: Optional[str] = None, **kwargs ): + """ + :keyword address_line1: The address line1. + :paramtype address_line1: str + :keyword address_line2: The address line2. + :paramtype address_line2: str + :keyword address_line3: The address line3. + :paramtype address_line3: str + :keyword postal_code: The postal code. + :paramtype postal_code: str + :keyword city: The city name. + :paramtype city: str + :keyword state: The state name. + :paramtype state: str + :keyword country: Required. The country name. + :paramtype country: str + """ super(Address, self).__init__(**kwargs) self.address_line1 = address_line1 self.address_line2 = address_line2 @@ -250,6 +272,8 @@ def __init__( self, **kwargs ): + """ + """ super(Alert, self).__init__(**kwargs) self.system_data = None self.title = None @@ -290,6 +314,8 @@ def __init__( self, **kwargs ): + """ + """ super(AlertErrorDetails, self).__init__(**kwargs) self.error_code = None self.error_message = None @@ -321,6 +347,8 @@ def __init__( self, **kwargs ): + """ + """ super(AlertList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -339,19 +367,19 @@ class ArcAddon(Addon): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Addon type.Constant filled by server. Possible values include: - "IotEdge", "ArcForKubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.AddonType + :ivar kind: Required. Addon type.Constant filled by server. Possible values include: "IotEdge", + "ArcForKubernetes". + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.AddonType :ivar system_data: Addon type. :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - :param subscription_id: Required. Arc resource subscription Id. - :type subscription_id: str - :param resource_group_name: Required. Arc resource group name. - :type resource_group_name: str - :param resource_name: Required. Arc resource Name. - :type resource_name: str - :param resource_location: Required. Arc resource location. - :type resource_location: str + :ivar subscription_id: Required. Arc resource subscription Id. + :vartype subscription_id: str + :ivar resource_group_name: Required. Arc resource group name. + :vartype resource_group_name: str + :ivar resource_name: Required. Arc resource Name. + :vartype resource_name: str + :ivar resource_location: Required. Arc resource location. + :vartype resource_location: str :ivar version: Arc resource version. :vartype version: str :ivar host_platform: Host OS supported by the Arc addon. Possible values include: "Windows", @@ -406,6 +434,16 @@ def __init__( resource_location: str, **kwargs ): + """ + :keyword subscription_id: Required. Arc resource subscription Id. + :paramtype subscription_id: str + :keyword resource_group_name: Required. Arc resource group name. + :paramtype resource_group_name: str + :keyword resource_name: Required. Arc resource Name. + :paramtype resource_name: str + :keyword resource_location: Required. Arc resource location. + :paramtype resource_location: str + """ super(ArcAddon, self).__init__(**kwargs) self.kind = 'ArcForKubernetes' # type: str self.subscription_id = subscription_id @@ -423,14 +461,14 @@ class AsymmetricEncryptedSecret(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The value of the secret. - :type value: str - :param encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the + :ivar value: Required. The value of the secret. + :vartype value: str + :ivar encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the value is unencrypted, it will be null. - :type encryption_cert_thumbprint: str - :param encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values + :vartype encryption_cert_thumbprint: str + :ivar encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values include: "None", "AES256", "RSAES_PKCS1_v_1_5". - :type encryption_algorithm: str or + :vartype encryption_algorithm: str or ~azure.mgmt.databoxedge.v2020_12_01.models.EncryptionAlgorithm """ @@ -453,6 +491,17 @@ def __init__( encryption_cert_thumbprint: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The value of the secret. + :paramtype value: str + :keyword encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the + value is unencrypted, it will be null. + :paramtype encryption_cert_thumbprint: str + :keyword encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values + include: "None", "AES256", "RSAES_PKCS1_v_1_5". + :paramtype encryption_algorithm: str or + ~azure.mgmt.databoxedge.v2020_12_01.models.EncryptionAlgorithm + """ super(AsymmetricEncryptedSecret, self).__init__(**kwargs) self.value = value self.encryption_cert_thumbprint = encryption_cert_thumbprint @@ -462,8 +511,8 @@ def __init__( class Authentication(msrest.serialization.Model): """Authentication mechanism for IoT devices. - :param symmetric_key: Symmetric key for authentication. - :type symmetric_key: ~azure.mgmt.databoxedge.v2020_12_01.models.SymmetricKey + :ivar symmetric_key: Symmetric key for authentication. + :vartype symmetric_key: ~azure.mgmt.databoxedge.v2020_12_01.models.SymmetricKey """ _attribute_map = { @@ -476,6 +525,10 @@ def __init__( symmetric_key: Optional["SymmetricKey"] = None, **kwargs ): + """ + :keyword symmetric_key: Symmetric key for authentication. + :paramtype symmetric_key: ~azure.mgmt.databoxedge.v2020_12_01.models.SymmetricKey + """ super(Authentication, self).__init__(**kwargs) self.symmetric_key = symmetric_key @@ -485,15 +538,16 @@ class AzureContainerInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param storage_account_credential_id: Required. ID of the storage account credential used to + :ivar storage_account_credential_id: Required. ID of the storage account credential used to access storage. - :type storage_account_credential_id: str - :param container_name: Required. Container name (Based on the data format specified, this + :vartype storage_account_credential_id: str + :ivar container_name: Required. Container name (Based on the data format specified, this represents the name of Azure Files/Page blob/Block blob). - :type container_name: str - :param data_format: Required. Storage format used for the file represented by the share. + :vartype container_name: str + :ivar data_format: Required. Storage format used for the file represented by the share. Possible values include: "BlockBlob", "PageBlob", "AzureFile". - :type data_format: str or ~azure.mgmt.databoxedge.v2020_12_01.models.AzureContainerDataFormat + :vartype data_format: str or + ~azure.mgmt.databoxedge.v2020_12_01.models.AzureContainerDataFormat """ _validation = { @@ -516,6 +570,18 @@ def __init__( data_format: Union[str, "AzureContainerDataFormat"], **kwargs ): + """ + :keyword storage_account_credential_id: Required. ID of the storage account credential used to + access storage. + :paramtype storage_account_credential_id: str + :keyword container_name: Required. Container name (Based on the data format specified, this + represents the name of Azure Files/Page blob/Block blob). + :paramtype container_name: str + :keyword data_format: Required. Storage format used for the file represented by the share. + Possible values include: "BlockBlob", "PageBlob", "AzureFile". + :paramtype data_format: str or + ~azure.mgmt.databoxedge.v2020_12_01.models.AzureContainerDataFormat + """ super(AzureContainerInfo, self).__init__(**kwargs) self.storage_account_credential_id = storage_account_credential_id self.container_name = container_name @@ -537,14 +603,14 @@ class BandwidthSchedule(ARMBaseModel): :vartype type: str :ivar system_data: Bandwidth object related to ASE resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - :param start: Required. The start time of the schedule in UTC. - :type start: str - :param stop: Required. The stop time of the schedule in UTC. - :type stop: str - :param rate_in_mbps: Required. The bandwidth rate in Mbps. - :type rate_in_mbps: int - :param days: Required. The days of the week when this schedule is applicable. - :type days: list[str or ~azure.mgmt.databoxedge.v2020_12_01.models.DayOfWeek] + :ivar start: Required. The start time of the schedule in UTC. + :vartype start: str + :ivar stop: Required. The stop time of the schedule in UTC. + :vartype stop: str + :ivar rate_in_mbps: Required. The bandwidth rate in Mbps. + :vartype rate_in_mbps: int + :ivar days: Required. The days of the week when this schedule is applicable. + :vartype days: list[str or ~azure.mgmt.databoxedge.v2020_12_01.models.DayOfWeek] """ _validation = { @@ -578,6 +644,16 @@ def __init__( days: List[Union[str, "DayOfWeek"]], **kwargs ): + """ + :keyword start: Required. The start time of the schedule in UTC. + :paramtype start: str + :keyword stop: Required. The stop time of the schedule in UTC. + :paramtype stop: str + :keyword rate_in_mbps: Required. The bandwidth rate in Mbps. + :paramtype rate_in_mbps: int + :keyword days: Required. The days of the week when this schedule is applicable. + :paramtype days: list[str or ~azure.mgmt.databoxedge.v2020_12_01.models.DayOfWeek] + """ super(BandwidthSchedule, self).__init__(**kwargs) self.system_data = None self.start = start @@ -611,6 +687,8 @@ def __init__( self, **kwargs ): + """ + """ super(BandwidthSchedulesList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -621,11 +699,12 @@ class ClientAccessRight(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param client: Required. IP of the client. - :type client: str - :param access_permission: Required. Type of access to be allowed for the client. Possible - values include: "NoAccess", "ReadOnly", "ReadWrite". - :type access_permission: str or ~azure.mgmt.databoxedge.v2020_12_01.models.ClientPermissionType + :ivar client: Required. IP of the client. + :vartype client: str + :ivar access_permission: Required. Type of access to be allowed for the client. Possible values + include: "NoAccess", "ReadOnly", "ReadWrite". + :vartype access_permission: str or + ~azure.mgmt.databoxedge.v2020_12_01.models.ClientPermissionType """ _validation = { @@ -645,6 +724,14 @@ def __init__( access_permission: Union[str, "ClientPermissionType"], **kwargs ): + """ + :keyword client: Required. IP of the client. + :paramtype client: str + :keyword access_permission: Required. Type of access to be allowed for the client. Possible + values include: "NoAccess", "ReadOnly", "ReadWrite". + :paramtype access_permission: str or + ~azure.mgmt.databoxedge.v2020_12_01.models.ClientPermissionType + """ super(ClientAccessRight, self).__init__(**kwargs) self.client = client self.access_permission = access_permission @@ -666,9 +753,9 @@ class Role(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleTypes + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleTypes :ivar system_data: Role configured on ASE resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData """ @@ -697,6 +784,8 @@ def __init__( self, **kwargs ): + """ + """ super(Role, self).__init__(**kwargs) self.kind = 'Role' # type: str self.system_data = None @@ -715,9 +804,9 @@ class CloudEdgeManagementRole(Role): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleTypes + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleTypes :ivar system_data: Role configured on ASE resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData :ivar local_management_status: Local Edge Management Status. Possible values include: @@ -725,8 +814,8 @@ class CloudEdgeManagementRole(Role): :vartype local_management_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleStatus :ivar edge_profile: Edge Profile of the resource. :vartype edge_profile: ~azure.mgmt.databoxedge.v2020_12_01.models.EdgeProfile - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleStatus + :ivar role_status: Role status. Possible values include: "Enabled", "Disabled". + :vartype role_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleStatus """ _validation = { @@ -756,6 +845,10 @@ def __init__( role_status: Optional[Union[str, "RoleStatus"]] = None, **kwargs ): + """ + :keyword role_status: Role status. Possible values include: "Enabled", "Disabled". + :paramtype role_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleStatus + """ super(CloudEdgeManagementRole, self).__init__(**kwargs) self.kind = 'CloudEdgeManagement' # type: str self.local_management_status = None @@ -766,14 +859,14 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from the service. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.databoxedge.v2020_12_01.models.CloudErrorBody] + :vartype message: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.databoxedge.v2020_12_01.models.CloudErrorBody] """ _attribute_map = { @@ -790,6 +883,16 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.databoxedge.v2020_12_01.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -829,6 +932,8 @@ def __init__( self, **kwargs ): + """ + """ super(CniConfig, self).__init__(**kwargs) self.type = None self.version = None @@ -841,10 +946,10 @@ class ComputeResource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param processor_count: Required. Processor count. - :type processor_count: int - :param memory_in_gb: Required. Memory in GB. - :type memory_in_gb: long + :ivar processor_count: Required. Processor count. + :vartype processor_count: int + :ivar memory_in_gb: Required. Memory in GB. + :vartype memory_in_gb: long """ _validation = { @@ -864,6 +969,12 @@ def __init__( memory_in_gb: int, **kwargs ): + """ + :keyword processor_count: Required. Processor count. + :paramtype processor_count: int + :keyword memory_in_gb: Required. Memory in GB. + :paramtype memory_in_gb: long + """ super(ComputeResource, self).__init__(**kwargs) self.processor_count = processor_count self.memory_in_gb = memory_in_gb @@ -874,14 +985,14 @@ class ContactDetails(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param contact_person: Required. The contact person name. - :type contact_person: str - :param company_name: Required. The name of the company. - :type company_name: str - :param phone: Required. The phone number. - :type phone: str - :param email_list: Required. The email list. - :type email_list: list[str] + :ivar contact_person: Required. The contact person name. + :vartype contact_person: str + :ivar company_name: Required. The name of the company. + :vartype company_name: str + :ivar phone: Required. The phone number. + :vartype phone: str + :ivar email_list: Required. The email list. + :vartype email_list: list[str] """ _validation = { @@ -907,6 +1018,16 @@ def __init__( email_list: List[str], **kwargs ): + """ + :keyword contact_person: Required. The contact person name. + :paramtype contact_person: str + :keyword company_name: Required. The name of the company. + :paramtype company_name: str + :keyword phone: Required. The phone number. + :paramtype phone: str + :keyword email_list: Required. The email list. + :paramtype email_list: list[str] + """ super(ContactDetails, self).__init__(**kwargs) self.contact_person = contact_person self.company_name = company_name @@ -932,9 +1053,10 @@ class Container(ARMBaseModel): :ivar container_status: Current status of the container. Possible values include: "OK", "Offline", "Unknown", "Updating", "NeedsAttention". :vartype container_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.ContainerStatus - :param data_format: Required. DataFormat for Container. Possible values include: "BlockBlob", + :ivar data_format: Required. DataFormat for Container. Possible values include: "BlockBlob", "PageBlob", "AzureFile". - :type data_format: str or ~azure.mgmt.databoxedge.v2020_12_01.models.AzureContainerDataFormat + :vartype data_format: str or + ~azure.mgmt.databoxedge.v2020_12_01.models.AzureContainerDataFormat :ivar refresh_details: Details of the refresh job on this container. :vartype refresh_details: ~azure.mgmt.databoxedge.v2020_12_01.models.RefreshDetails :ivar created_date_time: The UTC time when container got created. @@ -969,6 +1091,12 @@ def __init__( data_format: Union[str, "AzureContainerDataFormat"], **kwargs ): + """ + :keyword data_format: Required. DataFormat for Container. Possible values include: "BlockBlob", + "PageBlob", "AzureFile". + :paramtype data_format: str or + ~azure.mgmt.databoxedge.v2020_12_01.models.AzureContainerDataFormat + """ super(Container, self).__init__(**kwargs) self.system_data = None self.container_status = None @@ -1002,6 +1130,8 @@ def __init__( self, **kwargs ): + """ + """ super(ContainerList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1020,29 +1150,29 @@ class DataBoxEdgeDevice(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param location: Required. The location of the device. This is a supported and registered Azure + :ivar location: Required. The location of the device. This is a supported and registered Azure geographical region (for example, West US, East US, or Southeast Asia). The geographical region of a device cannot be changed once it is created, but if an identical geographical region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. The list of tags that describe the device. These tags can be used - to view and group this device (across resource groups). - :type tags: dict[str, str] - :param sku: The SKU type. - :type sku: ~azure.mgmt.databoxedge.v2020_12_01.models.Sku - :param etag: The etag for the devices. - :type etag: str - :param identity: Msi identity of the resource. - :type identity: ~azure.mgmt.databoxedge.v2020_12_01.models.ResourceIdentity + :vartype location: str + :ivar tags: A set of tags. The list of tags that describe the device. These tags can be used to + view and group this device (across resource groups). + :vartype tags: dict[str, str] + :ivar sku: The SKU type. + :vartype sku: ~azure.mgmt.databoxedge.v2020_12_01.models.Sku + :ivar etag: The etag for the devices. + :vartype etag: str + :ivar identity: Msi identity of the resource. + :vartype identity: ~azure.mgmt.databoxedge.v2020_12_01.models.ResourceIdentity :ivar kind: The etag for the devices. Possible values include: "AzureDataBoxGateway", "AzureStackEdge", "AzureStackHub", "AzureModularDataCentre". :vartype kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.DataBoxEdgeDeviceKind :ivar system_data: DataBoxEdge Resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - :param data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible + :ivar data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible values include: "ReadyToSetup", "Online", "Offline", "NeedsAttention", "Disconnected", "PartiallyDisconnected", "Maintenance". - :type data_box_edge_device_status: str or + :vartype data_box_edge_device_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.DataBoxEdgeDeviceStatus :ivar serial_number: The Serial Number of Data Box Edge/Gateway device. :vartype serial_number: str @@ -1142,6 +1272,27 @@ def __init__( data_box_edge_device_status: Optional[Union[str, "DataBoxEdgeDeviceStatus"]] = None, **kwargs ): + """ + :keyword location: Required. The location of the device. This is a supported and registered + Azure geographical region (for example, West US, East US, or Southeast Asia). The geographical + region of a device cannot be changed once it is created, but if an identical geographical + region is specified on update, the request will succeed. + :paramtype location: str + :keyword tags: A set of tags. The list of tags that describe the device. These tags can be used + to view and group this device (across resource groups). + :paramtype tags: dict[str, str] + :keyword sku: The SKU type. + :paramtype sku: ~azure.mgmt.databoxedge.v2020_12_01.models.Sku + :keyword etag: The etag for the devices. + :paramtype etag: str + :keyword identity: Msi identity of the resource. + :paramtype identity: ~azure.mgmt.databoxedge.v2020_12_01.models.ResourceIdentity + :keyword data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible + values include: "ReadyToSetup", "Online", "Offline", "NeedsAttention", "Disconnected", + "PartiallyDisconnected", "Maintenance". + :paramtype data_box_edge_device_status: str or + ~azure.mgmt.databoxedge.v2020_12_01.models.DataBoxEdgeDeviceStatus + """ super(DataBoxEdgeDevice, self).__init__(**kwargs) self.location = location self.tags = tags @@ -1179,26 +1330,26 @@ class DataBoxEdgeDeviceExtendedInfo(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param encryption_key_thumbprint: The digital signature of encrypted certificate. - :type encryption_key_thumbprint: str - :param encryption_key: The public part of the encryption certificate. Client uses this to + :ivar encryption_key_thumbprint: The digital signature of encrypted certificate. + :vartype encryption_key_thumbprint: str + :ivar encryption_key: The public part of the encryption certificate. Client uses this to encrypt any secret. - :type encryption_key: str + :vartype encryption_key: str :ivar resource_key: The Resource ID of the Resource. :vartype resource_key: str - :param client_secret_store_id: The Key Vault ARM Id for client secrets. - :type client_secret_store_id: str - :param client_secret_store_url: The url to access the Client Key Vault. - :type client_secret_store_url: str - :param channel_integrity_key_name: The name of Channel Integrity Key stored in the Client Key + :ivar client_secret_store_id: The Key Vault ARM Id for client secrets. + :vartype client_secret_store_id: str + :ivar client_secret_store_url: The url to access the Client Key Vault. + :vartype client_secret_store_url: str + :ivar channel_integrity_key_name: The name of Channel Integrity Key stored in the Client Key Vault. - :type channel_integrity_key_name: str - :param channel_integrity_key_version: The version of Channel Integrity Key stored in the Client + :vartype channel_integrity_key_name: str + :ivar channel_integrity_key_version: The version of Channel Integrity Key stored in the Client Key Vault. - :type channel_integrity_key_version: str - :param key_vault_sync_status: Key vault sync status. Possible values include: "KeyVaultSynced", + :vartype channel_integrity_key_version: str + :ivar key_vault_sync_status: Key vault sync status. Possible values include: "KeyVaultSynced", "KeyVaultSyncFailed", "KeyVaultNotConfigured", "KeyVaultSyncPending", "KeyVaultSyncing". - :type key_vault_sync_status: str or + :vartype key_vault_sync_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.KeyVaultSyncStatus :ivar device_secrets: Device secrets, will be returned only with ODataFilter $expand=deviceSecrets. @@ -1240,6 +1391,28 @@ def __init__( key_vault_sync_status: Optional[Union[str, "KeyVaultSyncStatus"]] = None, **kwargs ): + """ + :keyword encryption_key_thumbprint: The digital signature of encrypted certificate. + :paramtype encryption_key_thumbprint: str + :keyword encryption_key: The public part of the encryption certificate. Client uses this to + encrypt any secret. + :paramtype encryption_key: str + :keyword client_secret_store_id: The Key Vault ARM Id for client secrets. + :paramtype client_secret_store_id: str + :keyword client_secret_store_url: The url to access the Client Key Vault. + :paramtype client_secret_store_url: str + :keyword channel_integrity_key_name: The name of Channel Integrity Key stored in the Client Key + Vault. + :paramtype channel_integrity_key_name: str + :keyword channel_integrity_key_version: The version of Channel Integrity Key stored in the + Client Key Vault. + :paramtype channel_integrity_key_version: str + :keyword key_vault_sync_status: Key vault sync status. Possible values include: + "KeyVaultSynced", "KeyVaultSyncFailed", "KeyVaultNotConfigured", "KeyVaultSyncPending", + "KeyVaultSyncing". + :paramtype key_vault_sync_status: str or + ~azure.mgmt.databoxedge.v2020_12_01.models.KeyVaultSyncStatus + """ super(DataBoxEdgeDeviceExtendedInfo, self).__init__(**kwargs) self.encryption_key_thumbprint = encryption_key_thumbprint self.encryption_key = encryption_key @@ -1255,21 +1428,21 @@ def __init__( class DataBoxEdgeDeviceExtendedInfoPatch(msrest.serialization.Model): """The Data Box Edge/Gateway device extended info patch. - :param client_secret_store_id: The Key Vault ARM Id for client secrets. - :type client_secret_store_id: str - :param client_secret_store_url: The url to access the Client Key Vault. - :type client_secret_store_url: str - :param channel_integrity_key_name: The name for Channel Integrity Key stored in the Client Key + :ivar client_secret_store_id: The Key Vault ARM Id for client secrets. + :vartype client_secret_store_id: str + :ivar client_secret_store_url: The url to access the Client Key Vault. + :vartype client_secret_store_url: str + :ivar channel_integrity_key_name: The name for Channel Integrity Key stored in the Client Key Vault. - :type channel_integrity_key_name: str - :param channel_integrity_key_version: The version of Channel Integrity Key stored in the Client + :vartype channel_integrity_key_name: str + :ivar channel_integrity_key_version: The version of Channel Integrity Key stored in the Client Key Vault. - :type channel_integrity_key_version: str - :param sync_status: For changing or to initiate the resync to key-vault set the status to + :vartype channel_integrity_key_version: str + :ivar sync_status: For changing or to initiate the resync to key-vault set the status to KeyVaultSyncPending, rest of the status will not be applicable. Possible values include: "KeyVaultSynced", "KeyVaultSyncFailed", "KeyVaultNotConfigured", "KeyVaultSyncPending", "KeyVaultSyncing". - :type sync_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.KeyVaultSyncStatus + :vartype sync_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.KeyVaultSyncStatus """ _attribute_map = { @@ -1290,6 +1463,23 @@ def __init__( sync_status: Optional[Union[str, "KeyVaultSyncStatus"]] = None, **kwargs ): + """ + :keyword client_secret_store_id: The Key Vault ARM Id for client secrets. + :paramtype client_secret_store_id: str + :keyword client_secret_store_url: The url to access the Client Key Vault. + :paramtype client_secret_store_url: str + :keyword channel_integrity_key_name: The name for Channel Integrity Key stored in the Client + Key Vault. + :paramtype channel_integrity_key_name: str + :keyword channel_integrity_key_version: The version of Channel Integrity Key stored in the + Client Key Vault. + :paramtype channel_integrity_key_version: str + :keyword sync_status: For changing or to initiate the resync to key-vault set the status to + KeyVaultSyncPending, rest of the status will not be applicable. Possible values include: + "KeyVaultSynced", "KeyVaultSyncFailed", "KeyVaultNotConfigured", "KeyVaultSyncPending", + "KeyVaultSyncing". + :paramtype sync_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.KeyVaultSyncStatus + """ super(DataBoxEdgeDeviceExtendedInfoPatch, self).__init__(**kwargs) self.client_secret_store_id = client_secret_store_id self.client_secret_store_url = client_secret_store_url @@ -1323,6 +1513,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataBoxEdgeDeviceList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1331,12 +1523,12 @@ def __init__( class DataBoxEdgeDevicePatch(msrest.serialization.Model): """The Data Box Edge/Gateway device patch. - :param tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. - :type tags: dict[str, str] - :param identity: Msi identity of the resource. - :type identity: ~azure.mgmt.databoxedge.v2020_12_01.models.ResourceIdentity - :param edge_profile: Edge Profile property of the Data Box Edge/Gateway device. - :type edge_profile: ~azure.mgmt.databoxedge.v2020_12_01.models.EdgeProfilePatch + :ivar tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. + :vartype tags: dict[str, str] + :ivar identity: Msi identity of the resource. + :vartype identity: ~azure.mgmt.databoxedge.v2020_12_01.models.ResourceIdentity + :ivar edge_profile: Edge Profile property of the Data Box Edge/Gateway device. + :vartype edge_profile: ~azure.mgmt.databoxedge.v2020_12_01.models.EdgeProfilePatch """ _attribute_map = { @@ -1353,6 +1545,14 @@ def __init__( edge_profile: Optional["EdgeProfilePatch"] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. + :paramtype tags: dict[str, str] + :keyword identity: Msi identity of the resource. + :paramtype identity: ~azure.mgmt.databoxedge.v2020_12_01.models.ResourceIdentity + :keyword edge_profile: Edge Profile property of the Data Box Edge/Gateway device. + :paramtype edge_profile: ~azure.mgmt.databoxedge.v2020_12_01.models.EdgeProfilePatch + """ super(DataBoxEdgeDevicePatch, self).__init__(**kwargs) self.tags = tags self.identity = identity @@ -1364,10 +1564,10 @@ class DataBoxEdgeMoveRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param target_resource_group: Required. Target resource group ARMId. - :type target_resource_group: str - :param resources: Required. List of resources to be moved. - :type resources: list[str] + :ivar target_resource_group: Required. Target resource group ARMId. + :vartype target_resource_group: str + :ivar resources: Required. List of resources to be moved. + :vartype resources: list[str] """ _validation = { @@ -1387,6 +1587,12 @@ def __init__( resources: List[str], **kwargs ): + """ + :keyword target_resource_group: Required. Target resource group ARMId. + :paramtype target_resource_group: str + :keyword resources: Required. List of resources to be moved. + :paramtype resources: list[str] + """ super(DataBoxEdgeMoveRequest, self).__init__(**kwargs) self.target_resource_group = target_resource_group self.resources = resources @@ -1475,6 +1681,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataBoxEdgeSku, self).__init__(**kwargs) self.resource_type = None self.name = None @@ -1518,6 +1726,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataBoxEdgeSkuList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1526,8 +1736,8 @@ def __init__( class DCAccessCode(msrest.serialization.Model): """DC Access code in the case of Self Managed Shipping. - :param auth_code: DCAccess Code for the Self Managed shipment. - :type auth_code: str + :ivar auth_code: DCAccess Code for the Self Managed shipment. + :vartype auth_code: str """ _attribute_map = { @@ -1540,6 +1750,10 @@ def __init__( auth_code: Optional[str] = None, **kwargs ): + """ + :keyword auth_code: DCAccess Code for the Self Managed shipment. + :paramtype auth_code: str + """ super(DCAccessCode, self).__init__(**kwargs) self.auth_code = auth_code @@ -1547,26 +1761,29 @@ def __init__( class DeviceSecrets(msrest.serialization.Model): """Device Secrets. - :param hcs_data_volume_bit_locker_external_key: Keyvault Id of + :ivar hcs_data_volume_bit_locker_external_key: Keyvault Id of HcsDataVolumeBitLockerExternalKey. - :type hcs_data_volume_bit_locker_external_key: + :vartype hcs_data_volume_bit_locker_external_key: ~azure.mgmt.databoxedge.v2020_12_01.models.Secret - :param hcs_internal_volume_bit_locker_external_key: Keyvault Id of + :ivar hcs_internal_volume_bit_locker_external_key: Keyvault Id of HcsInternalVolumeBitLockerExternalKey. - :type hcs_internal_volume_bit_locker_external_key: + :vartype hcs_internal_volume_bit_locker_external_key: + ~azure.mgmt.databoxedge.v2020_12_01.models.Secret + :ivar system_volume_bit_locker_recovery_key: Keyvault Id of SystemVolumeBitLockerRecoveryKey. + :vartype system_volume_bit_locker_recovery_key: + ~azure.mgmt.databoxedge.v2020_12_01.models.Secret + :ivar sed_encryption_external_key_id: Keyvault Id of SEDEncryptionExternalKeyId. + :vartype sed_encryption_external_key_id: ~azure.mgmt.databoxedge.v2020_12_01.models.Secret + :ivar sed_encryption_external_key: Keyvault Id of SEDEncryptionExternalKey. + :vartype sed_encryption_external_key: ~azure.mgmt.databoxedge.v2020_12_01.models.Secret + :ivar bmc_default_user_password: Keyvault Id of BMCDefaultUserPassword. + :vartype bmc_default_user_password: ~azure.mgmt.databoxedge.v2020_12_01.models.Secret + :ivar rotate_key_for_data_volume_bitlocker: Keyvault Id of RotateKeyForDataVolumeBitlocker. + :vartype rotate_key_for_data_volume_bitlocker: + ~azure.mgmt.databoxedge.v2020_12_01.models.Secret + :ivar rotate_keys_for_sed_drives_serialized: Keyvault Id of RotateKeysForSedDrivesSerialized. + :vartype rotate_keys_for_sed_drives_serialized: ~azure.mgmt.databoxedge.v2020_12_01.models.Secret - :param system_volume_bit_locker_recovery_key: Keyvault Id of SystemVolumeBitLockerRecoveryKey. - :type system_volume_bit_locker_recovery_key: ~azure.mgmt.databoxedge.v2020_12_01.models.Secret - :param sed_encryption_external_key_id: Keyvault Id of SEDEncryptionExternalKeyId. - :type sed_encryption_external_key_id: ~azure.mgmt.databoxedge.v2020_12_01.models.Secret - :param sed_encryption_external_key: Keyvault Id of SEDEncryptionExternalKey. - :type sed_encryption_external_key: ~azure.mgmt.databoxedge.v2020_12_01.models.Secret - :param bmc_default_user_password: Keyvault Id of BMCDefaultUserPassword. - :type bmc_default_user_password: ~azure.mgmt.databoxedge.v2020_12_01.models.Secret - :param rotate_key_for_data_volume_bitlocker: Keyvault Id of RotateKeyForDataVolumeBitlocker. - :type rotate_key_for_data_volume_bitlocker: ~azure.mgmt.databoxedge.v2020_12_01.models.Secret - :param rotate_keys_for_sed_drives_serialized: Keyvault Id of RotateKeysForSedDrivesSerialized. - :type rotate_keys_for_sed_drives_serialized: ~azure.mgmt.databoxedge.v2020_12_01.models.Secret """ _attribute_map = { @@ -1593,6 +1810,33 @@ def __init__( rotate_keys_for_sed_drives_serialized: Optional["Secret"] = None, **kwargs ): + """ + :keyword hcs_data_volume_bit_locker_external_key: Keyvault Id of + HcsDataVolumeBitLockerExternalKey. + :paramtype hcs_data_volume_bit_locker_external_key: + ~azure.mgmt.databoxedge.v2020_12_01.models.Secret + :keyword hcs_internal_volume_bit_locker_external_key: Keyvault Id of + HcsInternalVolumeBitLockerExternalKey. + :paramtype hcs_internal_volume_bit_locker_external_key: + ~azure.mgmt.databoxedge.v2020_12_01.models.Secret + :keyword system_volume_bit_locker_recovery_key: Keyvault Id of + SystemVolumeBitLockerRecoveryKey. + :paramtype system_volume_bit_locker_recovery_key: + ~azure.mgmt.databoxedge.v2020_12_01.models.Secret + :keyword sed_encryption_external_key_id: Keyvault Id of SEDEncryptionExternalKeyId. + :paramtype sed_encryption_external_key_id: ~azure.mgmt.databoxedge.v2020_12_01.models.Secret + :keyword sed_encryption_external_key: Keyvault Id of SEDEncryptionExternalKey. + :paramtype sed_encryption_external_key: ~azure.mgmt.databoxedge.v2020_12_01.models.Secret + :keyword bmc_default_user_password: Keyvault Id of BMCDefaultUserPassword. + :paramtype bmc_default_user_password: ~azure.mgmt.databoxedge.v2020_12_01.models.Secret + :keyword rotate_key_for_data_volume_bitlocker: Keyvault Id of RotateKeyForDataVolumeBitlocker. + :paramtype rotate_key_for_data_volume_bitlocker: + ~azure.mgmt.databoxedge.v2020_12_01.models.Secret + :keyword rotate_keys_for_sed_drives_serialized: Keyvault Id of + RotateKeysForSedDrivesSerialized. + :paramtype rotate_keys_for_sed_drives_serialized: + ~azure.mgmt.databoxedge.v2020_12_01.models.Secret + """ super(DeviceSecrets, self).__init__(**kwargs) self.hcs_data_volume_bit_locker_external_key = hcs_data_volume_bit_locker_external_key self.hcs_internal_volume_bit_locker_external_key = hcs_internal_volume_bit_locker_external_key @@ -1607,8 +1851,8 @@ def __init__( class EdgeProfile(msrest.serialization.Model): """Details about Edge Profile for the resource. - :param subscription: Edge Profile Subscription. - :type subscription: ~azure.mgmt.databoxedge.v2020_12_01.models.EdgeProfileSubscription + :ivar subscription: Edge Profile Subscription. + :vartype subscription: ~azure.mgmt.databoxedge.v2020_12_01.models.EdgeProfileSubscription """ _attribute_map = { @@ -1621,6 +1865,10 @@ def __init__( subscription: Optional["EdgeProfileSubscription"] = None, **kwargs ): + """ + :keyword subscription: Edge Profile Subscription. + :paramtype subscription: ~azure.mgmt.databoxedge.v2020_12_01.models.EdgeProfileSubscription + """ super(EdgeProfile, self).__init__(**kwargs) self.subscription = subscription @@ -1628,8 +1876,8 @@ def __init__( class EdgeProfilePatch(msrest.serialization.Model): """The Data Box Edge/Gateway Edge Profile patch. - :param subscription: The Data Box Edge/Gateway Edge Profile Subscription patch. - :type subscription: ~azure.mgmt.databoxedge.v2020_12_01.models.EdgeProfileSubscriptionPatch + :ivar subscription: The Data Box Edge/Gateway Edge Profile Subscription patch. + :vartype subscription: ~azure.mgmt.databoxedge.v2020_12_01.models.EdgeProfileSubscriptionPatch """ _attribute_map = { @@ -1642,6 +1890,11 @@ def __init__( subscription: Optional["EdgeProfileSubscriptionPatch"] = None, **kwargs ): + """ + :keyword subscription: The Data Box Edge/Gateway Edge Profile Subscription patch. + :paramtype subscription: + ~azure.mgmt.databoxedge.v2020_12_01.models.EdgeProfileSubscriptionPatch + """ super(EdgeProfilePatch, self).__init__(**kwargs) self.subscription = subscription @@ -1649,27 +1902,27 @@ def __init__( class EdgeProfileSubscription(msrest.serialization.Model): """Subscription details for the Edge Profile. - :param registration_id: Edge Subscription Registration ID. - :type registration_id: str - :param id: ARM ID of the subscription. - :type id: str - :param state: Possible values include: "Registered", "Warned", "Suspended", "Deleted", + :ivar registration_id: Edge Subscription Registration ID. + :vartype registration_id: str + :ivar id: ARM ID of the subscription. + :vartype id: str + :ivar state: Possible values include: "Registered", "Warned", "Suspended", "Deleted", "Unregistered". - :type state: str or ~azure.mgmt.databoxedge.v2020_12_01.models.SubscriptionState - :param registration_date: - :type registration_date: str - :param subscription_id: - :type subscription_id: str - :param tenant_id: - :type tenant_id: str - :param location_placement_id: - :type location_placement_id: str - :param quota_id: - :type quota_id: str - :param serialized_details: - :type serialized_details: str - :param registered_features: - :type registered_features: + :vartype state: str or ~azure.mgmt.databoxedge.v2020_12_01.models.SubscriptionState + :ivar registration_date: + :vartype registration_date: str + :ivar subscription_id: + :vartype subscription_id: str + :ivar tenant_id: + :vartype tenant_id: str + :ivar location_placement_id: + :vartype location_placement_id: str + :ivar quota_id: + :vartype quota_id: str + :ivar serialized_details: + :vartype serialized_details: str + :ivar registered_features: + :vartype registered_features: list[~azure.mgmt.databoxedge.v2020_12_01.models.SubscriptionRegisteredFeatures] """ @@ -1701,6 +1954,30 @@ def __init__( registered_features: Optional[List["SubscriptionRegisteredFeatures"]] = None, **kwargs ): + """ + :keyword registration_id: Edge Subscription Registration ID. + :paramtype registration_id: str + :keyword id: ARM ID of the subscription. + :paramtype id: str + :keyword state: Possible values include: "Registered", "Warned", "Suspended", "Deleted", + "Unregistered". + :paramtype state: str or ~azure.mgmt.databoxedge.v2020_12_01.models.SubscriptionState + :keyword registration_date: + :paramtype registration_date: str + :keyword subscription_id: + :paramtype subscription_id: str + :keyword tenant_id: + :paramtype tenant_id: str + :keyword location_placement_id: + :paramtype location_placement_id: str + :keyword quota_id: + :paramtype quota_id: str + :keyword serialized_details: + :paramtype serialized_details: str + :keyword registered_features: + :paramtype registered_features: + list[~azure.mgmt.databoxedge.v2020_12_01.models.SubscriptionRegisteredFeatures] + """ super(EdgeProfileSubscription, self).__init__(**kwargs) self.registration_id = registration_id self.id = id @@ -1717,8 +1994,8 @@ def __init__( class EdgeProfileSubscriptionPatch(msrest.serialization.Model): """The Data Box Edge/Gateway Edge Profile Subscription patch. - :param id: The path ID that uniquely identifies the subscription of the edge profile. - :type id: str + :ivar id: The path ID that uniquely identifies the subscription of the edge profile. + :vartype id: str """ _attribute_map = { @@ -1731,6 +2008,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The path ID that uniquely identifies the subscription of the edge profile. + :paramtype id: str + """ super(EdgeProfileSubscriptionPatch, self).__init__(**kwargs) self.id = id @@ -1760,6 +2041,8 @@ def __init__( self, **kwargs ): + """ + """ super(EtcdInfo, self).__init__(**kwargs) self.type = None self.version = None @@ -1783,9 +2066,9 @@ class Trigger(ARMBaseModel): :vartype type: str :ivar system_data: Trigger in DataBoxEdge Resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: + :ivar kind: Required. Trigger Kind.Constant filled by server. Possible values include: "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.TriggerEventType + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.TriggerEventType """ _validation = { @@ -1812,6 +2095,8 @@ def __init__( self, **kwargs ): + """ + """ super(Trigger, self).__init__(**kwargs) self.system_data = None self.kind = 'Trigger' # type: str @@ -1832,17 +2117,17 @@ class FileEventTrigger(Trigger): :vartype type: str :ivar system_data: Trigger in DataBoxEdge Resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: + :ivar kind: Required. Trigger Kind.Constant filled by server. Possible values include: "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.TriggerEventType - :param source_info: Required. File event source details. - :type source_info: ~azure.mgmt.databoxedge.v2020_12_01.models.FileSourceInfo - :param sink_info: Required. Role sink info. - :type sink_info: ~azure.mgmt.databoxedge.v2020_12_01.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.TriggerEventType + :ivar source_info: Required. File event source details. + :vartype source_info: ~azure.mgmt.databoxedge.v2020_12_01.models.FileSourceInfo + :ivar sink_info: Required. Role sink info. + :vartype sink_info: ~azure.mgmt.databoxedge.v2020_12_01.models.RoleSinkInfo + :ivar custom_context_tag: A custom context tag typically used to correlate the trigger against its usage. For example, if a periodic timer trigger is intended for certain specific IoT modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str + :vartype custom_context_tag: str """ _validation = { @@ -1875,6 +2160,16 @@ def __init__( custom_context_tag: Optional[str] = None, **kwargs ): + """ + :keyword source_info: Required. File event source details. + :paramtype source_info: ~azure.mgmt.databoxedge.v2020_12_01.models.FileSourceInfo + :keyword sink_info: Required. Role sink info. + :paramtype sink_info: ~azure.mgmt.databoxedge.v2020_12_01.models.RoleSinkInfo + :keyword custom_context_tag: A custom context tag typically used to correlate the trigger + against its usage. For example, if a periodic timer trigger is intended for certain specific + IoT modules in the device, the tag can be the name or the image URL of the module. + :paramtype custom_context_tag: str + """ super(FileEventTrigger, self).__init__(**kwargs) self.kind = 'FileEvent' # type: str self.source_info = source_info @@ -1887,8 +2182,8 @@ class FileSourceInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param share_id: Required. File share ID. - :type share_id: str + :ivar share_id: Required. File share ID. + :vartype share_id: str """ _validation = { @@ -1905,6 +2200,10 @@ def __init__( share_id: str, **kwargs ): + """ + :keyword share_id: Required. File share ID. + :paramtype share_id: str + """ super(FileSourceInfo, self).__init__(**kwargs) self.share_id = share_id @@ -1912,14 +2211,14 @@ def __init__( class GenerateCertResponse(msrest.serialization.Model): """Used in activation key generation flow. - :param public_key: Gets or sets base64 encoded certificate raw data, + :ivar public_key: Gets or sets base64 encoded certificate raw data, this is the public part needed to be uploaded to cert vault. - :type public_key: str - :param private_key: Gets or sets base64 encoded private part of the certificate, + :vartype public_key: str + :ivar private_key: Gets or sets base64 encoded private part of the certificate, needed to form the activation key. - :type private_key: str - :param expiry_time_in_utc: Gets or sets expiry time in UTC. - :type expiry_time_in_utc: str + :vartype private_key: str + :ivar expiry_time_in_utc: Gets or sets expiry time in UTC. + :vartype expiry_time_in_utc: str """ _attribute_map = { @@ -1936,6 +2235,16 @@ def __init__( expiry_time_in_utc: Optional[str] = None, **kwargs ): + """ + :keyword public_key: Gets or sets base64 encoded certificate raw data, + this is the public part needed to be uploaded to cert vault. + :paramtype public_key: str + :keyword private_key: Gets or sets base64 encoded private part of the certificate, + needed to form the activation key. + :paramtype private_key: str + :keyword expiry_time_in_utc: Gets or sets expiry time in UTC. + :paramtype expiry_time_in_utc: str + """ super(GenerateCertResponse, self).__init__(**kwargs) self.public_key = public_key self.private_key = private_key @@ -1947,12 +2256,12 @@ class ImageRepositoryCredential(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param image_repository_url: Required. Image repository url (e.g.: mcr.microsoft.com). - :type image_repository_url: str - :param user_name: Required. Repository user name. - :type user_name: str - :param password: Repository user password. - :type password: ~azure.mgmt.databoxedge.v2020_12_01.models.AsymmetricEncryptedSecret + :ivar image_repository_url: Required. Image repository url (e.g.: mcr.microsoft.com). + :vartype image_repository_url: str + :ivar user_name: Required. Repository user name. + :vartype user_name: str + :ivar password: Repository user password. + :vartype password: ~azure.mgmt.databoxedge.v2020_12_01.models.AsymmetricEncryptedSecret """ _validation = { @@ -1974,6 +2283,14 @@ def __init__( password: Optional["AsymmetricEncryptedSecret"] = None, **kwargs ): + """ + :keyword image_repository_url: Required. Image repository url (e.g.: mcr.microsoft.com). + :paramtype image_repository_url: str + :keyword user_name: Required. Repository user name. + :paramtype user_name: str + :keyword password: Repository user password. + :paramtype password: ~azure.mgmt.databoxedge.v2020_12_01.models.AsymmetricEncryptedSecret + """ super(ImageRepositoryCredential, self).__init__(**kwargs) self.image_repository_url = image_repository_url self.user_name = user_name @@ -1993,17 +2310,17 @@ class IoTAddon(Addon): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Addon type.Constant filled by server. Possible values include: - "IotEdge", "ArcForKubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.AddonType + :ivar kind: Required. Addon type.Constant filled by server. Possible values include: "IotEdge", + "ArcForKubernetes". + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.AddonType :ivar system_data: Addon type. :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - :param io_t_device_details: Required. IoT device metadata to which appliance needs to be + :ivar io_t_device_details: Required. IoT device metadata to which appliance needs to be connected. - :type io_t_device_details: ~azure.mgmt.databoxedge.v2020_12_01.models.IoTDeviceInfo - :param io_t_edge_device_details: Required. IoT edge device to which the IoT Addon needs to be + :vartype io_t_device_details: ~azure.mgmt.databoxedge.v2020_12_01.models.IoTDeviceInfo + :ivar io_t_edge_device_details: Required. IoT edge device to which the IoT Addon needs to be configured. - :type io_t_edge_device_details: ~azure.mgmt.databoxedge.v2020_12_01.models.IoTDeviceInfo + :vartype io_t_edge_device_details: ~azure.mgmt.databoxedge.v2020_12_01.models.IoTDeviceInfo :ivar version: Version of IoT running on the appliance. :vartype version: str :ivar host_platform: Host OS supported by the IoT addon. Possible values include: "Windows", @@ -2052,6 +2369,14 @@ def __init__( io_t_edge_device_details: "IoTDeviceInfo", **kwargs ): + """ + :keyword io_t_device_details: Required. IoT device metadata to which appliance needs to be + connected. + :paramtype io_t_device_details: ~azure.mgmt.databoxedge.v2020_12_01.models.IoTDeviceInfo + :keyword io_t_edge_device_details: Required. IoT edge device to which the IoT Addon needs to be + configured. + :paramtype io_t_edge_device_details: ~azure.mgmt.databoxedge.v2020_12_01.models.IoTDeviceInfo + """ super(IoTAddon, self).__init__(**kwargs) self.kind = 'IotEdge' # type: str self.io_t_device_details = io_t_device_details @@ -2067,14 +2392,14 @@ class IoTDeviceInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param device_id: Required. ID of the IoT device/edge device. - :type device_id: str - :param io_t_host_hub: Required. Host name for the IoT hub associated to the device. - :type io_t_host_hub: str - :param io_t_host_hub_id: Id for the IoT hub associated to the device. - :type io_t_host_hub_id: str - :param authentication: Encrypted IoT device/IoT edge device connection string. - :type authentication: ~azure.mgmt.databoxedge.v2020_12_01.models.Authentication + :ivar device_id: Required. ID of the IoT device/edge device. + :vartype device_id: str + :ivar io_t_host_hub: Required. Host name for the IoT hub associated to the device. + :vartype io_t_host_hub: str + :ivar io_t_host_hub_id: Id for the IoT hub associated to the device. + :vartype io_t_host_hub_id: str + :ivar authentication: Encrypted IoT device/IoT edge device connection string. + :vartype authentication: ~azure.mgmt.databoxedge.v2020_12_01.models.Authentication """ _validation = { @@ -2098,6 +2423,16 @@ def __init__( authentication: Optional["Authentication"] = None, **kwargs ): + """ + :keyword device_id: Required. ID of the IoT device/edge device. + :paramtype device_id: str + :keyword io_t_host_hub: Required. Host name for the IoT hub associated to the device. + :paramtype io_t_host_hub: str + :keyword io_t_host_hub_id: Id for the IoT hub associated to the device. + :paramtype io_t_host_hub_id: str + :keyword authentication: Encrypted IoT device/IoT edge device connection string. + :paramtype authentication: ~azure.mgmt.databoxedge.v2020_12_01.models.Authentication + """ super(IoTDeviceInfo, self).__init__(**kwargs) self.device_id = device_id self.io_t_host_hub = io_t_host_hub @@ -2110,12 +2445,12 @@ class IoTEdgeAgentInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param image_name: Required. Name of the IoT edge agent image. - :type image_name: str - :param tag: Required. Image Tag. - :type tag: str - :param image_repository: Image repository details. - :type image_repository: ~azure.mgmt.databoxedge.v2020_12_01.models.ImageRepositoryCredential + :ivar image_name: Required. Name of the IoT edge agent image. + :vartype image_name: str + :ivar tag: Required. Image Tag. + :vartype tag: str + :ivar image_repository: Image repository details. + :vartype image_repository: ~azure.mgmt.databoxedge.v2020_12_01.models.ImageRepositoryCredential """ _validation = { @@ -2137,6 +2472,15 @@ def __init__( image_repository: Optional["ImageRepositoryCredential"] = None, **kwargs ): + """ + :keyword image_name: Required. Name of the IoT edge agent image. + :paramtype image_name: str + :keyword tag: Required. Image Tag. + :paramtype tag: str + :keyword image_repository: Image repository details. + :paramtype image_repository: + ~azure.mgmt.databoxedge.v2020_12_01.models.ImageRepositoryCredential + """ super(IoTEdgeAgentInfo, self).__init__(**kwargs) self.image_name = image_name self.tag = tag @@ -2156,31 +2500,31 @@ class IoTRole(Role): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleTypes + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleTypes :ivar system_data: Role configured on ASE resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - :param host_platform: Host OS supported by the IoT role. Possible values include: "Windows", + :ivar host_platform: Host OS supported by the IoT role. Possible values include: "Windows", "Linux". - :type host_platform: str or ~azure.mgmt.databoxedge.v2020_12_01.models.PlatformType - :param io_t_device_details: IoT device metadata to which data box edge device needs to be + :vartype host_platform: str or ~azure.mgmt.databoxedge.v2020_12_01.models.PlatformType + :ivar io_t_device_details: IoT device metadata to which data box edge device needs to be connected. - :type io_t_device_details: ~azure.mgmt.databoxedge.v2020_12_01.models.IoTDeviceInfo - :param io_t_edge_device_details: IoT edge device to which the IoT role needs to be configured. - :type io_t_edge_device_details: ~azure.mgmt.databoxedge.v2020_12_01.models.IoTDeviceInfo - :param share_mappings: Mount points of shares in role(s). - :type share_mappings: list[~azure.mgmt.databoxedge.v2020_12_01.models.MountPointMap] - :param io_t_edge_agent_info: Iot edge agent details to download the agent and bootstrap iot + :vartype io_t_device_details: ~azure.mgmt.databoxedge.v2020_12_01.models.IoTDeviceInfo + :ivar io_t_edge_device_details: IoT edge device to which the IoT role needs to be configured. + :vartype io_t_edge_device_details: ~azure.mgmt.databoxedge.v2020_12_01.models.IoTDeviceInfo + :ivar share_mappings: Mount points of shares in role(s). + :vartype share_mappings: list[~azure.mgmt.databoxedge.v2020_12_01.models.MountPointMap] + :ivar io_t_edge_agent_info: Iot edge agent details to download the agent and bootstrap iot runtime. - :type io_t_edge_agent_info: ~azure.mgmt.databoxedge.v2020_12_01.models.IoTEdgeAgentInfo + :vartype io_t_edge_agent_info: ~azure.mgmt.databoxedge.v2020_12_01.models.IoTEdgeAgentInfo :ivar host_platform_type: Platform where the Iot runtime is hosted. Possible values include: "KubernetesCluster", "LinuxVM". :vartype host_platform_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.HostPlatformType - :param compute_resource: Resource allocation. - :type compute_resource: ~azure.mgmt.databoxedge.v2020_12_01.models.ComputeResource - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleStatus + :ivar compute_resource: Resource allocation. + :vartype compute_resource: ~azure.mgmt.databoxedge.v2020_12_01.models.ComputeResource + :ivar role_status: Role status. Possible values include: "Enabled", "Disabled". + :vartype role_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleStatus """ _validation = { @@ -2220,6 +2564,26 @@ def __init__( role_status: Optional[Union[str, "RoleStatus"]] = None, **kwargs ): + """ + :keyword host_platform: Host OS supported by the IoT role. Possible values include: "Windows", + "Linux". + :paramtype host_platform: str or ~azure.mgmt.databoxedge.v2020_12_01.models.PlatformType + :keyword io_t_device_details: IoT device metadata to which data box edge device needs to be + connected. + :paramtype io_t_device_details: ~azure.mgmt.databoxedge.v2020_12_01.models.IoTDeviceInfo + :keyword io_t_edge_device_details: IoT edge device to which the IoT role needs to be + configured. + :paramtype io_t_edge_device_details: ~azure.mgmt.databoxedge.v2020_12_01.models.IoTDeviceInfo + :keyword share_mappings: Mount points of shares in role(s). + :paramtype share_mappings: list[~azure.mgmt.databoxedge.v2020_12_01.models.MountPointMap] + :keyword io_t_edge_agent_info: Iot edge agent details to download the agent and bootstrap iot + runtime. + :paramtype io_t_edge_agent_info: ~azure.mgmt.databoxedge.v2020_12_01.models.IoTEdgeAgentInfo + :keyword compute_resource: Resource allocation. + :paramtype compute_resource: ~azure.mgmt.databoxedge.v2020_12_01.models.ComputeResource + :keyword role_status: Role status. Possible values include: "Enabled", "Disabled". + :paramtype role_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleStatus + """ super(IoTRole, self).__init__(**kwargs) self.kind = 'IOT' # type: str self.host_platform = host_platform @@ -2261,6 +2625,8 @@ def __init__( self, **kwargs ): + """ + """ super(Ipv4Config, self).__init__(**kwargs) self.ip_address = None self.subnet = None @@ -2296,6 +2662,8 @@ def __init__( self, **kwargs ): + """ + """ super(Ipv6Config, self).__init__(**kwargs) self.ip_address = None self.prefix_length = None @@ -2344,9 +2712,9 @@ class Job(msrest.serialization.Model): :vartype error_manifest_file: str :ivar refreshed_entity_id: ARM ID of the entity that was refreshed. :vartype refreshed_entity_id: str - :param folder: If only subfolders need to be refreshed, then the subfolder path inside the - share or container. (The path is empty if there are no subfolders.). - :type folder: str + :ivar folder: If only subfolders need to be refreshed, then the subfolder path inside the share + or container. (The path is empty if there are no subfolders.). + :vartype folder: str """ _validation = { @@ -2392,6 +2760,11 @@ def __init__( folder: Optional[str] = None, **kwargs ): + """ + :keyword folder: If only subfolders need to be refreshed, then the subfolder path inside the + share or container. (The path is empty if there are no subfolders.). + :paramtype folder: str + """ super(Job, self).__init__(**kwargs) self.id = None self.name = None @@ -2440,6 +2813,8 @@ def __init__( self, **kwargs ): + """ + """ super(JobErrorDetails, self).__init__(**kwargs) self.error_details = None self.code = None @@ -2475,6 +2850,8 @@ def __init__( self, **kwargs ): + """ + """ super(JobErrorItem, self).__init__(**kwargs) self.recommendations = None self.code = None @@ -2492,8 +2869,8 @@ class KubernetesClusterInfo(msrest.serialization.Model): :vartype etcd_info: ~azure.mgmt.databoxedge.v2020_12_01.models.EtcdInfo :ivar nodes: Kubernetes cluster nodes. :vartype nodes: list[~azure.mgmt.databoxedge.v2020_12_01.models.NodeInfo] - :param version: Required. Kubernetes cluster version. - :type version: str + :ivar version: Required. Kubernetes cluster version. + :vartype version: str """ _validation = { @@ -2514,6 +2891,10 @@ def __init__( version: str, **kwargs ): + """ + :keyword version: Required. Kubernetes cluster version. + :paramtype version: str + """ super(KubernetesClusterInfo, self).__init__(**kwargs) self.etcd_info = None self.nodes = None @@ -2527,8 +2908,8 @@ class KubernetesIPConfiguration(msrest.serialization.Model): :ivar port: Port of the Kubernetes node. :vartype port: str - :param ip_address: IP address of the Kubernetes node. - :type ip_address: str + :ivar ip_address: IP address of the Kubernetes node. + :vartype ip_address: str """ _validation = { @@ -2546,6 +2927,10 @@ def __init__( ip_address: Optional[str] = None, **kwargs ): + """ + :keyword ip_address: IP address of the Kubernetes node. + :paramtype ip_address: str + """ super(KubernetesIPConfiguration, self).__init__(**kwargs) self.port = None self.ip_address = ip_address @@ -2564,27 +2949,28 @@ class KubernetesRole(Role): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleTypes + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleTypes :ivar system_data: Role configured on ASE resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - :param host_platform: Host OS supported by the Kubernetes role. Possible values include: + :ivar host_platform: Host OS supported by the Kubernetes role. Possible values include: "Windows", "Linux". - :type host_platform: str or ~azure.mgmt.databoxedge.v2020_12_01.models.PlatformType + :vartype host_platform: str or ~azure.mgmt.databoxedge.v2020_12_01.models.PlatformType :ivar provisioning_state: State of Kubernetes deployment. Possible values include: "Invalid", "Creating", "Created", "Updating", "Reconfiguring", "Failed", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.databoxedge.v2020_12_01.models.KubernetesState :ivar host_platform_type: Platform where the runtime is hosted. Possible values include: "KubernetesCluster", "LinuxVM". :vartype host_platform_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.HostPlatformType - :param kubernetes_cluster_info: Kubernetes cluster configuration. - :type kubernetes_cluster_info: ~azure.mgmt.databoxedge.v2020_12_01.models.KubernetesClusterInfo - :param kubernetes_role_resources: Kubernetes role resources. - :type kubernetes_role_resources: + :ivar kubernetes_cluster_info: Kubernetes cluster configuration. + :vartype kubernetes_cluster_info: + ~azure.mgmt.databoxedge.v2020_12_01.models.KubernetesClusterInfo + :ivar kubernetes_role_resources: Kubernetes role resources. + :vartype kubernetes_role_resources: ~azure.mgmt.databoxedge.v2020_12_01.models.KubernetesRoleResources - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleStatus + :ivar role_status: Role status. Possible values include: "Enabled", "Disabled". + :vartype role_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleStatus """ _validation = { @@ -2620,6 +3006,19 @@ def __init__( role_status: Optional[Union[str, "RoleStatus"]] = None, **kwargs ): + """ + :keyword host_platform: Host OS supported by the Kubernetes role. Possible values include: + "Windows", "Linux". + :paramtype host_platform: str or ~azure.mgmt.databoxedge.v2020_12_01.models.PlatformType + :keyword kubernetes_cluster_info: Kubernetes cluster configuration. + :paramtype kubernetes_cluster_info: + ~azure.mgmt.databoxedge.v2020_12_01.models.KubernetesClusterInfo + :keyword kubernetes_role_resources: Kubernetes role resources. + :paramtype kubernetes_role_resources: + ~azure.mgmt.databoxedge.v2020_12_01.models.KubernetesRoleResources + :keyword role_status: Role status. Possible values include: "Enabled", "Disabled". + :paramtype role_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleStatus + """ super(KubernetesRole, self).__init__(**kwargs) self.kind = 'Kubernetes' # type: str self.host_platform = host_platform @@ -2637,8 +3036,8 @@ class KubernetesRoleCompute(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param vm_profile: Required. VM profile. - :type vm_profile: str + :ivar vm_profile: Required. VM profile. + :vartype vm_profile: str :ivar memory_in_bytes: Memory in bytes. :vartype memory_in_bytes: long :ivar processor_count: Processor count. @@ -2663,6 +3062,10 @@ def __init__( vm_profile: str, **kwargs ): + """ + :keyword vm_profile: Required. VM profile. + :paramtype vm_profile: str + """ super(KubernetesRoleCompute, self).__init__(**kwargs) self.vm_profile = vm_profile self.memory_in_bytes = None @@ -2694,6 +3097,8 @@ def __init__( self, **kwargs ): + """ + """ super(KubernetesRoleNetwork, self).__init__(**kwargs) self.cni_config = None self.load_balancer_config = None @@ -2706,10 +3111,10 @@ class KubernetesRoleResources(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param storage: Kubernetes role storage resource. - :type storage: ~azure.mgmt.databoxedge.v2020_12_01.models.KubernetesRoleStorage - :param compute: Required. Kubernetes role compute resource. - :type compute: ~azure.mgmt.databoxedge.v2020_12_01.models.KubernetesRoleCompute + :ivar storage: Kubernetes role storage resource. + :vartype storage: ~azure.mgmt.databoxedge.v2020_12_01.models.KubernetesRoleStorage + :ivar compute: Required. Kubernetes role compute resource. + :vartype compute: ~azure.mgmt.databoxedge.v2020_12_01.models.KubernetesRoleCompute :ivar network: Kubernetes role network resource. :vartype network: ~azure.mgmt.databoxedge.v2020_12_01.models.KubernetesRoleNetwork """ @@ -2732,6 +3137,12 @@ def __init__( storage: Optional["KubernetesRoleStorage"] = None, **kwargs ): + """ + :keyword storage: Kubernetes role storage resource. + :paramtype storage: ~azure.mgmt.databoxedge.v2020_12_01.models.KubernetesRoleStorage + :keyword compute: Required. Kubernetes role compute resource. + :paramtype compute: ~azure.mgmt.databoxedge.v2020_12_01.models.KubernetesRoleCompute + """ super(KubernetesRoleResources, self).__init__(**kwargs) self.storage = storage self.compute = compute @@ -2746,8 +3157,8 @@ class KubernetesRoleStorage(msrest.serialization.Model): :ivar storage_classes: Kubernetes storage class info. :vartype storage_classes: list[~azure.mgmt.databoxedge.v2020_12_01.models.KubernetesRoleStorageClassInfo] - :param endpoints: Mount points of shares in role(s). - :type endpoints: list[~azure.mgmt.databoxedge.v2020_12_01.models.MountPointMap] + :ivar endpoints: Mount points of shares in role(s). + :vartype endpoints: list[~azure.mgmt.databoxedge.v2020_12_01.models.MountPointMap] """ _validation = { @@ -2765,6 +3176,10 @@ def __init__( endpoints: Optional[List["MountPointMap"]] = None, **kwargs ): + """ + :keyword endpoints: Mount points of shares in role(s). + :paramtype endpoints: list[~azure.mgmt.databoxedge.v2020_12_01.models.MountPointMap] + """ super(KubernetesRoleStorage, self).__init__(**kwargs) self.storage_classes = None self.endpoints = endpoints @@ -2801,6 +3216,8 @@ def __init__( self, **kwargs ): + """ + """ super(KubernetesRoleStorageClassInfo, self).__init__(**kwargs) self.name = None self.type = None @@ -2832,6 +3249,8 @@ def __init__( self, **kwargs ): + """ + """ super(LoadBalancerConfig, self).__init__(**kwargs) self.type = None self.version = None @@ -2850,15 +3269,16 @@ class MECRole(Role): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleTypes + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleTypes :ivar system_data: Role configured on ASE resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - :param connection_string: Activation key of the MEC. - :type connection_string: ~azure.mgmt.databoxedge.v2020_12_01.models.AsymmetricEncryptedSecret - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleStatus + :ivar connection_string: Activation key of the MEC. + :vartype connection_string: + ~azure.mgmt.databoxedge.v2020_12_01.models.AsymmetricEncryptedSecret + :ivar role_status: Role status. Possible values include: "Enabled", "Disabled". + :vartype role_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleStatus """ _validation = { @@ -2886,6 +3306,13 @@ def __init__( role_status: Optional[Union[str, "RoleStatus"]] = None, **kwargs ): + """ + :keyword connection_string: Activation key of the MEC. + :paramtype connection_string: + ~azure.mgmt.databoxedge.v2020_12_01.models.AsymmetricEncryptedSecret + :keyword role_status: Role status. Possible values include: "Enabled", "Disabled". + :paramtype role_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.RoleStatus + """ super(MECRole, self).__init__(**kwargs) self.kind = 'MEC' # type: str self.connection_string = connection_string @@ -2897,15 +3324,15 @@ class MetricConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param resource_id: Required. The Resource ID on which the metrics should be pushed. - :type resource_id: str - :param mdm_account: The MDM account to which the counters should be pushed. - :type mdm_account: str - :param metric_name_space: The MDM namespace to which the counters should be pushed. This is + :ivar resource_id: Required. The Resource ID on which the metrics should be pushed. + :vartype resource_id: str + :ivar mdm_account: The MDM account to which the counters should be pushed. + :vartype mdm_account: str + :ivar metric_name_space: The MDM namespace to which the counters should be pushed. This is required if MDMAccount is specified. - :type metric_name_space: str - :param counter_sets: Required. Host name for the IoT hub associated to the device. - :type counter_sets: list[~azure.mgmt.databoxedge.v2020_12_01.models.MetricCounterSet] + :vartype metric_name_space: str + :ivar counter_sets: Required. Host name for the IoT hub associated to the device. + :vartype counter_sets: list[~azure.mgmt.databoxedge.v2020_12_01.models.MetricCounterSet] """ _validation = { @@ -2929,6 +3356,17 @@ def __init__( metric_name_space: Optional[str] = None, **kwargs ): + """ + :keyword resource_id: Required. The Resource ID on which the metrics should be pushed. + :paramtype resource_id: str + :keyword mdm_account: The MDM account to which the counters should be pushed. + :paramtype mdm_account: str + :keyword metric_name_space: The MDM namespace to which the counters should be pushed. This is + required if MDMAccount is specified. + :paramtype metric_name_space: str + :keyword counter_sets: Required. Host name for the IoT hub associated to the device. + :paramtype counter_sets: list[~azure.mgmt.databoxedge.v2020_12_01.models.MetricCounterSet] + """ super(MetricConfiguration, self).__init__(**kwargs) self.resource_id = resource_id self.mdm_account = mdm_account @@ -2941,14 +3379,15 @@ class MetricCounter(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The counter name. - :type name: str - :param instance: The instance from which counter should be collected. - :type instance: str - :param dimension_filter: The dimension filter. - :type dimension_filter: list[~azure.mgmt.databoxedge.v2020_12_01.models.MetricDimension] - :param additional_dimensions: The additional dimensions to be added to metric. - :type additional_dimensions: list[~azure.mgmt.databoxedge.v2020_12_01.models.MetricDimension] + :ivar name: Required. The counter name. + :vartype name: str + :ivar instance: The instance from which counter should be collected. + :vartype instance: str + :ivar dimension_filter: The dimension filter. + :vartype dimension_filter: list[~azure.mgmt.databoxedge.v2020_12_01.models.MetricDimension] + :ivar additional_dimensions: The additional dimensions to be added to metric. + :vartype additional_dimensions: + list[~azure.mgmt.databoxedge.v2020_12_01.models.MetricDimension] """ _validation = { @@ -2971,6 +3410,17 @@ def __init__( additional_dimensions: Optional[List["MetricDimension"]] = None, **kwargs ): + """ + :keyword name: Required. The counter name. + :paramtype name: str + :keyword instance: The instance from which counter should be collected. + :paramtype instance: str + :keyword dimension_filter: The dimension filter. + :paramtype dimension_filter: list[~azure.mgmt.databoxedge.v2020_12_01.models.MetricDimension] + :keyword additional_dimensions: The additional dimensions to be added to metric. + :paramtype additional_dimensions: + list[~azure.mgmt.databoxedge.v2020_12_01.models.MetricDimension] + """ super(MetricCounter, self).__init__(**kwargs) self.name = name self.instance = instance @@ -2983,8 +3433,8 @@ class MetricCounterSet(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param counters: Required. The counters that should be collected in this set. - :type counters: list[~azure.mgmt.databoxedge.v2020_12_01.models.MetricCounter] + :ivar counters: Required. The counters that should be collected in this set. + :vartype counters: list[~azure.mgmt.databoxedge.v2020_12_01.models.MetricCounter] """ _validation = { @@ -3001,6 +3451,10 @@ def __init__( counters: List["MetricCounter"], **kwargs ): + """ + :keyword counters: Required. The counters that should be collected in this set. + :paramtype counters: list[~azure.mgmt.databoxedge.v2020_12_01.models.MetricCounter] + """ super(MetricCounterSet, self).__init__(**kwargs) self.counters = counters @@ -3010,10 +3464,10 @@ class MetricDimension(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_type: Required. The dimension type. - :type source_type: str - :param source_name: Required. The dimension value. - :type source_name: str + :ivar source_type: Required. The dimension type. + :vartype source_type: str + :ivar source_name: Required. The dimension value. + :vartype source_name: str """ _validation = { @@ -3033,6 +3487,12 @@ def __init__( source_name: str, **kwargs ): + """ + :keyword source_type: Required. The dimension type. + :paramtype source_type: str + :keyword source_name: Required. The dimension value. + :paramtype source_name: str + """ super(MetricDimension, self).__init__(**kwargs) self.source_type = source_type self.source_name = source_name @@ -3041,12 +3501,12 @@ def __init__( class MetricDimensionV1(msrest.serialization.Model): """Metric Dimension v1. - :param name: Name of the metrics dimension. - :type name: str - :param display_name: Display name of the metrics dimension. - :type display_name: str - :param to_be_exported_for_shoebox: To be exported to shoe box. - :type to_be_exported_for_shoebox: bool + :ivar name: Name of the metrics dimension. + :vartype name: str + :ivar display_name: Display name of the metrics dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: To be exported to shoe box. + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -3063,6 +3523,14 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): + """ + :keyword name: Name of the metrics dimension. + :paramtype name: str + :keyword display_name: Display name of the metrics dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: To be exported to shoe box. + :paramtype to_be_exported_for_shoebox: bool + """ super(MetricDimensionV1, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -3072,31 +3540,32 @@ def __init__( class MetricSpecificationV1(msrest.serialization.Model): """Metric specification version 1. - :param name: Name of the metric. - :type name: str - :param display_name: Display name of the metric. - :type display_name: str - :param display_description: Description of the metric to be displayed. - :type display_description: str - :param unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Display name of the metric. + :vartype display_name: str + :ivar display_description: Description of the metric to be displayed. + :vartype display_description: str + :ivar unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", "Seconds", "Milliseconds", "Bytes", "BytesPerSecond", "CountPerSecond". - :type unit: str or ~azure.mgmt.databoxedge.v2020_12_01.models.MetricUnit - :param aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", + :vartype unit: str or ~azure.mgmt.databoxedge.v2020_12_01.models.MetricUnit + :ivar aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", "None", "Average", "Minimum", "Maximum", "Total", "Count". - :type aggregation_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.MetricAggregationType - :param dimensions: Metric dimensions, other than default dimension which is resource. - :type dimensions: list[~azure.mgmt.databoxedge.v2020_12_01.models.MetricDimensionV1] - :param fill_gap_with_zero: Set true to fill the gaps with zero. - :type fill_gap_with_zero: bool - :param category: Metric category. Possible values include: "Capacity", "Transaction". - :type category: str or ~azure.mgmt.databoxedge.v2020_12_01.models.MetricCategory - :param resource_id_dimension_name_override: Resource name override. - :type resource_id_dimension_name_override: str - :param supported_time_grain_types: Support granularity of metrics. - :type supported_time_grain_types: list[str or + :vartype aggregation_type: str or + ~azure.mgmt.databoxedge.v2020_12_01.models.MetricAggregationType + :ivar dimensions: Metric dimensions, other than default dimension which is resource. + :vartype dimensions: list[~azure.mgmt.databoxedge.v2020_12_01.models.MetricDimensionV1] + :ivar fill_gap_with_zero: Set true to fill the gaps with zero. + :vartype fill_gap_with_zero: bool + :ivar category: Metric category. Possible values include: "Capacity", "Transaction". + :vartype category: str or ~azure.mgmt.databoxedge.v2020_12_01.models.MetricCategory + :ivar resource_id_dimension_name_override: Resource name override. + :vartype resource_id_dimension_name_override: str + :ivar supported_time_grain_types: Support granularity of metrics. + :vartype supported_time_grain_types: list[str or ~azure.mgmt.databoxedge.v2020_12_01.models.TimeGrain] - :param supported_aggregation_types: Support metric aggregation type. - :type supported_aggregation_types: list[str or + :ivar supported_aggregation_types: Support metric aggregation type. + :vartype supported_aggregation_types: list[str or ~azure.mgmt.databoxedge.v2020_12_01.models.MetricAggregationType] """ @@ -3130,6 +3599,35 @@ def __init__( supported_aggregation_types: Optional[List[Union[str, "MetricAggregationType"]]] = None, **kwargs ): + """ + :keyword name: Name of the metric. + :paramtype name: str + :keyword display_name: Display name of the metric. + :paramtype display_name: str + :keyword display_description: Description of the metric to be displayed. + :paramtype display_description: str + :keyword unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", + "Seconds", "Milliseconds", "Bytes", "BytesPerSecond", "CountPerSecond". + :paramtype unit: str or ~azure.mgmt.databoxedge.v2020_12_01.models.MetricUnit + :keyword aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", + "None", "Average", "Minimum", "Maximum", "Total", "Count". + :paramtype aggregation_type: str or + ~azure.mgmt.databoxedge.v2020_12_01.models.MetricAggregationType + :keyword dimensions: Metric dimensions, other than default dimension which is resource. + :paramtype dimensions: list[~azure.mgmt.databoxedge.v2020_12_01.models.MetricDimensionV1] + :keyword fill_gap_with_zero: Set true to fill the gaps with zero. + :paramtype fill_gap_with_zero: bool + :keyword category: Metric category. Possible values include: "Capacity", "Transaction". + :paramtype category: str or ~azure.mgmt.databoxedge.v2020_12_01.models.MetricCategory + :keyword resource_id_dimension_name_override: Resource name override. + :paramtype resource_id_dimension_name_override: str + :keyword supported_time_grain_types: Support granularity of metrics. + :paramtype supported_time_grain_types: list[str or + ~azure.mgmt.databoxedge.v2020_12_01.models.TimeGrain] + :keyword supported_aggregation_types: Support metric aggregation type. + :paramtype supported_aggregation_types: list[str or + ~azure.mgmt.databoxedge.v2020_12_01.models.MetricAggregationType] + """ super(MetricSpecificationV1, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -3157,8 +3655,8 @@ class MonitoringMetricConfiguration(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param metric_configurations: Required. The metrics configuration details. - :type metric_configurations: + :ivar metric_configurations: Required. The metrics configuration details. + :vartype metric_configurations: list[~azure.mgmt.databoxedge.v2020_12_01.models.MetricConfiguration] """ @@ -3182,6 +3680,11 @@ def __init__( metric_configurations: List["MetricConfiguration"], **kwargs ): + """ + :keyword metric_configurations: Required. The metrics configuration details. + :paramtype metric_configurations: + list[~azure.mgmt.databoxedge.v2020_12_01.models.MetricConfiguration] + """ super(MonitoringMetricConfiguration, self).__init__(**kwargs) self.metric_configurations = metric_configurations @@ -3211,6 +3714,8 @@ def __init__( self, **kwargs ): + """ + """ super(MonitoringMetricConfigurationList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3223,8 +3728,8 @@ class MountPointMap(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param share_id: Required. ID of the share mounted to the role VM. - :type share_id: str + :ivar share_id: Required. ID of the share mounted to the role VM. + :vartype share_id: str :ivar role_id: ID of the role to which share is mounted. :vartype role_id: str :ivar mount_point: Mount point for the share. @@ -3258,6 +3763,10 @@ def __init__( share_id: str, **kwargs ): + """ + :keyword share_id: Required. ID of the share mounted to the role VM. + :paramtype share_id: str + """ super(MountPointMap, self).__init__(**kwargs) self.share_id = share_id self.role_id = None @@ -3290,12 +3799,14 @@ class NetworkAdapter(msrest.serialization.Model): :ivar status: Value indicating whether this adapter is valid. Possible values include: "Inactive", "Active". :vartype status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.NetworkAdapterStatus - :param rdma_status: Value indicating whether this adapter is RDMA capable. Possible values + :ivar rdma_status: Value indicating whether this adapter is RDMA capable. Possible values include: "Incapable", "Capable". - :type rdma_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.NetworkAdapterRDMAStatus - :param dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values + :vartype rdma_status: str or + ~azure.mgmt.databoxedge.v2020_12_01.models.NetworkAdapterRDMAStatus + :ivar dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values include: "Disabled", "Enabled". - :type dhcp_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.NetworkAdapterDHCPStatus + :vartype dhcp_status: str or + ~azure.mgmt.databoxedge.v2020_12_01.models.NetworkAdapterDHCPStatus :ivar ipv4_configuration: The IPv4 configuration of the network adapter. :vartype ipv4_configuration: ~azure.mgmt.databoxedge.v2020_12_01.models.Ipv4Config :ivar ipv6_configuration: The IPv6 configuration of the network adapter. @@ -3347,6 +3858,16 @@ def __init__( dhcp_status: Optional[Union[str, "NetworkAdapterDHCPStatus"]] = None, **kwargs ): + """ + :keyword rdma_status: Value indicating whether this adapter is RDMA capable. Possible values + include: "Incapable", "Capable". + :paramtype rdma_status: str or + ~azure.mgmt.databoxedge.v2020_12_01.models.NetworkAdapterRDMAStatus + :keyword dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values + include: "Disabled", "Enabled". + :paramtype dhcp_status: str or + ~azure.mgmt.databoxedge.v2020_12_01.models.NetworkAdapterDHCPStatus + """ super(NetworkAdapter, self).__init__(**kwargs) self.adapter_id = None self.adapter_position = None @@ -3390,6 +3911,8 @@ def __init__( self, **kwargs ): + """ + """ super(NetworkAdapterPosition, self).__init__(**kwargs) self.network_group = None self.port = None @@ -3428,6 +3951,8 @@ def __init__( self, **kwargs ): + """ + """ super(NetworkSettings, self).__init__(**kwargs) self.network_adapters = None @@ -3493,6 +4018,8 @@ def __init__( self, **kwargs ): + """ + """ super(Node, self).__init__(**kwargs) self.node_status = None self.node_chassis_serial_number = None @@ -3512,8 +4039,8 @@ class NodeInfo(msrest.serialization.Model): :vartype name: str :ivar type: Node type - Master/Worker. Possible values include: "Invalid", "Master", "Worker". :vartype type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.KubernetesNodeType - :param ip_configuration: IP Configuration of the Kubernetes node. - :type ip_configuration: + :ivar ip_configuration: IP Configuration of the Kubernetes node. + :vartype ip_configuration: list[~azure.mgmt.databoxedge.v2020_12_01.models.KubernetesIPConfiguration] """ @@ -3534,6 +4061,11 @@ def __init__( ip_configuration: Optional[List["KubernetesIPConfiguration"]] = None, **kwargs ): + """ + :keyword ip_configuration: IP Configuration of the Kubernetes node. + :paramtype ip_configuration: + list[~azure.mgmt.databoxedge.v2020_12_01.models.KubernetesIPConfiguration] + """ super(NodeInfo, self).__init__(**kwargs) self.name = None self.type = None @@ -3547,8 +4079,8 @@ class NodeList(msrest.serialization.Model): :ivar value: The list of Nodes. :vartype value: list[~azure.mgmt.databoxedge.v2020_12_01.models.Node] - :param next_link: Link to the next set of results. - :type next_link: str + :ivar next_link: Link to the next set of results. + :vartype next_link: str """ _validation = { @@ -3566,6 +4098,10 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: Link to the next set of results. + :paramtype next_link: str + """ super(NodeList, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -3574,16 +4110,16 @@ def __init__( class Operation(msrest.serialization.Model): """Operations. - :param name: Name of the operation. - :type name: str - :param is_data_action: Is data action. - :type is_data_action: bool - :param display: Properties displayed for the operation. - :type display: ~azure.mgmt.databoxedge.v2020_12_01.models.OperationDisplay - :param origin: Origin of the operation. - :type origin: str - :param service_specification: Service specification. - :type service_specification: ~azure.mgmt.databoxedge.v2020_12_01.models.ServiceSpecification + :ivar name: Name of the operation. + :vartype name: str + :ivar is_data_action: Is data action. + :vartype is_data_action: bool + :ivar display: Properties displayed for the operation. + :vartype display: ~azure.mgmt.databoxedge.v2020_12_01.models.OperationDisplay + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar service_specification: Service specification. + :vartype service_specification: ~azure.mgmt.databoxedge.v2020_12_01.models.ServiceSpecification """ _attribute_map = { @@ -3604,6 +4140,19 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword name: Name of the operation. + :paramtype name: str + :keyword is_data_action: Is data action. + :paramtype is_data_action: bool + :keyword display: Properties displayed for the operation. + :paramtype display: ~azure.mgmt.databoxedge.v2020_12_01.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword service_specification: Service specification. + :paramtype service_specification: + ~azure.mgmt.databoxedge.v2020_12_01.models.ServiceSpecification + """ super(Operation, self).__init__(**kwargs) self.name = name self.is_data_action = is_data_action @@ -3615,14 +4164,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Operation display properties. - :param provider: Provider name. - :type provider: str - :param resource: The type of resource in which the operation is performed. - :type resource: str - :param operation: Operation to be performed on the resource. - :type operation: str - :param description: Description of the operation to be performed. - :type description: str + :ivar provider: Provider name. + :vartype provider: str + :ivar resource: The type of resource in which the operation is performed. + :vartype resource: str + :ivar operation: Operation to be performed on the resource. + :vartype operation: str + :ivar description: Description of the operation to be performed. + :vartype description: str """ _attribute_map = { @@ -3641,6 +4190,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Provider name. + :paramtype provider: str + :keyword resource: The type of resource in which the operation is performed. + :paramtype resource: str + :keyword operation: Operation to be performed on the resource. + :paramtype operation: str + :keyword description: Description of the operation to be performed. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -3653,10 +4212,10 @@ class OperationsList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The value. - :type value: list[~azure.mgmt.databoxedge.v2020_12_01.models.Operation] - :param next_link: Link to the next set of results. - :type next_link: str + :ivar value: Required. The value. + :vartype value: list[~azure.mgmt.databoxedge.v2020_12_01.models.Operation] + :ivar next_link: Link to the next set of results. + :vartype next_link: str """ _validation = { @@ -3675,6 +4234,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The value. + :paramtype value: list[~azure.mgmt.databoxedge.v2020_12_01.models.Operation] + :keyword next_link: Link to the next set of results. + :paramtype next_link: str + """ super(OperationsList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3691,10 +4256,10 @@ class Order(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param contact_information: The contact details. - :type contact_information: ~azure.mgmt.databoxedge.v2020_12_01.models.ContactDetails - :param shipping_address: The shipping address. - :type shipping_address: ~azure.mgmt.databoxedge.v2020_12_01.models.Address + :ivar contact_information: The contact details. + :vartype contact_information: ~azure.mgmt.databoxedge.v2020_12_01.models.ContactDetails + :ivar shipping_address: The shipping address. + :vartype shipping_address: ~azure.mgmt.databoxedge.v2020_12_01.models.Address :ivar current_status: Current status of the order. :vartype current_status: ~azure.mgmt.databoxedge.v2020_12_01.models.OrderStatus :ivar order_history: List of status changes in the order. @@ -3707,9 +4272,9 @@ class Order(ARMBaseModel): :ivar return_tracking_info: Tracking information for the package returned from the customer whether it has an original or a replacement device. :vartype return_tracking_info: list[~azure.mgmt.databoxedge.v2020_12_01.models.TrackingInfo] - :param shipment_type: ShipmentType of the order. Possible values include: "NotApplicable", + :ivar shipment_type: ShipmentType of the order. Possible values include: "NotApplicable", "ShippedToCustomer", "SelfPickup". - :type shipment_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.ShipmentType + :vartype shipment_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.ShipmentType """ _validation = { @@ -3745,6 +4310,15 @@ def __init__( shipment_type: Optional[Union[str, "ShipmentType"]] = None, **kwargs ): + """ + :keyword contact_information: The contact details. + :paramtype contact_information: ~azure.mgmt.databoxedge.v2020_12_01.models.ContactDetails + :keyword shipping_address: The shipping address. + :paramtype shipping_address: ~azure.mgmt.databoxedge.v2020_12_01.models.Address + :keyword shipment_type: ShipmentType of the order. Possible values include: "NotApplicable", + "ShippedToCustomer", "SelfPickup". + :paramtype shipment_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.ShipmentType + """ super(Order, self).__init__(**kwargs) self.contact_information = contact_information self.shipping_address = shipping_address @@ -3781,6 +4355,8 @@ def __init__( self, **kwargs ): + """ + """ super(OrderList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3793,16 +4369,16 @@ class OrderStatus(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param status: Required. Status of the order as per the allowed status types. Possible values + :ivar status: Required. Status of the order as per the allowed status types. Possible values include: "Untracked", "AwaitingFulfilment", "AwaitingPreparation", "AwaitingShipment", "Shipped", "Arriving", "Delivered", "ReplacementRequested", "LostDevice", "Declined", "ReturnInitiated", "AwaitingReturnShipment", "ShippedBack", "CollectedAtMicrosoft", "AwaitingPickup", "PickupCompleted", "AwaitingDrop". - :type status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.OrderState + :vartype status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.OrderState :ivar update_date_time: Time of status update. :vartype update_date_time: ~datetime.datetime - :param comments: Comments related to this status change. - :type comments: str + :ivar comments: Comments related to this status change. + :vartype comments: str :ivar tracking_information: Tracking information related to the state in the ordering flow. :vartype tracking_information: ~azure.mgmt.databoxedge.v2020_12_01.models.TrackingInfo :ivar additional_order_details: Dictionary to hold generic information which is not stored @@ -3832,6 +4408,16 @@ def __init__( comments: Optional[str] = None, **kwargs ): + """ + :keyword status: Required. Status of the order as per the allowed status types. Possible values + include: "Untracked", "AwaitingFulfilment", "AwaitingPreparation", "AwaitingShipment", + "Shipped", "Arriving", "Delivered", "ReplacementRequested", "LostDevice", "Declined", + "ReturnInitiated", "AwaitingReturnShipment", "ShippedBack", "CollectedAtMicrosoft", + "AwaitingPickup", "PickupCompleted", "AwaitingDrop". + :paramtype status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.OrderState + :keyword comments: Comments related to this status change. + :paramtype comments: str + """ super(OrderStatus, self).__init__(**kwargs) self.status = status self.update_date_time = None @@ -3855,17 +4441,17 @@ class PeriodicTimerEventTrigger(Trigger): :vartype type: str :ivar system_data: Trigger in DataBoxEdge Resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: + :ivar kind: Required. Trigger Kind.Constant filled by server. Possible values include: "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.TriggerEventType - :param source_info: Required. Periodic timer details. - :type source_info: ~azure.mgmt.databoxedge.v2020_12_01.models.PeriodicTimerSourceInfo - :param sink_info: Required. Role Sink information. - :type sink_info: ~azure.mgmt.databoxedge.v2020_12_01.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_12_01.models.TriggerEventType + :ivar source_info: Required. Periodic timer details. + :vartype source_info: ~azure.mgmt.databoxedge.v2020_12_01.models.PeriodicTimerSourceInfo + :ivar sink_info: Required. Role Sink information. + :vartype sink_info: ~azure.mgmt.databoxedge.v2020_12_01.models.RoleSinkInfo + :ivar custom_context_tag: A custom context tag typically used to correlate the trigger against its usage. For example, if a periodic timer trigger is intended for certain specific IoT modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str + :vartype custom_context_tag: str """ _validation = { @@ -3898,6 +4484,16 @@ def __init__( custom_context_tag: Optional[str] = None, **kwargs ): + """ + :keyword source_info: Required. Periodic timer details. + :paramtype source_info: ~azure.mgmt.databoxedge.v2020_12_01.models.PeriodicTimerSourceInfo + :keyword sink_info: Required. Role Sink information. + :paramtype sink_info: ~azure.mgmt.databoxedge.v2020_12_01.models.RoleSinkInfo + :keyword custom_context_tag: A custom context tag typically used to correlate the trigger + against its usage. For example, if a periodic timer trigger is intended for certain specific + IoT modules in the device, the tag can be the name or the image URL of the module. + :paramtype custom_context_tag: str + """ super(PeriodicTimerEventTrigger, self).__init__(**kwargs) self.kind = 'PeriodicTimerEvent' # type: str self.source_info = source_info @@ -3910,15 +4506,15 @@ class PeriodicTimerSourceInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param start_time: Required. The time of the day that results in a valid trigger. Schedule is + :ivar start_time: Required. The time of the day that results in a valid trigger. Schedule is computed with reference to the time specified upto seconds. If timezone is not specified the time will considered to be in device timezone. The value will always be returned as UTC time. - :type start_time: ~datetime.datetime - :param schedule: Required. Periodic frequency at which timer event needs to be raised. Supports + :vartype start_time: ~datetime.datetime + :ivar schedule: Required. Periodic frequency at which timer event needs to be raised. Supports daily, hourly, minutes, and seconds. - :type schedule: str - :param topic: Topic where periodic events are published to IoT device. - :type topic: str + :vartype schedule: str + :ivar topic: Topic where periodic events are published to IoT device. + :vartype topic: str """ _validation = { @@ -3940,6 +4536,17 @@ def __init__( topic: Optional[str] = None, **kwargs ): + """ + :keyword start_time: Required. The time of the day that results in a valid trigger. Schedule is + computed with reference to the time specified upto seconds. If timezone is not specified the + time will considered to be in device timezone. The value will always be returned as UTC time. + :paramtype start_time: ~datetime.datetime + :keyword schedule: Required. Periodic frequency at which timer event needs to be raised. + Supports daily, hourly, minutes, and seconds. + :paramtype schedule: str + :keyword topic: Topic where periodic events are published to IoT device. + :paramtype topic: str + """ super(PeriodicTimerSourceInfo, self).__init__(**kwargs) self.start_time = start_time self.schedule = schedule @@ -3949,21 +4556,21 @@ def __init__( class RefreshDetails(msrest.serialization.Model): """Fields for tracking refresh job on the share or container. - :param in_progress_refresh_job_id: If a refresh job is currently in progress on this share or + :ivar in_progress_refresh_job_id: If a refresh job is currently in progress on this share or container, this field indicates the ARM resource ID of that job. The field is empty if no job is in progress. - :type in_progress_refresh_job_id: str - :param last_completed_refresh_job_time_in_utc: Indicates the completed time for the last - refresh job on this particular share or container, if any.This could be a failed job or a - successful job. - :type last_completed_refresh_job_time_in_utc: ~datetime.datetime - :param error_manifest_file: Indicates the relative path of the error xml for the last refresh + :vartype in_progress_refresh_job_id: str + :ivar last_completed_refresh_job_time_in_utc: Indicates the completed time for the last refresh + job on this particular share or container, if any.This could be a failed job or a successful + job. + :vartype last_completed_refresh_job_time_in_utc: ~datetime.datetime + :ivar error_manifest_file: Indicates the relative path of the error xml for the last refresh job on this particular share or container, if any. This could be a failed job or a successful job. - :type error_manifest_file: str - :param last_job: Indicates the id of the last refresh job on this particular share or + :vartype error_manifest_file: str + :ivar last_job: Indicates the id of the last refresh job on this particular share or container,if any. This could be a failed job or a successful job. - :type last_job: str + :vartype last_job: str """ _attribute_map = { @@ -3982,6 +4589,23 @@ def __init__( last_job: Optional[str] = None, **kwargs ): + """ + :keyword in_progress_refresh_job_id: If a refresh job is currently in progress on this share or + container, this field indicates the ARM resource ID of that job. The field is empty if no job + is in progress. + :paramtype in_progress_refresh_job_id: str + :keyword last_completed_refresh_job_time_in_utc: Indicates the completed time for the last + refresh job on this particular share or container, if any.This could be a failed job or a + successful job. + :paramtype last_completed_refresh_job_time_in_utc: ~datetime.datetime + :keyword error_manifest_file: Indicates the relative path of the error xml for the last refresh + job on this particular share or container, if any. This could be a failed job or a successful + job. + :paramtype error_manifest_file: str + :keyword last_job: Indicates the id of the last refresh job on this particular share or + container,if any. This could be a failed job or a successful job. + :paramtype last_job: str + """ super(RefreshDetails, self).__init__(**kwargs) self.in_progress_refresh_job_id = in_progress_refresh_job_id self.last_completed_refresh_job_time_in_utc = last_completed_refresh_job_time_in_utc @@ -3994,8 +4618,8 @@ class ResourceIdentity(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param type: Identity type. Possible values include: "None", "SystemAssigned", "UserAssigned". - :type type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.MsiIdentityType + :ivar type: Identity type. Possible values include: "None", "SystemAssigned", "UserAssigned". + :vartype type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.MsiIdentityType :ivar principal_id: Service Principal Id backing the Msi. :vartype principal_id: str :ivar tenant_id: Home Tenant Id. @@ -4019,6 +4643,11 @@ def __init__( type: Optional[Union[str, "MsiIdentityType"]] = None, **kwargs ): + """ + :keyword type: Identity type. Possible values include: "None", "SystemAssigned", + "UserAssigned". + :paramtype type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.MsiIdentityType + """ super(ResourceIdentity, self).__init__(**kwargs) self.type = type self.principal_id = None @@ -4028,13 +4657,13 @@ def __init__( class ResourceMoveDetails(msrest.serialization.Model): """Fields for tracking resource move. - :param operation_in_progress: Denotes whether move operation is in progress. Possible values + :ivar operation_in_progress: Denotes whether move operation is in progress. Possible values include: "None", "ResourceMoveInProgress", "ResourceMoveFailed". - :type operation_in_progress: str or + :vartype operation_in_progress: str or ~azure.mgmt.databoxedge.v2020_12_01.models.ResourceMoveStatus - :param operation_in_progress_lock_timeout_in_utc: Denotes the timeout of the operation to + :ivar operation_in_progress_lock_timeout_in_utc: Denotes the timeout of the operation to finish. - :type operation_in_progress_lock_timeout_in_utc: ~datetime.datetime + :vartype operation_in_progress_lock_timeout_in_utc: ~datetime.datetime """ _attribute_map = { @@ -4049,6 +4678,15 @@ def __init__( operation_in_progress_lock_timeout_in_utc: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword operation_in_progress: Denotes whether move operation is in progress. Possible values + include: "None", "ResourceMoveInProgress", "ResourceMoveFailed". + :paramtype operation_in_progress: str or + ~azure.mgmt.databoxedge.v2020_12_01.models.ResourceMoveStatus + :keyword operation_in_progress_lock_timeout_in_utc: Denotes the timeout of the operation to + finish. + :paramtype operation_in_progress_lock_timeout_in_utc: ~datetime.datetime + """ super(ResourceMoveDetails, self).__init__(**kwargs) self.operation_in_progress = operation_in_progress self.operation_in_progress_lock_timeout_in_utc = operation_in_progress_lock_timeout_in_utc @@ -4079,6 +4717,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceTypeSku, self).__init__(**kwargs) self.resource_type = None self.skus = None @@ -4109,6 +4749,8 @@ def __init__( self, **kwargs ): + """ + """ super(RoleList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4119,8 +4761,8 @@ class RoleSinkInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param role_id: Required. Compute role ID. - :type role_id: str + :ivar role_id: Required. Compute role ID. + :vartype role_id: str """ _validation = { @@ -4137,6 +4779,10 @@ def __init__( role_id: str, **kwargs ): + """ + :keyword role_id: Required. Compute role ID. + :paramtype role_id: str + """ super(RoleSinkInfo, self).__init__(**kwargs) self.role_id = role_id @@ -4144,11 +4790,11 @@ def __init__( class Secret(msrest.serialization.Model): """Holds device secret either as a KeyVault reference or as an encrypted value. - :param encrypted_secret: Encrypted (using device public key) secret value. - :type encrypted_secret: ~azure.mgmt.databoxedge.v2020_12_01.models.AsymmetricEncryptedSecret - :param key_vault_id: Id of the Key-Vault where secret is stored (ex: + :ivar encrypted_secret: Encrypted (using device public key) secret value. + :vartype encrypted_secret: ~azure.mgmt.databoxedge.v2020_12_01.models.AsymmetricEncryptedSecret + :ivar key_vault_id: Id of the Key-Vault where secret is stored (ex: secrets/AuthClientSecret/82ef4346187a4033a10d629cde07d740). - :type key_vault_id: str + :vartype key_vault_id: str """ _attribute_map = { @@ -4163,6 +4809,14 @@ def __init__( key_vault_id: Optional[str] = None, **kwargs ): + """ + :keyword encrypted_secret: Encrypted (using device public key) secret value. + :paramtype encrypted_secret: + ~azure.mgmt.databoxedge.v2020_12_01.models.AsymmetricEncryptedSecret + :keyword key_vault_id: Id of the Key-Vault where secret is stored (ex: + secrets/AuthClientSecret/82ef4346187a4033a10d629cde07d740). + :paramtype key_vault_id: str + """ super(Secret, self).__init__(**kwargs) self.encrypted_secret = encrypted_secret self.key_vault_id = key_vault_id @@ -4181,11 +4835,11 @@ class SecuritySettings(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param device_admin_password: Required. Device administrator password as an encrypted string + :ivar device_admin_password: Required. Device administrator password as an encrypted string (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual password should have at least 8 characters that are a combination of uppercase, lowercase, numeric, and special characters. - :type device_admin_password: + :vartype device_admin_password: ~azure.mgmt.databoxedge.v2020_12_01.models.AsymmetricEncryptedSecret """ @@ -4209,6 +4863,14 @@ def __init__( device_admin_password: "AsymmetricEncryptedSecret", **kwargs ): + """ + :keyword device_admin_password: Required. Device administrator password as an encrypted string + (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual + password should have at least 8 characters that are a combination of uppercase, lowercase, + numeric, and special characters. + :paramtype device_admin_password: + ~azure.mgmt.databoxedge.v2020_12_01.models.AsymmetricEncryptedSecret + """ super(SecuritySettings, self).__init__(**kwargs) self.device_admin_password = device_admin_password @@ -4216,8 +4878,8 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """Service specification. - :param metric_specifications: Metric specification as defined by shoebox. - :type metric_specifications: + :ivar metric_specifications: Metric specification as defined by shoebox. + :vartype metric_specifications: list[~azure.mgmt.databoxedge.v2020_12_01.models.MetricSpecificationV1] """ @@ -4231,6 +4893,11 @@ def __init__( metric_specifications: Optional[List["MetricSpecificationV1"]] = None, **kwargs ): + """ + :keyword metric_specifications: Metric specification as defined by shoebox. + :paramtype metric_specifications: + list[~azure.mgmt.databoxedge.v2020_12_01.models.MetricSpecificationV1] + """ super(ServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications @@ -4250,31 +4917,32 @@ class Share(ARMBaseModel): :vartype type: str :ivar system_data: Share on ASE device. :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - :param description: Description for the share. - :type description: str - :param share_status: Required. Current status of the share. Possible values include: "Offline", + :ivar description: Description for the share. + :vartype description: str + :ivar share_status: Required. Current status of the share. Possible values include: "Offline", "Unknown", "OK", "Updating", "NeedsAttention". - :type share_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.ShareStatus - :param monitoring_status: Required. Current monitoring status of the share. Possible values + :vartype share_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.ShareStatus + :ivar monitoring_status: Required. Current monitoring status of the share. Possible values include: "Enabled", "Disabled". - :type monitoring_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.MonitoringStatus - :param azure_container_info: Azure container mapping for the share. - :type azure_container_info: ~azure.mgmt.databoxedge.v2020_12_01.models.AzureContainerInfo - :param access_protocol: Required. Access protocol to be used by the share. Possible values + :vartype monitoring_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.MonitoringStatus + :ivar azure_container_info: Azure container mapping for the share. + :vartype azure_container_info: ~azure.mgmt.databoxedge.v2020_12_01.models.AzureContainerInfo + :ivar access_protocol: Required. Access protocol to be used by the share. Possible values include: "SMB", "NFS". - :type access_protocol: str or ~azure.mgmt.databoxedge.v2020_12_01.models.ShareAccessProtocol - :param user_access_rights: Mapping of users and corresponding access rights on the share + :vartype access_protocol: str or ~azure.mgmt.databoxedge.v2020_12_01.models.ShareAccessProtocol + :ivar user_access_rights: Mapping of users and corresponding access rights on the share (required for SMB protocol). - :type user_access_rights: list[~azure.mgmt.databoxedge.v2020_12_01.models.UserAccessRight] - :param client_access_rights: List of IP addresses and corresponding access rights on the + :vartype user_access_rights: list[~azure.mgmt.databoxedge.v2020_12_01.models.UserAccessRight] + :ivar client_access_rights: List of IP addresses and corresponding access rights on the share(required for NFS protocol). - :type client_access_rights: list[~azure.mgmt.databoxedge.v2020_12_01.models.ClientAccessRight] - :param refresh_details: Details of the refresh job on this share. - :type refresh_details: ~azure.mgmt.databoxedge.v2020_12_01.models.RefreshDetails + :vartype client_access_rights: + list[~azure.mgmt.databoxedge.v2020_12_01.models.ClientAccessRight] + :ivar refresh_details: Details of the refresh job on this share. + :vartype refresh_details: ~azure.mgmt.databoxedge.v2020_12_01.models.RefreshDetails :ivar share_mappings: Share mount point to the role. :vartype share_mappings: list[~azure.mgmt.databoxedge.v2020_12_01.models.MountPointMap] - :param data_policy: Data policy of the share. Possible values include: "Cloud", "Local". - :type data_policy: str or ~azure.mgmt.databoxedge.v2020_12_01.models.DataPolicy + :ivar data_policy: Data policy of the share. Possible values include: "Cloud", "Local". + :vartype data_policy: str or ~azure.mgmt.databoxedge.v2020_12_01.models.DataPolicy """ _validation = { @@ -4319,6 +4987,34 @@ def __init__( data_policy: Optional[Union[str, "DataPolicy"]] = None, **kwargs ): + """ + :keyword description: Description for the share. + :paramtype description: str + :keyword share_status: Required. Current status of the share. Possible values include: + "Offline", "Unknown", "OK", "Updating", "NeedsAttention". + :paramtype share_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.ShareStatus + :keyword monitoring_status: Required. Current monitoring status of the share. Possible values + include: "Enabled", "Disabled". + :paramtype monitoring_status: str or + ~azure.mgmt.databoxedge.v2020_12_01.models.MonitoringStatus + :keyword azure_container_info: Azure container mapping for the share. + :paramtype azure_container_info: ~azure.mgmt.databoxedge.v2020_12_01.models.AzureContainerInfo + :keyword access_protocol: Required. Access protocol to be used by the share. Possible values + include: "SMB", "NFS". + :paramtype access_protocol: str or + ~azure.mgmt.databoxedge.v2020_12_01.models.ShareAccessProtocol + :keyword user_access_rights: Mapping of users and corresponding access rights on the share + (required for SMB protocol). + :paramtype user_access_rights: list[~azure.mgmt.databoxedge.v2020_12_01.models.UserAccessRight] + :keyword client_access_rights: List of IP addresses and corresponding access rights on the + share(required for NFS protocol). + :paramtype client_access_rights: + list[~azure.mgmt.databoxedge.v2020_12_01.models.ClientAccessRight] + :keyword refresh_details: Details of the refresh job on this share. + :paramtype refresh_details: ~azure.mgmt.databoxedge.v2020_12_01.models.RefreshDetails + :keyword data_policy: Data policy of the share. Possible values include: "Cloud", "Local". + :paramtype data_policy: str or ~azure.mgmt.databoxedge.v2020_12_01.models.DataPolicy + """ super(Share, self).__init__(**kwargs) self.system_data = None self.description = description @@ -4338,11 +5034,11 @@ class ShareAccessRight(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param share_id: Required. The share ID. - :type share_id: str - :param access_type: Required. Type of access to be allowed on the share for this user. Possible + :ivar share_id: Required. The share ID. + :vartype share_id: str + :ivar access_type: Required. Type of access to be allowed on the share for this user. Possible values include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.ShareAccessType + :vartype access_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.ShareAccessType """ _validation = { @@ -4362,6 +5058,13 @@ def __init__( access_type: Union[str, "ShareAccessType"], **kwargs ): + """ + :keyword share_id: Required. The share ID. + :paramtype share_id: str + :keyword access_type: Required. Type of access to be allowed on the share for this user. + Possible values include: "Change", "Read", "Custom". + :paramtype access_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.ShareAccessType + """ super(ShareAccessRight, self).__init__(**kwargs) self.share_id = share_id self.access_type = access_type @@ -4392,6 +5095,8 @@ def __init__( self, **kwargs ): + """ + """ super(ShareList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4400,13 +5105,13 @@ def __init__( class Sku(msrest.serialization.Model): """The SKU type. - :param name: SKU name. Possible values include: "Gateway", "Edge", "TEA_1Node", - "TEA_1Node_UPS", "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", - "TEA_4Node_UPS_Heater", "TMA", "TDC", "TCA_Small", "GPU", "TCA_Large", "EdgeP_Base", - "EdgeP_High", "EdgePR_Base", "EdgePR_Base_UPS", "EdgeMR_Mini", "RCA_Small", "RCA_Large", "RDC". - :type name: str or ~azure.mgmt.databoxedge.v2020_12_01.models.SkuName - :param tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard". - :type tier: str or ~azure.mgmt.databoxedge.v2020_12_01.models.SkuTier + :ivar name: SKU name. Possible values include: "Gateway", "Edge", "TEA_1Node", "TEA_1Node_UPS", + "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", "TEA_4Node_UPS_Heater", "TMA", + "TDC", "TCA_Small", "GPU", "TCA_Large", "EdgeP_Base", "EdgeP_High", "EdgePR_Base", + "EdgePR_Base_UPS", "EdgeMR_Mini", "RCA_Small", "RCA_Large", "RDC". + :vartype name: str or ~azure.mgmt.databoxedge.v2020_12_01.models.SkuName + :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard". + :vartype tier: str or ~azure.mgmt.databoxedge.v2020_12_01.models.SkuTier """ _attribute_map = { @@ -4421,6 +5126,16 @@ def __init__( tier: Optional[Union[str, "SkuTier"]] = None, **kwargs ): + """ + :keyword name: SKU name. Possible values include: "Gateway", "Edge", "TEA_1Node", + "TEA_1Node_UPS", "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", + "TEA_4Node_UPS_Heater", "TMA", "TDC", "TCA_Small", "GPU", "TCA_Large", "EdgeP_Base", + "EdgeP_High", "EdgePR_Base", "EdgePR_Base_UPS", "EdgeMR_Mini", "RCA_Small", "RCA_Large", "RDC". + :paramtype name: str or ~azure.mgmt.databoxedge.v2020_12_01.models.SkuName + :keyword tier: The SKU tier. This is based on the SKU name. Possible values include: + "Standard". + :paramtype tier: str or ~azure.mgmt.databoxedge.v2020_12_01.models.SkuTier + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -4451,6 +5166,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuCapability, self).__init__(**kwargs) self.name = None self.value = None @@ -4485,6 +5202,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuCost, self).__init__(**kwargs) self.meter_id = None self.quantity = None @@ -4544,6 +5263,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuInformation, self).__init__(**kwargs) self.name = None self.tier = None @@ -4581,6 +5302,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuInformationList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4615,6 +5338,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuLocationInfo, self).__init__(**kwargs) self.location = None self.zones = None @@ -4636,17 +5361,17 @@ class StorageAccount(ARMBaseModel): :vartype type: str :ivar system_data: StorageAccount object on ASE device. :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - :param description: Description for the storage Account. - :type description: str - :param storage_account_status: Current status of the storage account. Possible values include: + :ivar description: Description for the storage Account. + :vartype description: str + :ivar storage_account_status: Current status of the storage account. Possible values include: "OK", "Offline", "Unknown", "Updating", "NeedsAttention". - :type storage_account_status: str or + :vartype storage_account_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.StorageAccountStatus - :param data_policy: Required. Data policy of the storage Account. Possible values include: + :ivar data_policy: Required. Data policy of the storage Account. Possible values include: "Cloud", "Local". - :type data_policy: str or ~azure.mgmt.databoxedge.v2020_12_01.models.DataPolicy - :param storage_account_credential_id: Storage Account Credential Id. - :type storage_account_credential_id: str + :vartype data_policy: str or ~azure.mgmt.databoxedge.v2020_12_01.models.DataPolicy + :ivar storage_account_credential_id: Storage Account Credential Id. + :vartype storage_account_credential_id: str :ivar blob_endpoint: BlobEndpoint of Storage Account. :vartype blob_endpoint: str :ivar container_count: The Container Count. Present only for Storage Accounts with DataPolicy @@ -4686,6 +5411,19 @@ def __init__( storage_account_credential_id: Optional[str] = None, **kwargs ): + """ + :keyword description: Description for the storage Account. + :paramtype description: str + :keyword storage_account_status: Current status of the storage account. Possible values + include: "OK", "Offline", "Unknown", "Updating", "NeedsAttention". + :paramtype storage_account_status: str or + ~azure.mgmt.databoxedge.v2020_12_01.models.StorageAccountStatus + :keyword data_policy: Required. Data policy of the storage Account. Possible values include: + "Cloud", "Local". + :paramtype data_policy: str or ~azure.mgmt.databoxedge.v2020_12_01.models.DataPolicy + :keyword storage_account_credential_id: Storage Account Credential Id. + :paramtype storage_account_credential_id: str + """ super(StorageAccount, self).__init__(**kwargs) self.system_data = None self.description = description @@ -4711,25 +5449,25 @@ class StorageAccountCredential(ARMBaseModel): :vartype type: str :ivar system_data: StorageAccountCredential object. :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - :param alias: Required. Alias for the storage account. - :type alias: str - :param user_name: Username for the storage account. - :type user_name: str - :param account_key: Encrypted storage key. - :type account_key: ~azure.mgmt.databoxedge.v2020_12_01.models.AsymmetricEncryptedSecret - :param connection_string: Connection string for the storage account. Use this string if - username and account key are not specified. - :type connection_string: str - :param ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible values + :ivar alias: Required. Alias for the storage account. + :vartype alias: str + :ivar user_name: Username for the storage account. + :vartype user_name: str + :ivar account_key: Encrypted storage key. + :vartype account_key: ~azure.mgmt.databoxedge.v2020_12_01.models.AsymmetricEncryptedSecret + :ivar connection_string: Connection string for the storage account. Use this string if username + and account key are not specified. + :vartype connection_string: str + :ivar ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible values include: "Enabled", "Disabled". - :type ssl_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.SSLStatus - :param blob_domain_name: Blob end point for private clouds. - :type blob_domain_name: str - :param account_type: Required. Type of storage accessed on the storage account. Possible values + :vartype ssl_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.SSLStatus + :ivar blob_domain_name: Blob end point for private clouds. + :vartype blob_domain_name: str + :ivar account_type: Required. Type of storage accessed on the storage account. Possible values include: "GeneralPurposeStorage", "BlobStorage". - :type account_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.AccountType - :param storage_account_id: Id of the storage account. - :type storage_account_id: str + :vartype account_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.AccountType + :ivar storage_account_id: Id of the storage account. + :vartype storage_account_id: str """ _validation = { @@ -4770,6 +5508,27 @@ def __init__( storage_account_id: Optional[str] = None, **kwargs ): + """ + :keyword alias: Required. Alias for the storage account. + :paramtype alias: str + :keyword user_name: Username for the storage account. + :paramtype user_name: str + :keyword account_key: Encrypted storage key. + :paramtype account_key: ~azure.mgmt.databoxedge.v2020_12_01.models.AsymmetricEncryptedSecret + :keyword connection_string: Connection string for the storage account. Use this string if + username and account key are not specified. + :paramtype connection_string: str + :keyword ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible + values include: "Enabled", "Disabled". + :paramtype ssl_status: str or ~azure.mgmt.databoxedge.v2020_12_01.models.SSLStatus + :keyword blob_domain_name: Blob end point for private clouds. + :paramtype blob_domain_name: str + :keyword account_type: Required. Type of storage accessed on the storage account. Possible + values include: "GeneralPurposeStorage", "BlobStorage". + :paramtype account_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.AccountType + :keyword storage_account_id: Id of the storage account. + :paramtype storage_account_id: str + """ super(StorageAccountCredential, self).__init__(**kwargs) self.system_data = None self.alias = alias @@ -4807,6 +5566,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountCredentialList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4837,6 +5598,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4845,10 +5608,10 @@ def __init__( class SubscriptionRegisteredFeatures(msrest.serialization.Model): """SubscriptionRegisteredFeatures. - :param name: - :type name: str - :param state: - :type state: str + :ivar name: + :vartype name: str + :ivar state: + :vartype state: str """ _attribute_map = { @@ -4863,6 +5626,12 @@ def __init__( state: Optional[str] = None, **kwargs ): + """ + :keyword name: + :paramtype name: str + :keyword state: + :paramtype state: str + """ super(SubscriptionRegisteredFeatures, self).__init__(**kwargs) self.name = name self.state = state @@ -4871,8 +5640,9 @@ def __init__( class SymmetricKey(msrest.serialization.Model): """Symmetric key for authentication. - :param connection_string: Connection string based on the symmetric key. - :type connection_string: ~azure.mgmt.databoxedge.v2020_12_01.models.AsymmetricEncryptedSecret + :ivar connection_string: Connection string based on the symmetric key. + :vartype connection_string: + ~azure.mgmt.databoxedge.v2020_12_01.models.AsymmetricEncryptedSecret """ _attribute_map = { @@ -4885,6 +5655,11 @@ def __init__( connection_string: Optional["AsymmetricEncryptedSecret"] = None, **kwargs ): + """ + :keyword connection_string: Connection string based on the symmetric key. + :paramtype connection_string: + ~azure.mgmt.databoxedge.v2020_12_01.models.AsymmetricEncryptedSecret + """ super(SymmetricKey, self).__init__(**kwargs) self.connection_string = connection_string @@ -4892,20 +5667,20 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.CreatedByType - :param last_modified_at: The type of identity that last modified the resource. - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.CreatedByType + :ivar last_modified_at: The type of identity that last modified the resource. + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -4928,6 +5703,23 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.databoxedge.v2020_12_01.models.CreatedByType + :keyword last_modified_at: The type of identity that last modified the resource. + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -4940,14 +5732,14 @@ def __init__( class TrackingInfo(msrest.serialization.Model): """Tracking courier information. - :param serial_number: Serial number of the device being tracked. - :type serial_number: str - :param carrier_name: Name of the carrier used in the delivery. - :type carrier_name: str - :param tracking_id: Tracking ID of the shipment. - :type tracking_id: str - :param tracking_url: Tracking URL of the shipment. - :type tracking_url: str + :ivar serial_number: Serial number of the device being tracked. + :vartype serial_number: str + :ivar carrier_name: Name of the carrier used in the delivery. + :vartype carrier_name: str + :ivar tracking_id: Tracking ID of the shipment. + :vartype tracking_id: str + :ivar tracking_url: Tracking URL of the shipment. + :vartype tracking_url: str """ _attribute_map = { @@ -4966,6 +5758,16 @@ def __init__( tracking_url: Optional[str] = None, **kwargs ): + """ + :keyword serial_number: Serial number of the device being tracked. + :paramtype serial_number: str + :keyword carrier_name: Name of the carrier used in the delivery. + :paramtype carrier_name: str + :keyword tracking_id: Tracking ID of the shipment. + :paramtype tracking_id: str + :keyword tracking_url: Tracking URL of the shipment. + :paramtype tracking_url: str + """ super(TrackingInfo, self).__init__(**kwargs) self.serial_number = serial_number self.carrier_name = carrier_name @@ -4998,6 +5800,8 @@ def __init__( self, **kwargs ): + """ + """ super(TriggerList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -5045,6 +5849,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateDownloadProgress, self).__init__(**kwargs) self.download_phase = None self.percent_complete = None @@ -5083,6 +5889,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateInstallProgress, self).__init__(**kwargs) self.percent_complete = None self.number_of_updates_to_install = None @@ -5100,15 +5908,15 @@ class UpdateSummary(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param device_version_number: The current version of the device in format: 1.2.17312.13.",. - :type device_version_number: str - :param friendly_device_version_name: The current version of the device in text format. - :type friendly_device_version_name: str - :param device_last_scanned_date_time: The last time when a scan was done on the device. - :type device_last_scanned_date_time: ~datetime.datetime - :param last_completed_scan_job_date_time: The time when the last scan job was completed + :ivar device_version_number: The current version of the device in format: 1.2.17312.13.",. + :vartype device_version_number: str + :ivar friendly_device_version_name: The current version of the device in text format. + :vartype friendly_device_version_name: str + :ivar device_last_scanned_date_time: The last time when a scan was done on the device. + :vartype device_last_scanned_date_time: ~datetime.datetime + :ivar last_completed_scan_job_date_time: The time when the last scan job was completed (success/cancelled/failed) on the appliance. - :type last_completed_scan_job_date_time: ~datetime.datetime + :vartype last_completed_scan_job_date_time: ~datetime.datetime :ivar last_completed_download_job_date_time: The time when the last Download job was completed (success/cancelled/failed) on the appliance. :vartype last_completed_download_job_date_time: ~datetime.datetime @@ -5197,6 +6005,17 @@ def __init__( last_completed_scan_job_date_time: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword device_version_number: The current version of the device in format: 1.2.17312.13.",. + :paramtype device_version_number: str + :keyword friendly_device_version_name: The current version of the device in text format. + :paramtype friendly_device_version_name: str + :keyword device_last_scanned_date_time: The last time when a scan was done on the device. + :paramtype device_last_scanned_date_time: ~datetime.datetime + :keyword last_completed_scan_job_date_time: The time when the last scan job was completed + (success/cancelled/failed) on the appliance. + :paramtype last_completed_scan_job_date_time: ~datetime.datetime + """ super(UpdateSummary, self).__init__(**kwargs) self.device_version_number = device_version_number self.friendly_device_version_name = friendly_device_version_name @@ -5222,11 +6041,12 @@ class UploadCertificateRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param authentication_type: The authentication type. Possible values include: "Invalid", + :ivar authentication_type: The authentication type. Possible values include: "Invalid", "AzureActiveDirectory". - :type authentication_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.AuthenticationType - :param certificate: Required. The base64 encoded certificate raw data. - :type certificate: str + :vartype authentication_type: str or + ~azure.mgmt.databoxedge.v2020_12_01.models.AuthenticationType + :ivar certificate: Required. The base64 encoded certificate raw data. + :vartype certificate: str """ _validation = { @@ -5245,6 +6065,14 @@ def __init__( authentication_type: Optional[Union[str, "AuthenticationType"]] = None, **kwargs ): + """ + :keyword authentication_type: The authentication type. Possible values include: "Invalid", + "AzureActiveDirectory". + :paramtype authentication_type: str or + ~azure.mgmt.databoxedge.v2020_12_01.models.AuthenticationType + :keyword certificate: Required. The base64 encoded certificate raw data. + :paramtype certificate: str + """ super(UploadCertificateRequest, self).__init__(**kwargs) self.authentication_type = authentication_type self.certificate = certificate @@ -5255,9 +6083,9 @@ class UploadCertificateResponse(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param auth_type: Specifies authentication type. Possible values include: "Invalid", + :ivar auth_type: Specifies authentication type. Possible values include: "Invalid", "AzureActiveDirectory". - :type auth_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.AuthenticationType + :vartype auth_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.AuthenticationType :ivar resource_id: The resource ID of the Data Box Edge/Gateway device. :vartype resource_id: str :ivar aad_authority: Azure Active Directory tenant authority. @@ -5302,6 +6130,11 @@ def __init__( auth_type: Optional[Union[str, "AuthenticationType"]] = None, **kwargs ): + """ + :keyword auth_type: Specifies authentication type. Possible values include: "Invalid", + "AzureActiveDirectory". + :paramtype auth_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.AuthenticationType + """ super(UploadCertificateResponse, self).__init__(**kwargs) self.auth_type = auth_type self.resource_id = None @@ -5328,14 +6161,15 @@ class User(ARMBaseModel): :vartype type: str :ivar system_data: User in DataBoxEdge Resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_12_01.models.SystemData - :param encrypted_password: The password details. - :type encrypted_password: ~azure.mgmt.databoxedge.v2020_12_01.models.AsymmetricEncryptedSecret + :ivar encrypted_password: The password details. + :vartype encrypted_password: + ~azure.mgmt.databoxedge.v2020_12_01.models.AsymmetricEncryptedSecret :ivar share_access_rights: List of shares that the user has rights on. This field should not be specified during user creation. :vartype share_access_rights: list[~azure.mgmt.databoxedge.v2020_12_01.models.ShareAccessRight] - :param user_type: Required. Type of the user. Possible values include: "Share", + :ivar user_type: Required. Type of the user. Possible values include: "Share", "LocalManagement", "ARM". - :type user_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.UserType + :vartype user_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.UserType """ _validation = { @@ -5364,6 +6198,14 @@ def __init__( encrypted_password: Optional["AsymmetricEncryptedSecret"] = None, **kwargs ): + """ + :keyword encrypted_password: The password details. + :paramtype encrypted_password: + ~azure.mgmt.databoxedge.v2020_12_01.models.AsymmetricEncryptedSecret + :keyword user_type: Required. Type of the user. Possible values include: "Share", + "LocalManagement", "ARM". + :paramtype user_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.UserType + """ super(User, self).__init__(**kwargs) self.system_data = None self.encrypted_password = encrypted_password @@ -5376,11 +6218,11 @@ class UserAccessRight(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param user_id: Required. User ID (already existing in the device). - :type user_id: str - :param access_type: Required. Type of access to be allowed for the user. Possible values + :ivar user_id: Required. User ID (already existing in the device). + :vartype user_id: str + :ivar access_type: Required. Type of access to be allowed for the user. Possible values include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.ShareAccessType + :vartype access_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.ShareAccessType """ _validation = { @@ -5400,6 +6242,13 @@ def __init__( access_type: Union[str, "ShareAccessType"], **kwargs ): + """ + :keyword user_id: Required. User ID (already existing in the device). + :paramtype user_id: str + :keyword access_type: Required. Type of access to be allowed for the user. Possible values + include: "Change", "Read", "Custom". + :paramtype access_type: str or ~azure.mgmt.databoxedge.v2020_12_01.models.ShareAccessType + """ super(UserAccessRight, self).__init__(**kwargs) self.user_id = user_id self.access_type = access_type @@ -5430,6 +6279,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserList, self).__init__(**kwargs) self.value = None self.next_link = None diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_addons_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_addons_operations.py index 09c62f5d0066..00989074cb5f 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_addons_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_addons_operations.py @@ -5,25 +5,191 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_role_request( + device_name: str, + role_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + role_name: str, + addon_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "addonName": _SERIALIZER.url("addon_name", addon_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + role_name: str, + addon_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "addonName": _SERIALIZER.url("addon_name", addon_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + role_name: str, + addon_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "addonName": _SERIALIZER.url("addon_name", addon_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AddonsOperations(object): """AddonsOperations operations. @@ -47,14 +213,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_role( self, - device_name, # type: str - role_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AddonList"] + device_name: str, + role_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.AddonList"]: """Lists all the addons configured in the role. :param device_name: The device name. @@ -73,37 +239,35 @@ def list_by_role( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_role.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_role_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_role.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_role_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AddonList', pipeline_response) + deserialized = self._deserialize("AddonList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -121,20 +285,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_role.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - role_name, # type: str - addon_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Addon" + device_name: str, + role_name: str, + addon_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Addon": """Gets a specific addon by name. :param device_name: The device name. @@ -155,29 +320,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -191,51 +346,42 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - role_name, # type: str - addon_name, # type: str - resource_group_name, # type: str - addon, # type: "_models.Addon" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Addon"] + device_name: str, + role_name: str, + addon_name: str, + resource_group_name: str, + addon: "_models.Addon", + **kwargs: Any + ) -> Optional["_models.Addon"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Addon"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(addon, 'Addon') + + request = build_create_or_update_request_initial( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(addon, 'Addon') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -251,18 +397,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - role_name, # type: str - addon_name, # type: str - resource_group_name, # type: str - addon, # type: "_models.Addon" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Addon"] + device_name: str, + role_name: str, + addon_name: str, + resource_group_name: str, + addon: "_models.Addon", + **kwargs: Any + ) -> LROPoller["_models.Addon"]: """Create or update a addon. :param device_name: The device name. @@ -277,15 +425,18 @@ def begin_create_or_update( :type addon: ~azure.mgmt.databoxedge.v2020_12_01.models.Addon :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Addon or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.Addon] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Addon"] lro_delay = kwargs.pop( 'polling_interval', @@ -299,29 +450,21 @@ def begin_create_or_update( addon_name=addon_name, resource_group_name=resource_group_name, addon=addon, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Addon', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -333,45 +476,35 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore def _delete_initial( self, - device_name, # type: str - role_name, # type: str - addon_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + role_name: str, + addon_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -384,15 +517,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - role_name, # type: str - addon_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + role_name: str, + addon_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the addon on the device. :param device_name: The device name. @@ -405,15 +539,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -429,23 +565,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -457,4 +584,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_alerts_operations.py index f77ba9c4b82e..64235be8bae9 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_alerts_operations.py @@ -5,23 +5,97 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AlertsOperations(object): """AlertsOperations operations. @@ -45,13 +119,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AlertList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.AlertList"]: """Gets all the alerts for a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -68,36 +142,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AlertList', pipeline_response) + deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,19 +186,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Alert" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Alert": """Gets an alert by name. Gets an alert by name. @@ -148,28 +220,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,4 +245,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_available_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_available_skus_operations.py index 36b72ea14e57..e5125f930c97 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_available_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_available_skus_operations.py @@ -5,23 +5,56 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/availableSkus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AvailableSkusOperations(object): """AvailableSkusOperations operations. @@ -45,18 +78,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DataBoxEdgeSkuList"] + **kwargs: Any + ) -> Iterable["_models.DataBoxEdgeSkuList"]: """List all the available Skus and information related to them. List all the available Skus and information related to them. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DataBoxEdgeSkuList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.DataBoxEdgeSkuList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.DataBoxEdgeSkuList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeSkuList"] @@ -64,34 +98,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeSkuList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeSkuList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -109,6 +138,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_bandwidth_schedules_operations.py index 3d7a92ff7fdb..294290a4f35c 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_bandwidth_schedules_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class BandwidthSchedulesOperations(object): """BandwidthSchedulesOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BandwidthSchedulesList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.BandwidthSchedulesList"]: """Gets all the bandwidth schedules for a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -61,8 +219,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BandwidthSchedulesList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.BandwidthSchedulesList] + :return: An iterator like instance of either BandwidthSchedulesList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.BandwidthSchedulesList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedulesList"] @@ -70,36 +230,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BandwidthSchedulesList', pipeline_response) + deserialized = self._deserialize("BandwidthSchedulesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,19 +274,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BandwidthSchedule" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.BandwidthSchedule": """Gets the properties of the specified bandwidth schedule. :param device_name: The device name. @@ -148,28 +306,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,49 +331,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.BandwidthSchedule" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.BandwidthSchedule"] + device_name: str, + name: str, + resource_group_name: str, + parameters: "_models.BandwidthSchedule", + **kwargs: Any + ) -> Optional["_models.BandwidthSchedule"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BandwidthSchedule"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BandwidthSchedule') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BandwidthSchedule') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -241,17 +380,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.BandwidthSchedule" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BandwidthSchedule"] + device_name: str, + name: str, + resource_group_name: str, + parameters: "_models.BandwidthSchedule", + **kwargs: Any + ) -> LROPoller["_models.BandwidthSchedule"]: """Creates or updates a bandwidth schedule. :param device_name: The device name. @@ -264,15 +405,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.databoxedge.v2020_12_01.models.BandwidthSchedule :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either BandwidthSchedule or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.BandwidthSchedule] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BandwidthSchedule or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.BandwidthSchedule] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedule"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +431,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BandwidthSchedule', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -318,43 +457,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -367,14 +496,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the specified bandwidth schedule. :param device_name: The device name. @@ -385,15 +515,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -408,22 +540,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -435,4 +559,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_containers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_containers_operations.py index 43552ff41f6d..c48890a92649 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_containers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_containers_operations.py @@ -5,25 +5,230 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_storage_account_request( + device_name: str, + storage_account_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + storage_account_name: str, + container_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + storage_account_name: str, + container_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + storage_account_name: str, + container_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_refresh_request_initial( + device_name: str, + storage_account_name: str, + container_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ContainersOperations(object): """ContainersOperations operations. @@ -47,14 +252,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_storage_account( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ContainerList"] + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ContainerList"]: """Lists all the containers of a storage Account in a Data Box Edge/Data Box Gateway device. Lists all the containers of a storage Account in a Data Box Edge/Data Box Gateway device. @@ -75,37 +280,35 @@ def list_by_storage_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_storage_account.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_account_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_storage_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_account_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ContainerList', pipeline_response) + deserialized = self._deserialize("ContainerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -123,20 +326,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_storage_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Container" + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Container": """Gets a container by name. Gets a container by name. @@ -159,29 +363,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -195,51 +389,42 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - container, # type: "_models.Container" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Container"] + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + container: "_models.Container", + **kwargs: Any + ) -> Optional["_models.Container"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Container"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(container, 'Container') + + request = build_create_or_update_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(container, 'Container') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -255,18 +440,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - container, # type: "_models.Container" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Container"] + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + container: "_models.Container", + **kwargs: Any + ) -> LROPoller["_models.Container"]: """Creates a new container or updates an existing container on the device. Creates a new container or updates an existing container on the device. @@ -283,15 +470,18 @@ def begin_create_or_update( :type container: ~azure.mgmt.databoxedge.v2020_12_01.models.Container :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Container or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.Container] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Container"] lro_delay = kwargs.pop( 'polling_interval', @@ -305,29 +495,21 @@ def begin_create_or_update( container_name=container_name, resource_group_name=resource_group_name, container=container, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Container', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -339,45 +521,35 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore def _delete_initial( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -390,15 +562,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the container on the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -411,15 +584,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -435,23 +610,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -463,45 +629,35 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore def _refresh_initial( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -514,15 +670,16 @@ def _refresh_initial( _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh'} # type: ignore + + @distributed_trace def begin_refresh( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Refreshes the container metadata with the data from the cloud. Refreshes the container metadata with the data from the cloud. @@ -537,15 +694,17 @@ def begin_refresh( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -561,23 +720,14 @@ def begin_refresh( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -589,4 +739,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_devices_operations.py index ff371ee8fd4a..d3dd97c562b8 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_devices_operations.py @@ -5,25 +5,635 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_subscription_request( + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_download_updates_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_generate_certificate_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/generateCertificate') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_extended_information_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_install_updates_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_network_settings_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/networkSettings/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_scan_for_updates_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_security_settings_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_extended_information_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateExtendedInformation') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_update_summary_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_upload_certificate_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/uploadCertificate') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class DevicesOperations(object): """DevicesOperations operations. @@ -47,20 +657,22 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DataBoxEdgeDeviceList"] + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.DataBoxEdgeDeviceList"]: """Gets all the Data Box Edge/Data Box Gateway devices in a subscription. :param expand: Specify $expand=details to populate additional fields related to the resource or Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -68,36 +680,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,18 +722,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DataBoxEdgeDeviceList"] + resource_group_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.DataBoxEdgeDeviceList"]: """Gets all the Data Box Edge/Data Box Gateway devices in a resource group. :param resource_group_name: The resource group name. @@ -135,8 +743,10 @@ def list_by_resource_group( Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -144,37 +754,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -192,18 +798,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDevice" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DataBoxEdgeDevice": """Gets the properties of the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -220,27 +827,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -254,47 +851,38 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - resource_group_name, # type: str - data_box_edge_device, # type: "_models.DataBoxEdgeDevice" - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDevice" + device_name: str, + resource_group_name: str, + data_box_edge_device: "_models.DataBoxEdgeDevice", + **kwargs: Any + ) -> "_models.DataBoxEdgeDevice": cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') + + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -308,16 +896,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - resource_group_name, # type: str - data_box_edge_device, # type: "_models.DataBoxEdgeDevice" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DataBoxEdgeDevice"] + device_name: str, + resource_group_name: str, + data_box_edge_device: "_models.DataBoxEdgeDevice", + **kwargs: Any + ) -> LROPoller["_models.DataBoxEdgeDevice"]: """Creates or updates a Data Box Edge/Data Box Gateway resource. :param device_name: The device name. @@ -328,15 +918,20 @@ def begin_create_or_update( :type data_box_edge_device: ~azure.mgmt.databoxedge.v2020_12_01.models.DataBoxEdgeDevice :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DataBoxEdgeDevice or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.DataBoxEdgeDevice] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DataBoxEdgeDevice or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.DataBoxEdgeDevice] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] lro_delay = kwargs.pop( 'polling_interval', @@ -348,27 +943,21 @@ def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, data_box_edge_device=data_box_edge_device, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DataBoxEdgeDevice', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -380,41 +969,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore def _delete_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -427,13 +1006,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -442,15 +1022,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -464,21 +1046,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -490,16 +1065,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + @distributed_trace def update( self, - device_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.DataBoxEdgeDevicePatch" - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDevice" + device_name: str, + resource_group_name: str, + parameters: "_models.DataBoxEdgeDevicePatch", + **kwargs: Any + ) -> "_models.DataBoxEdgeDevice": """Modifies a Data Box Edge/Data Box Gateway resource. :param device_name: The device name. @@ -518,32 +1094,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -557,41 +1123,32 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + def _download_updates_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._download_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_download_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._download_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -604,13 +1161,14 @@ def _download_updates_initial( _download_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + + @distributed_trace def begin_download_updates( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Downloads the updates on a Data Box Edge/Data Box Gateway device. Downloads the updates on a Data Box Edge/Data Box Gateway device. @@ -621,15 +1179,17 @@ def begin_download_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -643,21 +1203,14 @@ def begin_download_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -669,15 +1222,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_download_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + @distributed_trace def generate_certificate( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.GenerateCertResponse" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.GenerateCertResponse": """Generates certificate for activation key. :param device_name: The device name. @@ -694,27 +1248,17 @@ def generate_certificate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.generate_certificate.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_generate_certificate_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.generate_certificate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -728,15 +1272,17 @@ def generate_certificate( return cls(pipeline_response, deserialized, {}) return deserialized + generate_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/generateCertificate'} # type: ignore + + @distributed_trace def get_extended_information( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDeviceExtendedInfo" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DataBoxEdgeDeviceExtendedInfo": """Gets additional information for the specified Azure Stack Edge/Data Box Gateway device. :param device_name: The device name. @@ -753,27 +1299,17 @@ def get_extended_information( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_extended_information.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_extended_information_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_extended_information.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -787,41 +1323,32 @@ def get_extended_information( return cls(pipeline_response, deserialized, {}) return deserialized + get_extended_information.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation'} # type: ignore + def _install_updates_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._install_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_install_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._install_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -834,13 +1361,14 @@ def _install_updates_initial( _install_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + + @distributed_trace def begin_install_updates( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Installs the updates on the Data Box Edge/Data Box Gateway device. Installs the updates on the Data Box Edge/Data Box Gateway device. @@ -851,15 +1379,17 @@ def begin_install_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -873,21 +1403,14 @@ def begin_install_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -899,15 +1422,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_install_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + @distributed_trace def get_network_settings( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.NetworkSettings" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.NetworkSettings": """Gets the network settings of the specified Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -924,27 +1448,17 @@ def get_network_settings( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_network_settings.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_network_settings_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_network_settings.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -958,41 +1472,32 @@ def get_network_settings( return cls(pipeline_response, deserialized, {}) return deserialized + get_network_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/networkSettings/default'} # type: ignore + def _scan_for_updates_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._scan_for_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_scan_for_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._scan_for_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1005,13 +1510,14 @@ def _scan_for_updates_initial( _scan_for_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore + + @distributed_trace def begin_scan_for_updates( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Scans for updates on a Data Box Edge/Data Box Gateway device. Scans for updates on a Data Box Edge/Data Box Gateway device. @@ -1022,15 +1528,17 @@ def begin_scan_for_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1044,21 +1552,14 @@ def begin_scan_for_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1070,47 +1571,37 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_scan_for_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore def _create_or_update_security_settings_initial( self, - device_name, # type: str - resource_group_name, # type: str - security_settings, # type: "_models.SecuritySettings" - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + security_settings: "_models.SecuritySettings", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_security_settings_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(security_settings, 'SecuritySettings') + + request = build_create_or_update_security_settings_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_security_settings_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(security_settings, 'SecuritySettings') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1123,14 +1614,15 @@ def _create_or_update_security_settings_initial( _create_or_update_security_settings_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + + @distributed_trace def begin_create_or_update_security_settings( self, - device_name, # type: str - resource_group_name, # type: str - security_settings, # type: "_models.SecuritySettings" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + security_settings: "_models.SecuritySettings", + **kwargs: Any + ) -> LROPoller[None]: """Updates the security settings on a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -1141,15 +1633,18 @@ def begin_create_or_update_security_settings( :type security_settings: ~azure.mgmt.databoxedge.v2020_12_01.models.SecuritySettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1161,24 +1656,18 @@ def begin_create_or_update_security_settings( device_name=device_name, resource_group_name=resource_group_name, security_settings=security_settings, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1190,16 +1679,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_security_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + @distributed_trace def update_extended_information( self, - device_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.DataBoxEdgeDeviceExtendedInfoPatch" - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDeviceExtendedInfo" + device_name: str, + resource_group_name: str, + parameters: "_models.DataBoxEdgeDeviceExtendedInfoPatch", + **kwargs: Any + ) -> "_models.DataBoxEdgeDeviceExtendedInfo": """Gets additional information for the specified Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -1218,32 +1708,22 @@ def update_extended_information( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update_extended_information.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'DataBoxEdgeDeviceExtendedInfoPatch') + + request = build_update_extended_information_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.update_extended_information.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataBoxEdgeDeviceExtendedInfoPatch') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1257,16 +1737,19 @@ def update_extended_information( return cls(pipeline_response, deserialized, {}) return deserialized + update_extended_information.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateExtendedInformation'} # type: ignore + + @distributed_trace def get_update_summary( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.UpdateSummary" - """Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.UpdateSummary": + """Gets information about the availability of updates based on the last scan of the device. It + also gets information about any ongoing download or install jobs on the device. Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. @@ -1285,27 +1768,17 @@ def get_update_summary( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_update_summary.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_update_summary_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_update_summary.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1319,16 +1792,18 @@ def get_update_summary( return cls(pipeline_response, deserialized, {}) return deserialized + get_update_summary.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default'} # type: ignore + + @distributed_trace def upload_certificate( self, - device_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.UploadCertificateRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.UploadCertificateResponse" + device_name: str, + resource_group_name: str, + parameters: "_models.UploadCertificateRequest", + **kwargs: Any + ) -> "_models.UploadCertificateResponse": """Uploads registration certificate for the device. :param device_name: The device name. @@ -1347,32 +1822,22 @@ def upload_certificate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.upload_certificate.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'UploadCertificateRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_upload_certificate_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.upload_certificate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'UploadCertificateRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1386,4 +1851,6 @@ def upload_certificate( return cls(pipeline_response, deserialized, {}) return deserialized + upload_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/uploadCertificate'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_jobs_operations.py index 0f247c2dadde..45e82b4ae199 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_jobs_operations.py @@ -5,22 +5,61 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class JobsOperations(object): """JobsOperations operations. @@ -44,14 +83,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Job" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Job": """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. @@ -72,28 +111,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -107,4 +136,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_monitoring_config_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_monitoring_config_operations.py index b7a1149d557f..0a532c02cbfc 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_monitoring_config_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_monitoring_config_operations.py @@ -5,25 +5,185 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + device_name: str, + role_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + role_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + role_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + role_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class MonitoringConfigOperations(object): """MonitoringConfigOperations operations. @@ -47,14 +207,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - device_name, # type: str - role_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.MonitoringMetricConfigurationList"] + device_name: str, + role_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.MonitoringMetricConfigurationList"]: """Lists metric configurations in a role. Lists metric configurations in a role. @@ -66,8 +226,10 @@ def list( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MonitoringMetricConfigurationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.MonitoringMetricConfigurationList] + :return: An iterator like instance of either MonitoringMetricConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.MonitoringMetricConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringMetricConfigurationList"] @@ -75,37 +237,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('MonitoringMetricConfigurationList', pipeline_response) + deserialized = self._deserialize("MonitoringMetricConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -123,19 +283,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - role_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.MonitoringMetricConfiguration" + device_name: str, + role_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.MonitoringMetricConfiguration": """Gets a metric configuration of a role. Gets a metric configuration of a role. @@ -156,28 +317,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -191,49 +342,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - role_name, # type: str - resource_group_name, # type: str - monitoring_metric_configuration, # type: "_models.MonitoringMetricConfiguration" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.MonitoringMetricConfiguration"] + device_name: str, + role_name: str, + resource_group_name: str, + monitoring_metric_configuration: "_models.MonitoringMetricConfiguration", + **kwargs: Any + ) -> Optional["_models.MonitoringMetricConfiguration"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MonitoringMetricConfiguration"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(monitoring_metric_configuration, 'MonitoringMetricConfiguration') + + request = build_create_or_update_request_initial( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(monitoring_metric_configuration, 'MonitoringMetricConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -249,17 +391,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - role_name, # type: str - resource_group_name, # type: str - monitoring_metric_configuration, # type: "_models.MonitoringMetricConfiguration" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.MonitoringMetricConfiguration"] + device_name: str, + role_name: str, + resource_group_name: str, + monitoring_metric_configuration: "_models.MonitoringMetricConfiguration", + **kwargs: Any + ) -> LROPoller["_models.MonitoringMetricConfiguration"]: """Creates a new metric configuration or updates an existing one for a role. Creates a new metric configuration or updates an existing one for a role. @@ -271,18 +415,24 @@ def begin_create_or_update( :param resource_group_name: The resource group name. :type resource_group_name: str :param monitoring_metric_configuration: The metric configuration. - :type monitoring_metric_configuration: ~azure.mgmt.databoxedge.v2020_12_01.models.MonitoringMetricConfiguration + :type monitoring_metric_configuration: + ~azure.mgmt.databoxedge.v2020_12_01.models.MonitoringMetricConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either MonitoringMetricConfiguration or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.MonitoringMetricConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringMetricConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.MonitoringMetricConfiguration] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringMetricConfiguration"] lro_delay = kwargs.pop( 'polling_interval', @@ -295,28 +445,21 @@ def begin_create_or_update( role_name=role_name, resource_group_name=resource_group_name, monitoring_metric_configuration=monitoring_metric_configuration, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MonitoringMetricConfiguration', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -328,43 +471,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore def _delete_initial( self, - device_name, # type: str - role_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + role_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -377,14 +510,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - role_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + role_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """deletes a new metric configuration for a role. deletes a new metric configuration for a role. @@ -397,15 +531,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -420,22 +556,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -447,4 +575,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_nodes_operations.py index 78229359702b..481f4f27caac 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_nodes_operations.py @@ -5,23 +5,60 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/nodes') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class NodesOperations(object): """NodesOperations operations. @@ -45,13 +82,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.NodeList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.NodeList"]: """Gets all the nodes currently configured under this Data Box Edge device. :param device_name: The device name. @@ -68,36 +105,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('NodeList', pipeline_response) + deserialized = self._deserialize("NodeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,6 +149,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_operations.py index 90ce016c463a..f2976905d24d 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.DataBoxEdge/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,11 +72,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationsList"] + **kwargs: Any + ) -> Iterable["_models.OperationsList"]: """List all the supported operations. List all the supported operations. @@ -64,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationsList', pipeline_response) + deserialized = self._deserialize("OperationsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -105,6 +129,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_operations_status_operations.py index f1f15e5aa3c9..874dc625f91b 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_operations_status_operations.py @@ -5,22 +5,61 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/operationsStatus/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class OperationsStatusOperations(object): """OperationsStatusOperations operations. @@ -44,14 +83,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Job" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Job": """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. @@ -72,28 +111,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -107,4 +136,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/operationsStatus/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_orders_operations.py index 6895a9da9339..8caef90cbfd9 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_orders_operations.py @@ -5,25 +5,212 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_dc_access_code_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default/listDCAccessCode') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class OrdersOperations(object): """OrdersOperations operations. @@ -47,13 +234,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OrderList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.OrderList"]: """Lists all the orders related to a Data Box Edge/Data Box Gateway device. Lists all the orders related to a Data Box Edge/Data Box Gateway device. @@ -72,36 +259,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OrderList', pipeline_response) + deserialized = self._deserialize("OrderList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,18 +303,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Order" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Order": """Gets a specific order by name. Gets a specific order by name. @@ -149,27 +334,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,47 +358,38 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - resource_group_name, # type: str - order, # type: "_models.Order" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Order"] + device_name: str, + resource_group_name: str, + order: "_models.Order", + **kwargs: Any + ) -> Optional["_models.Order"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Order"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(order, 'Order') + + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(order, 'Order') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,16 +405,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - resource_group_name, # type: str - order, # type: "_models.Order" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Order"] + device_name: str, + resource_group_name: str, + order: "_models.Order", + **kwargs: Any + ) -> LROPoller["_models.Order"]: """Creates or updates an order. Creates or updates an order. @@ -261,15 +429,18 @@ def begin_create_or_update( :type order: ~azure.mgmt.databoxedge.v2020_12_01.models.Order :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Order or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.Order] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Order"] lro_delay = kwargs.pop( 'polling_interval', @@ -281,27 +452,21 @@ def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, order=order, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Order', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -313,41 +478,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore def _delete_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -360,13 +515,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the order related to the device. Deletes the order related to the device. @@ -377,15 +533,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -399,21 +557,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -425,15 +576,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + @distributed_trace def list_dc_access_code( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DCAccessCode" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DCAccessCode": """Gets the DCAccess Code. Gets the DCAccess Code. @@ -452,27 +604,17 @@ def list_dc_access_code( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_dc_access_code.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_dc_access_code_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_dc_access_code.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -486,4 +628,6 @@ def list_dc_access_code( return cls(pipeline_response, deserialized, {}) return deserialized + list_dc_access_code.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default/listDCAccessCode'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_roles_operations.py index 3d7eaba27c8a..2d36b7401d81 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_roles_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class RolesOperations(object): """RolesOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RoleList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.RoleList"]: """Lists all the roles configured in a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -70,36 +228,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RoleList', pipeline_response) + deserialized = self._deserialize("RoleList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,19 +272,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Role" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Role": """Gets a specific role by name. :param device_name: The device name. @@ -148,28 +304,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,49 +329,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - role, # type: "_models.Role" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Role"] + device_name: str, + name: str, + resource_group_name: str, + role: "_models.Role", + **kwargs: Any + ) -> Optional["_models.Role"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Role"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(role, 'Role') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(role, 'Role') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -241,17 +378,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - role, # type: "_models.Role" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Role"] + device_name: str, + name: str, + resource_group_name: str, + role: "_models.Role", + **kwargs: Any + ) -> LROPoller["_models.Role"]: """Create or update a role. :param device_name: The device name. @@ -264,15 +403,18 @@ def begin_create_or_update( :type role: ~azure.mgmt.databoxedge.v2020_12_01.models.Role :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Role or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.Role] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Role"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +427,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, role=role, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Role', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -318,43 +453,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -367,14 +492,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the role on the device. :param device_name: The device name. @@ -385,15 +511,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -408,22 +536,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -435,4 +555,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_shares_operations.py index d0bb45caa897..3853d3eae243 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_shares_operations.py @@ -5,25 +5,220 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_refresh_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SharesOperations(object): """SharesOperations operations. @@ -47,13 +242,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ShareList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ShareList"]: """Lists all the shares in a Data Box Edge/Data Box Gateway device. Lists all the shares in a Data Box Edge/Data Box Gateway device. @@ -72,36 +267,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ShareList', pipeline_response) + deserialized = self._deserialize("ShareList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +311,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Share" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Share": """Gets a share by name. Gets a share by name. @@ -152,28 +345,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -187,49 +370,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - share, # type: "_models.Share" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Share"] + device_name: str, + name: str, + resource_group_name: str, + share: "_models.Share", + **kwargs: Any + ) -> Optional["_models.Share"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Share"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(share, 'Share') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(share, 'Share') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,17 +419,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - share, # type: "_models.Share" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Share"] + device_name: str, + name: str, + resource_group_name: str, + share: "_models.Share", + **kwargs: Any + ) -> LROPoller["_models.Share"]: """Creates a new share or updates an existing share on the device. Creates a new share or updates an existing share on the device. @@ -270,15 +446,18 @@ def begin_create_or_update( :type share: ~azure.mgmt.databoxedge.v2020_12_01.models.Share :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Share or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.Share] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Share"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +470,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, share=share, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Share', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -324,43 +496,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,14 +535,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the share on the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -391,15 +554,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -414,22 +579,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -441,43 +598,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore def _refresh_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -490,14 +637,15 @@ def _refresh_initial( _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore + + @distributed_trace def begin_refresh( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Refreshes the share metadata with the data from the cloud. Refreshes the share metadata with the data from the cloud. @@ -510,15 +658,17 @@ def begin_refresh( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -533,22 +683,14 @@ def begin_refresh( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -560,4 +702,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_storage_account_credentials_operations.py index 77dd4662c491..f3d1a3d5c012 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_storage_account_credentials_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class StorageAccountCredentialsOperations(object): """StorageAccountCredentialsOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountCredentialList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountCredentialList"]: """Gets all the storage account credentials in a Data Box Edge/Data Box Gateway device. Gets all the storage account credentials in a Data Box Edge/Data Box Gateway device. @@ -63,8 +221,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountCredentialList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.StorageAccountCredentialList] + :return: An iterator like instance of either StorageAccountCredentialList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.StorageAccountCredentialList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredentialList"] @@ -72,36 +232,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('StorageAccountCredentialList', pipeline_response) + deserialized = self._deserialize("StorageAccountCredentialList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +276,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountCredential" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.StorageAccountCredential": """Gets the properties of the specified storage account credential. :param device_name: The device name. @@ -150,28 +308,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,49 +333,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - storage_account_credential, # type: "_models.StorageAccountCredential" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageAccountCredential"] + device_name: str, + name: str, + resource_group_name: str, + storage_account_credential: "_models.StorageAccountCredential", + **kwargs: Any + ) -> Optional["_models.StorageAccountCredential"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccountCredential"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(storage_account_credential, 'StorageAccountCredential') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_account_credential, 'StorageAccountCredential') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -243,17 +382,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - storage_account_credential, # type: "_models.StorageAccountCredential" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageAccountCredential"] + device_name: str, + name: str, + resource_group_name: str, + storage_account_credential: "_models.StorageAccountCredential", + **kwargs: Any + ) -> LROPoller["_models.StorageAccountCredential"]: """Creates or updates the storage account credential. :param device_name: The device name. @@ -263,18 +404,24 @@ def begin_create_or_update( :param resource_group_name: The resource group name. :type resource_group_name: str :param storage_account_credential: The storage account credential. - :type storage_account_credential: ~azure.mgmt.databoxedge.v2020_12_01.models.StorageAccountCredential + :type storage_account_credential: + ~azure.mgmt.databoxedge.v2020_12_01.models.StorageAccountCredential :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either StorageAccountCredential or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.StorageAccountCredential] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either StorageAccountCredential or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.StorageAccountCredential] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredential"] lro_delay = kwargs.pop( 'polling_interval', @@ -287,28 +434,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, storage_account_credential=storage_account_credential, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccountCredential', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -320,43 +460,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -369,14 +499,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the storage account credential. :param device_name: The device name. @@ -387,15 +518,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -410,22 +543,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -437,4 +562,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_storage_accounts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_storage_accounts_operations.py index e62921192cf6..aec4d2f527c1 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_storage_accounts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_storage_accounts_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + storage_account_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + storage_account_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + storage_account_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountList"]: """Lists all the StorageAccounts in a Data Box Edge/Data Box Gateway device. Lists all the StorageAccounts in a Data Box Edge/Data Box Gateway device. @@ -64,7 +222,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either StorageAccountList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.StorageAccountList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_12_01.models.StorageAccountList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountList"] @@ -72,36 +231,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('StorageAccountList', pipeline_response) + deserialized = self._deserialize("StorageAccountList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +275,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.StorageAccount": """Gets a StorageAccount by name. Gets a StorageAccount by name. @@ -152,28 +309,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -187,49 +334,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - storage_account, # type: "_models.StorageAccount" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageAccount"] + device_name: str, + storage_account_name: str, + resource_group_name: str, + storage_account: "_models.StorageAccount", + **kwargs: Any + ) -> Optional["_models.StorageAccount"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(storage_account, 'StorageAccount') + + request = build_create_or_update_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_account, 'StorageAccount') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,17 +383,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - storage_account, # type: "_models.StorageAccount" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageAccount"] + device_name: str, + storage_account_name: str, + resource_group_name: str, + storage_account: "_models.StorageAccount", + **kwargs: Any + ) -> LROPoller["_models.StorageAccount"]: """Creates a new StorageAccount or updates an existing StorageAccount on the device. Creates a new StorageAccount or updates an existing StorageAccount on the device. @@ -270,15 +410,20 @@ def begin_create_or_update( :type storage_account: ~azure.mgmt.databoxedge.v2020_12_01.models.StorageAccount :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either StorageAccount or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +436,21 @@ def begin_create_or_update( storage_account_name=storage_account_name, resource_group_name=resource_group_name, storage_account=storage_account, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -324,43 +462,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore def _delete_initial( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,14 +501,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the StorageAccount on the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -391,15 +520,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -414,22 +545,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -441,4 +564,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_triggers_operations.py index 121a94ea9905..5e6b0d951109 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_triggers_operations.py @@ -5,25 +5,187 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class TriggersOperations(object): """TriggersOperations operations. @@ -47,14 +209,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.TriggerList"] + device_name: str, + resource_group_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.TriggerList"]: """Lists all the triggers configured in the device. :param device_name: The device name. @@ -74,38 +236,35 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TriggerList', pipeline_response) + deserialized = self._deserialize("TriggerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -123,19 +282,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Trigger" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Trigger": """Get a specific trigger by name. :param device_name: The device name. @@ -154,28 +314,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -189,49 +339,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - trigger, # type: "_models.Trigger" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Trigger"] + device_name: str, + name: str, + resource_group_name: str, + trigger: "_models.Trigger", + **kwargs: Any + ) -> Optional["_models.Trigger"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Trigger"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(trigger, 'Trigger') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(trigger, 'Trigger') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,17 +388,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - trigger, # type: "_models.Trigger" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Trigger"] + device_name: str, + name: str, + resource_group_name: str, + trigger: "_models.Trigger", + **kwargs: Any + ) -> LROPoller["_models.Trigger"]: """Creates or updates a trigger. :param device_name: Creates or updates a trigger. @@ -270,15 +413,18 @@ def begin_create_or_update( :type trigger: ~azure.mgmt.databoxedge.v2020_12_01.models.Trigger :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Trigger or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.Trigger] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Trigger"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +437,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, trigger=trigger, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Trigger', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -324,43 +463,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,14 +502,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the trigger on the gateway device. :param device_name: The device name. @@ -391,15 +521,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -414,22 +546,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -441,4 +565,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_users_operations.py index 774e1ad9db56..6a04c2bedb19 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/datab/operations/_users_operations.py @@ -5,25 +5,187 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class UsersOperations(object): """UsersOperations operations. @@ -47,14 +209,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UserList"] + device_name: str, + resource_group_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.UserList"]: """Gets all the users registered on a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -73,38 +235,35 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('UserList', pipeline_response) + deserialized = self._deserialize("UserList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -122,19 +281,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.User" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.User": """Gets the properties of the specified user. :param device_name: The device name. @@ -153,28 +313,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -188,49 +338,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - user, # type: "_models.User" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.User"] + device_name: str, + name: str, + resource_group_name: str, + user: "_models.User", + **kwargs: Any + ) -> Optional["_models.User"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.User"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(user, 'User') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(user, 'User') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -246,17 +387,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - user, # type: "_models.User" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.User"] + device_name: str, + name: str, + resource_group_name: str, + user: "_models.User", + **kwargs: Any + ) -> LROPoller["_models.User"]: """Creates a new user or updates an existing user's information on a Data Box Edge/Data Box Gateway device. @@ -270,15 +413,18 @@ def begin_create_or_update( :type user: ~azure.mgmt.databoxedge.v2020_12_01.models.User :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either User or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_12_01.models.User] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.User"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +437,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, user=user, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('User', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -324,43 +463,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,14 +502,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the user on a databox edge/gateway device. :param device_name: The device name. @@ -391,15 +521,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -414,22 +546,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -441,4 +565,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/_configuration.py index 58d4b497e3aa..048bbbef9b9c 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/_configuration.py @@ -12,7 +12,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -68,4 +68,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/_data_box_edge_management_client.py index cc262d6f2e12..0451b6c38d26 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/_data_box_edge_management_client.py @@ -23,7 +23,6 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse class _SDKClient(object): def __init__(self, *args, **kwargs): @@ -56,7 +55,7 @@ class DataBoxEdgeManagementClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2020-09-01' + DEFAULT_API_VERSION = '2021-02-01' _PROFILE_TAG = "azure.mgmt.databoxedge.DataBoxEdgeManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { @@ -71,12 +70,10 @@ def __init__( credential, # type: "TokenCredential" subscription_id, # type: str api_version=None, # type: Optional[str] - base_url=None, # type: Optional[str] + base_url="https://management.azure.com", # type: str profile=KnownProfiles.default, # type: KnownProfiles **kwargs # type: Any ): - if not base_url: - base_url = 'https://management.azure.com' self._config = DataBoxEdgeManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(DataBoxEdgeManagementClient, self).__init__( @@ -98,6 +95,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2020-05-01-preview: :mod:`v2020_05_01_preview.models` * 2020-09-01: :mod:`v2020_09_01.models` * 2020-09-01-preview: :mod:`v2020_09_01_preview.models` + * 2021-02-01: :mod:`v2021_02_01.models` * 2021-02-01-preview: :mod:`v2021_02_01_preview.models` """ if api_version == '2019-03-01': @@ -118,6 +116,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2020-09-01-preview': from .v2020_09_01_preview import models return models + elif api_version == '2021-02-01': + from .v2021_02_01 import models + return models elif api_version == '2021-02-01-preview': from .v2021_02_01_preview import models return models @@ -129,6 +130,7 @@ def addons(self): * 2020-09-01: :class:`AddonsOperations` * 2020-09-01-preview: :class:`AddonsOperations` + * 2021-02-01: :class:`AddonsOperations` * 2021-02-01-preview: :class:`AddonsOperations` """ api_version = self._get_api_version('addons') @@ -136,6 +138,8 @@ def addons(self): from .v2020_09_01.operations import AddonsOperations as OperationClass elif api_version == '2020-09-01-preview': from .v2020_09_01_preview.operations import AddonsOperations as OperationClass + elif api_version == '2021-02-01': + from .v2021_02_01.operations import AddonsOperations as OperationClass elif api_version == '2021-02-01-preview': from .v2021_02_01_preview.operations import AddonsOperations as OperationClass else: @@ -152,6 +156,7 @@ def alerts(self): * 2020-05-01-preview: :class:`AlertsOperations` * 2020-09-01: :class:`AlertsOperations` * 2020-09-01-preview: :class:`AlertsOperations` + * 2021-02-01: :class:`AlertsOperations` * 2021-02-01-preview: :class:`AlertsOperations` """ api_version = self._get_api_version('alerts') @@ -167,6 +172,8 @@ def alerts(self): from .v2020_09_01.operations import AlertsOperations as OperationClass elif api_version == '2020-09-01-preview': from .v2020_09_01_preview.operations import AlertsOperations as OperationClass + elif api_version == '2021-02-01': + from .v2021_02_01.operations import AlertsOperations as OperationClass elif api_version == '2021-02-01-preview': from .v2021_02_01_preview.operations import AlertsOperations as OperationClass else: @@ -180,6 +187,7 @@ def available_skus(self): * 2020-05-01-preview: :class:`AvailableSkusOperations` * 2020-09-01: :class:`AvailableSkusOperations` * 2020-09-01-preview: :class:`AvailableSkusOperations` + * 2021-02-01: :class:`AvailableSkusOperations` * 2021-02-01-preview: :class:`AvailableSkusOperations` """ api_version = self._get_api_version('available_skus') @@ -189,6 +197,8 @@ def available_skus(self): from .v2020_09_01.operations import AvailableSkusOperations as OperationClass elif api_version == '2020-09-01-preview': from .v2020_09_01_preview.operations import AvailableSkusOperations as OperationClass + elif api_version == '2021-02-01': + from .v2021_02_01.operations import AvailableSkusOperations as OperationClass elif api_version == '2021-02-01-preview': from .v2021_02_01_preview.operations import AvailableSkusOperations as OperationClass else: @@ -205,6 +215,7 @@ def bandwidth_schedules(self): * 2020-05-01-preview: :class:`BandwidthSchedulesOperations` * 2020-09-01: :class:`BandwidthSchedulesOperations` * 2020-09-01-preview: :class:`BandwidthSchedulesOperations` + * 2021-02-01: :class:`BandwidthSchedulesOperations` * 2021-02-01-preview: :class:`BandwidthSchedulesOperations` """ api_version = self._get_api_version('bandwidth_schedules') @@ -220,6 +231,8 @@ def bandwidth_schedules(self): from .v2020_09_01.operations import BandwidthSchedulesOperations as OperationClass elif api_version == '2020-09-01-preview': from .v2020_09_01_preview.operations import BandwidthSchedulesOperations as OperationClass + elif api_version == '2021-02-01': + from .v2021_02_01.operations import BandwidthSchedulesOperations as OperationClass elif api_version == '2021-02-01-preview': from .v2021_02_01_preview.operations import BandwidthSchedulesOperations as OperationClass else: @@ -234,6 +247,7 @@ def containers(self): * 2020-05-01-preview: :class:`ContainersOperations` * 2020-09-01: :class:`ContainersOperations` * 2020-09-01-preview: :class:`ContainersOperations` + * 2021-02-01: :class:`ContainersOperations` * 2021-02-01-preview: :class:`ContainersOperations` """ api_version = self._get_api_version('containers') @@ -245,6 +259,8 @@ def containers(self): from .v2020_09_01.operations import ContainersOperations as OperationClass elif api_version == '2020-09-01-preview': from .v2020_09_01_preview.operations import ContainersOperations as OperationClass + elif api_version == '2021-02-01': + from .v2021_02_01.operations import ContainersOperations as OperationClass elif api_version == '2021-02-01-preview': from .v2021_02_01_preview.operations import ContainersOperations as OperationClass else: @@ -261,6 +277,7 @@ def devices(self): * 2020-05-01-preview: :class:`DevicesOperations` * 2020-09-01: :class:`DevicesOperations` * 2020-09-01-preview: :class:`DevicesOperations` + * 2021-02-01: :class:`DevicesOperations` * 2021-02-01-preview: :class:`DevicesOperations` """ api_version = self._get_api_version('devices') @@ -276,12 +293,27 @@ def devices(self): from .v2020_09_01.operations import DevicesOperations as OperationClass elif api_version == '2020-09-01-preview': from .v2020_09_01_preview.operations import DevicesOperations as OperationClass + elif api_version == '2021-02-01': + from .v2021_02_01.operations import DevicesOperations as OperationClass elif api_version == '2021-02-01-preview': from .v2021_02_01_preview.operations import DevicesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'devices'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def diagnostic_settings(self): + """Instance depends on the API version: + + * 2021-02-01: :class:`DiagnosticSettingsOperations` + """ + api_version = self._get_api_version('diagnostic_settings') + if api_version == '2021-02-01': + from .v2021_02_01.operations import DiagnosticSettingsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'diagnostic_settings'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def jobs(self): """Instance depends on the API version: @@ -292,6 +324,7 @@ def jobs(self): * 2020-05-01-preview: :class:`JobsOperations` * 2020-09-01: :class:`JobsOperations` * 2020-09-01-preview: :class:`JobsOperations` + * 2021-02-01: :class:`JobsOperations` * 2021-02-01-preview: :class:`JobsOperations` """ api_version = self._get_api_version('jobs') @@ -307,6 +340,8 @@ def jobs(self): from .v2020_09_01.operations import JobsOperations as OperationClass elif api_version == '2020-09-01-preview': from .v2020_09_01_preview.operations import JobsOperations as OperationClass + elif api_version == '2021-02-01': + from .v2021_02_01.operations import JobsOperations as OperationClass elif api_version == '2021-02-01-preview': from .v2021_02_01_preview.operations import JobsOperations as OperationClass else: @@ -319,6 +354,7 @@ def monitoring_config(self): * 2020-09-01: :class:`MonitoringConfigOperations` * 2020-09-01-preview: :class:`MonitoringConfigOperations` + * 2021-02-01: :class:`MonitoringConfigOperations` * 2021-02-01-preview: :class:`MonitoringConfigOperations` """ api_version = self._get_api_version('monitoring_config') @@ -326,6 +362,8 @@ def monitoring_config(self): from .v2020_09_01.operations import MonitoringConfigOperations as OperationClass elif api_version == '2020-09-01-preview': from .v2020_09_01_preview.operations import MonitoringConfigOperations as OperationClass + elif api_version == '2021-02-01': + from .v2021_02_01.operations import MonitoringConfigOperations as OperationClass elif api_version == '2021-02-01-preview': from .v2021_02_01_preview.operations import MonitoringConfigOperations as OperationClass else: @@ -341,6 +379,7 @@ def nodes(self): * 2020-05-01-preview: :class:`NodesOperations` * 2020-09-01: :class:`NodesOperations` * 2020-09-01-preview: :class:`NodesOperations` + * 2021-02-01: :class:`NodesOperations` * 2021-02-01-preview: :class:`NodesOperations` """ api_version = self._get_api_version('nodes') @@ -354,6 +393,8 @@ def nodes(self): from .v2020_09_01.operations import NodesOperations as OperationClass elif api_version == '2020-09-01-preview': from .v2020_09_01_preview.operations import NodesOperations as OperationClass + elif api_version == '2021-02-01': + from .v2021_02_01.operations import NodesOperations as OperationClass elif api_version == '2021-02-01-preview': from .v2021_02_01_preview.operations import NodesOperations as OperationClass else: @@ -370,6 +411,7 @@ def operations(self): * 2020-05-01-preview: :class:`Operations` * 2020-09-01: :class:`Operations` * 2020-09-01-preview: :class:`Operations` + * 2021-02-01: :class:`Operations` * 2021-02-01-preview: :class:`Operations` """ api_version = self._get_api_version('operations') @@ -385,6 +427,8 @@ def operations(self): from .v2020_09_01.operations import Operations as OperationClass elif api_version == '2020-09-01-preview': from .v2020_09_01_preview.operations import Operations as OperationClass + elif api_version == '2021-02-01': + from .v2021_02_01.operations import Operations as OperationClass elif api_version == '2021-02-01-preview': from .v2021_02_01_preview.operations import Operations as OperationClass else: @@ -401,6 +445,7 @@ def operations_status(self): * 2020-05-01-preview: :class:`OperationsStatusOperations` * 2020-09-01: :class:`OperationsStatusOperations` * 2020-09-01-preview: :class:`OperationsStatusOperations` + * 2021-02-01: :class:`OperationsStatusOperations` * 2021-02-01-preview: :class:`OperationsStatusOperations` """ api_version = self._get_api_version('operations_status') @@ -416,6 +461,8 @@ def operations_status(self): from .v2020_09_01.operations import OperationsStatusOperations as OperationClass elif api_version == '2020-09-01-preview': from .v2020_09_01_preview.operations import OperationsStatusOperations as OperationClass + elif api_version == '2021-02-01': + from .v2021_02_01.operations import OperationsStatusOperations as OperationClass elif api_version == '2021-02-01-preview': from .v2021_02_01_preview.operations import OperationsStatusOperations as OperationClass else: @@ -432,6 +479,7 @@ def orders(self): * 2020-05-01-preview: :class:`OrdersOperations` * 2020-09-01: :class:`OrdersOperations` * 2020-09-01-preview: :class:`OrdersOperations` + * 2021-02-01: :class:`OrdersOperations` * 2021-02-01-preview: :class:`OrdersOperations` """ api_version = self._get_api_version('orders') @@ -447,6 +495,8 @@ def orders(self): from .v2020_09_01.operations import OrdersOperations as OperationClass elif api_version == '2020-09-01-preview': from .v2020_09_01_preview.operations import OrdersOperations as OperationClass + elif api_version == '2021-02-01': + from .v2021_02_01.operations import OrdersOperations as OperationClass elif api_version == '2021-02-01-preview': from .v2021_02_01_preview.operations import OrdersOperations as OperationClass else: @@ -463,6 +513,7 @@ def roles(self): * 2020-05-01-preview: :class:`RolesOperations` * 2020-09-01: :class:`RolesOperations` * 2020-09-01-preview: :class:`RolesOperations` + * 2021-02-01: :class:`RolesOperations` * 2021-02-01-preview: :class:`RolesOperations` """ api_version = self._get_api_version('roles') @@ -478,6 +529,8 @@ def roles(self): from .v2020_09_01.operations import RolesOperations as OperationClass elif api_version == '2020-09-01-preview': from .v2020_09_01_preview.operations import RolesOperations as OperationClass + elif api_version == '2021-02-01': + from .v2021_02_01.operations import RolesOperations as OperationClass elif api_version == '2021-02-01-preview': from .v2021_02_01_preview.operations import RolesOperations as OperationClass else: @@ -494,6 +547,7 @@ def shares(self): * 2020-05-01-preview: :class:`SharesOperations` * 2020-09-01: :class:`SharesOperations` * 2020-09-01-preview: :class:`SharesOperations` + * 2021-02-01: :class:`SharesOperations` * 2021-02-01-preview: :class:`SharesOperations` """ api_version = self._get_api_version('shares') @@ -509,6 +563,8 @@ def shares(self): from .v2020_09_01.operations import SharesOperations as OperationClass elif api_version == '2020-09-01-preview': from .v2020_09_01_preview.operations import SharesOperations as OperationClass + elif api_version == '2021-02-01': + from .v2021_02_01.operations import SharesOperations as OperationClass elif api_version == '2021-02-01-preview': from .v2021_02_01_preview.operations import SharesOperations as OperationClass else: @@ -541,6 +597,7 @@ def storage_account_credentials(self): * 2020-05-01-preview: :class:`StorageAccountCredentialsOperations` * 2020-09-01: :class:`StorageAccountCredentialsOperations` * 2020-09-01-preview: :class:`StorageAccountCredentialsOperations` + * 2021-02-01: :class:`StorageAccountCredentialsOperations` * 2021-02-01-preview: :class:`StorageAccountCredentialsOperations` """ api_version = self._get_api_version('storage_account_credentials') @@ -556,6 +613,8 @@ def storage_account_credentials(self): from .v2020_09_01.operations import StorageAccountCredentialsOperations as OperationClass elif api_version == '2020-09-01-preview': from .v2020_09_01_preview.operations import StorageAccountCredentialsOperations as OperationClass + elif api_version == '2021-02-01': + from .v2021_02_01.operations import StorageAccountCredentialsOperations as OperationClass elif api_version == '2021-02-01-preview': from .v2021_02_01_preview.operations import StorageAccountCredentialsOperations as OperationClass else: @@ -570,6 +629,7 @@ def storage_accounts(self): * 2020-05-01-preview: :class:`StorageAccountsOperations` * 2020-09-01: :class:`StorageAccountsOperations` * 2020-09-01-preview: :class:`StorageAccountsOperations` + * 2021-02-01: :class:`StorageAccountsOperations` * 2021-02-01-preview: :class:`StorageAccountsOperations` """ api_version = self._get_api_version('storage_accounts') @@ -581,12 +641,27 @@ def storage_accounts(self): from .v2020_09_01.operations import StorageAccountsOperations as OperationClass elif api_version == '2020-09-01-preview': from .v2020_09_01_preview.operations import StorageAccountsOperations as OperationClass + elif api_version == '2021-02-01': + from .v2021_02_01.operations import StorageAccountsOperations as OperationClass elif api_version == '2021-02-01-preview': from .v2021_02_01_preview.operations import StorageAccountsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'storage_accounts'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def support_packages(self): + """Instance depends on the API version: + + * 2021-02-01: :class:`SupportPackagesOperations` + """ + api_version = self._get_api_version('support_packages') + if api_version == '2021-02-01': + from .v2021_02_01.operations import SupportPackagesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'support_packages'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def triggers(self): """Instance depends on the API version: @@ -597,6 +672,7 @@ def triggers(self): * 2020-05-01-preview: :class:`TriggersOperations` * 2020-09-01: :class:`TriggersOperations` * 2020-09-01-preview: :class:`TriggersOperations` + * 2021-02-01: :class:`TriggersOperations` * 2021-02-01-preview: :class:`TriggersOperations` """ api_version = self._get_api_version('triggers') @@ -612,6 +688,8 @@ def triggers(self): from .v2020_09_01.operations import TriggersOperations as OperationClass elif api_version == '2020-09-01-preview': from .v2020_09_01_preview.operations import TriggersOperations as OperationClass + elif api_version == '2021-02-01': + from .v2021_02_01.operations import TriggersOperations as OperationClass elif api_version == '2021-02-01-preview': from .v2021_02_01_preview.operations import TriggersOperations as OperationClass else: @@ -628,6 +706,7 @@ def users(self): * 2020-05-01-preview: :class:`UsersOperations` * 2020-09-01: :class:`UsersOperations` * 2020-09-01-preview: :class:`UsersOperations` + * 2021-02-01: :class:`UsersOperations` * 2021-02-01-preview: :class:`UsersOperations` """ api_version = self._get_api_version('users') @@ -643,6 +722,8 @@ def users(self): from .v2020_09_01.operations import UsersOperations as OperationClass elif api_version == '2020-09-01-preview': from .v2020_09_01_preview.operations import UsersOperations as OperationClass + elif api_version == '2021-02-01': + from .v2021_02_01.operations import UsersOperations as OperationClass elif api_version == '2021-02-01-preview': from .v2021_02_01_preview.operations import UsersOperations as OperationClass else: diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/aio/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/aio/_configuration.py index 38cf64f9ae5c..ed458294d9a5 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/aio/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/aio/_configuration.py @@ -12,7 +12,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/aio/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/aio/_data_box_edge_management_client.py index b06c547cfb2e..05a707e06b09 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/aio/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/aio/_data_box_edge_management_client.py @@ -11,7 +11,6 @@ from typing import Any, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -21,6 +20,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential from azure.core.credentials_async import AsyncTokenCredential class _SDKClient(object): @@ -54,7 +54,7 @@ class DataBoxEdgeManagementClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2020-09-01' + DEFAULT_API_VERSION = '2021-02-01' _PROFILE_TAG = "azure.mgmt.databoxedge.DataBoxEdgeManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { @@ -69,12 +69,10 @@ def __init__( credential: "AsyncTokenCredential", subscription_id: str, api_version: Optional[str] = None, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", profile: KnownProfiles = KnownProfiles.default, **kwargs # type: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' self._config = DataBoxEdgeManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(DataBoxEdgeManagementClient, self).__init__( @@ -96,6 +94,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2020-05-01-preview: :mod:`v2020_05_01_preview.models` * 2020-09-01: :mod:`v2020_09_01.models` * 2020-09-01-preview: :mod:`v2020_09_01_preview.models` + * 2021-02-01: :mod:`v2021_02_01.models` * 2021-02-01-preview: :mod:`v2021_02_01_preview.models` """ if api_version == '2019-03-01': @@ -116,6 +115,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2020-09-01-preview': from ..v2020_09_01_preview import models return models + elif api_version == '2021-02-01': + from ..v2021_02_01 import models + return models elif api_version == '2021-02-01-preview': from ..v2021_02_01_preview import models return models @@ -127,6 +129,7 @@ def addons(self): * 2020-09-01: :class:`AddonsOperations` * 2020-09-01-preview: :class:`AddonsOperations` + * 2021-02-01: :class:`AddonsOperations` * 2021-02-01-preview: :class:`AddonsOperations` """ api_version = self._get_api_version('addons') @@ -134,6 +137,8 @@ def addons(self): from ..v2020_09_01.aio.operations import AddonsOperations as OperationClass elif api_version == '2020-09-01-preview': from ..v2020_09_01_preview.aio.operations import AddonsOperations as OperationClass + elif api_version == '2021-02-01': + from ..v2021_02_01.aio.operations import AddonsOperations as OperationClass elif api_version == '2021-02-01-preview': from ..v2021_02_01_preview.aio.operations import AddonsOperations as OperationClass else: @@ -150,6 +155,7 @@ def alerts(self): * 2020-05-01-preview: :class:`AlertsOperations` * 2020-09-01: :class:`AlertsOperations` * 2020-09-01-preview: :class:`AlertsOperations` + * 2021-02-01: :class:`AlertsOperations` * 2021-02-01-preview: :class:`AlertsOperations` """ api_version = self._get_api_version('alerts') @@ -165,6 +171,8 @@ def alerts(self): from ..v2020_09_01.aio.operations import AlertsOperations as OperationClass elif api_version == '2020-09-01-preview': from ..v2020_09_01_preview.aio.operations import AlertsOperations as OperationClass + elif api_version == '2021-02-01': + from ..v2021_02_01.aio.operations import AlertsOperations as OperationClass elif api_version == '2021-02-01-preview': from ..v2021_02_01_preview.aio.operations import AlertsOperations as OperationClass else: @@ -178,6 +186,7 @@ def available_skus(self): * 2020-05-01-preview: :class:`AvailableSkusOperations` * 2020-09-01: :class:`AvailableSkusOperations` * 2020-09-01-preview: :class:`AvailableSkusOperations` + * 2021-02-01: :class:`AvailableSkusOperations` * 2021-02-01-preview: :class:`AvailableSkusOperations` """ api_version = self._get_api_version('available_skus') @@ -187,6 +196,8 @@ def available_skus(self): from ..v2020_09_01.aio.operations import AvailableSkusOperations as OperationClass elif api_version == '2020-09-01-preview': from ..v2020_09_01_preview.aio.operations import AvailableSkusOperations as OperationClass + elif api_version == '2021-02-01': + from ..v2021_02_01.aio.operations import AvailableSkusOperations as OperationClass elif api_version == '2021-02-01-preview': from ..v2021_02_01_preview.aio.operations import AvailableSkusOperations as OperationClass else: @@ -203,6 +214,7 @@ def bandwidth_schedules(self): * 2020-05-01-preview: :class:`BandwidthSchedulesOperations` * 2020-09-01: :class:`BandwidthSchedulesOperations` * 2020-09-01-preview: :class:`BandwidthSchedulesOperations` + * 2021-02-01: :class:`BandwidthSchedulesOperations` * 2021-02-01-preview: :class:`BandwidthSchedulesOperations` """ api_version = self._get_api_version('bandwidth_schedules') @@ -218,6 +230,8 @@ def bandwidth_schedules(self): from ..v2020_09_01.aio.operations import BandwidthSchedulesOperations as OperationClass elif api_version == '2020-09-01-preview': from ..v2020_09_01_preview.aio.operations import BandwidthSchedulesOperations as OperationClass + elif api_version == '2021-02-01': + from ..v2021_02_01.aio.operations import BandwidthSchedulesOperations as OperationClass elif api_version == '2021-02-01-preview': from ..v2021_02_01_preview.aio.operations import BandwidthSchedulesOperations as OperationClass else: @@ -232,6 +246,7 @@ def containers(self): * 2020-05-01-preview: :class:`ContainersOperations` * 2020-09-01: :class:`ContainersOperations` * 2020-09-01-preview: :class:`ContainersOperations` + * 2021-02-01: :class:`ContainersOperations` * 2021-02-01-preview: :class:`ContainersOperations` """ api_version = self._get_api_version('containers') @@ -243,6 +258,8 @@ def containers(self): from ..v2020_09_01.aio.operations import ContainersOperations as OperationClass elif api_version == '2020-09-01-preview': from ..v2020_09_01_preview.aio.operations import ContainersOperations as OperationClass + elif api_version == '2021-02-01': + from ..v2021_02_01.aio.operations import ContainersOperations as OperationClass elif api_version == '2021-02-01-preview': from ..v2021_02_01_preview.aio.operations import ContainersOperations as OperationClass else: @@ -259,6 +276,7 @@ def devices(self): * 2020-05-01-preview: :class:`DevicesOperations` * 2020-09-01: :class:`DevicesOperations` * 2020-09-01-preview: :class:`DevicesOperations` + * 2021-02-01: :class:`DevicesOperations` * 2021-02-01-preview: :class:`DevicesOperations` """ api_version = self._get_api_version('devices') @@ -274,12 +292,27 @@ def devices(self): from ..v2020_09_01.aio.operations import DevicesOperations as OperationClass elif api_version == '2020-09-01-preview': from ..v2020_09_01_preview.aio.operations import DevicesOperations as OperationClass + elif api_version == '2021-02-01': + from ..v2021_02_01.aio.operations import DevicesOperations as OperationClass elif api_version == '2021-02-01-preview': from ..v2021_02_01_preview.aio.operations import DevicesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'devices'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def diagnostic_settings(self): + """Instance depends on the API version: + + * 2021-02-01: :class:`DiagnosticSettingsOperations` + """ + api_version = self._get_api_version('diagnostic_settings') + if api_version == '2021-02-01': + from ..v2021_02_01.aio.operations import DiagnosticSettingsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'diagnostic_settings'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def jobs(self): """Instance depends on the API version: @@ -290,6 +323,7 @@ def jobs(self): * 2020-05-01-preview: :class:`JobsOperations` * 2020-09-01: :class:`JobsOperations` * 2020-09-01-preview: :class:`JobsOperations` + * 2021-02-01: :class:`JobsOperations` * 2021-02-01-preview: :class:`JobsOperations` """ api_version = self._get_api_version('jobs') @@ -305,6 +339,8 @@ def jobs(self): from ..v2020_09_01.aio.operations import JobsOperations as OperationClass elif api_version == '2020-09-01-preview': from ..v2020_09_01_preview.aio.operations import JobsOperations as OperationClass + elif api_version == '2021-02-01': + from ..v2021_02_01.aio.operations import JobsOperations as OperationClass elif api_version == '2021-02-01-preview': from ..v2021_02_01_preview.aio.operations import JobsOperations as OperationClass else: @@ -317,6 +353,7 @@ def monitoring_config(self): * 2020-09-01: :class:`MonitoringConfigOperations` * 2020-09-01-preview: :class:`MonitoringConfigOperations` + * 2021-02-01: :class:`MonitoringConfigOperations` * 2021-02-01-preview: :class:`MonitoringConfigOperations` """ api_version = self._get_api_version('monitoring_config') @@ -324,6 +361,8 @@ def monitoring_config(self): from ..v2020_09_01.aio.operations import MonitoringConfigOperations as OperationClass elif api_version == '2020-09-01-preview': from ..v2020_09_01_preview.aio.operations import MonitoringConfigOperations as OperationClass + elif api_version == '2021-02-01': + from ..v2021_02_01.aio.operations import MonitoringConfigOperations as OperationClass elif api_version == '2021-02-01-preview': from ..v2021_02_01_preview.aio.operations import MonitoringConfigOperations as OperationClass else: @@ -339,6 +378,7 @@ def nodes(self): * 2020-05-01-preview: :class:`NodesOperations` * 2020-09-01: :class:`NodesOperations` * 2020-09-01-preview: :class:`NodesOperations` + * 2021-02-01: :class:`NodesOperations` * 2021-02-01-preview: :class:`NodesOperations` """ api_version = self._get_api_version('nodes') @@ -352,6 +392,8 @@ def nodes(self): from ..v2020_09_01.aio.operations import NodesOperations as OperationClass elif api_version == '2020-09-01-preview': from ..v2020_09_01_preview.aio.operations import NodesOperations as OperationClass + elif api_version == '2021-02-01': + from ..v2021_02_01.aio.operations import NodesOperations as OperationClass elif api_version == '2021-02-01-preview': from ..v2021_02_01_preview.aio.operations import NodesOperations as OperationClass else: @@ -368,6 +410,7 @@ def operations(self): * 2020-05-01-preview: :class:`Operations` * 2020-09-01: :class:`Operations` * 2020-09-01-preview: :class:`Operations` + * 2021-02-01: :class:`Operations` * 2021-02-01-preview: :class:`Operations` """ api_version = self._get_api_version('operations') @@ -383,6 +426,8 @@ def operations(self): from ..v2020_09_01.aio.operations import Operations as OperationClass elif api_version == '2020-09-01-preview': from ..v2020_09_01_preview.aio.operations import Operations as OperationClass + elif api_version == '2021-02-01': + from ..v2021_02_01.aio.operations import Operations as OperationClass elif api_version == '2021-02-01-preview': from ..v2021_02_01_preview.aio.operations import Operations as OperationClass else: @@ -399,6 +444,7 @@ def operations_status(self): * 2020-05-01-preview: :class:`OperationsStatusOperations` * 2020-09-01: :class:`OperationsStatusOperations` * 2020-09-01-preview: :class:`OperationsStatusOperations` + * 2021-02-01: :class:`OperationsStatusOperations` * 2021-02-01-preview: :class:`OperationsStatusOperations` """ api_version = self._get_api_version('operations_status') @@ -414,6 +460,8 @@ def operations_status(self): from ..v2020_09_01.aio.operations import OperationsStatusOperations as OperationClass elif api_version == '2020-09-01-preview': from ..v2020_09_01_preview.aio.operations import OperationsStatusOperations as OperationClass + elif api_version == '2021-02-01': + from ..v2021_02_01.aio.operations import OperationsStatusOperations as OperationClass elif api_version == '2021-02-01-preview': from ..v2021_02_01_preview.aio.operations import OperationsStatusOperations as OperationClass else: @@ -430,6 +478,7 @@ def orders(self): * 2020-05-01-preview: :class:`OrdersOperations` * 2020-09-01: :class:`OrdersOperations` * 2020-09-01-preview: :class:`OrdersOperations` + * 2021-02-01: :class:`OrdersOperations` * 2021-02-01-preview: :class:`OrdersOperations` """ api_version = self._get_api_version('orders') @@ -445,6 +494,8 @@ def orders(self): from ..v2020_09_01.aio.operations import OrdersOperations as OperationClass elif api_version == '2020-09-01-preview': from ..v2020_09_01_preview.aio.operations import OrdersOperations as OperationClass + elif api_version == '2021-02-01': + from ..v2021_02_01.aio.operations import OrdersOperations as OperationClass elif api_version == '2021-02-01-preview': from ..v2021_02_01_preview.aio.operations import OrdersOperations as OperationClass else: @@ -461,6 +512,7 @@ def roles(self): * 2020-05-01-preview: :class:`RolesOperations` * 2020-09-01: :class:`RolesOperations` * 2020-09-01-preview: :class:`RolesOperations` + * 2021-02-01: :class:`RolesOperations` * 2021-02-01-preview: :class:`RolesOperations` """ api_version = self._get_api_version('roles') @@ -476,6 +528,8 @@ def roles(self): from ..v2020_09_01.aio.operations import RolesOperations as OperationClass elif api_version == '2020-09-01-preview': from ..v2020_09_01_preview.aio.operations import RolesOperations as OperationClass + elif api_version == '2021-02-01': + from ..v2021_02_01.aio.operations import RolesOperations as OperationClass elif api_version == '2021-02-01-preview': from ..v2021_02_01_preview.aio.operations import RolesOperations as OperationClass else: @@ -492,6 +546,7 @@ def shares(self): * 2020-05-01-preview: :class:`SharesOperations` * 2020-09-01: :class:`SharesOperations` * 2020-09-01-preview: :class:`SharesOperations` + * 2021-02-01: :class:`SharesOperations` * 2021-02-01-preview: :class:`SharesOperations` """ api_version = self._get_api_version('shares') @@ -507,6 +562,8 @@ def shares(self): from ..v2020_09_01.aio.operations import SharesOperations as OperationClass elif api_version == '2020-09-01-preview': from ..v2020_09_01_preview.aio.operations import SharesOperations as OperationClass + elif api_version == '2021-02-01': + from ..v2021_02_01.aio.operations import SharesOperations as OperationClass elif api_version == '2021-02-01-preview': from ..v2021_02_01_preview.aio.operations import SharesOperations as OperationClass else: @@ -539,6 +596,7 @@ def storage_account_credentials(self): * 2020-05-01-preview: :class:`StorageAccountCredentialsOperations` * 2020-09-01: :class:`StorageAccountCredentialsOperations` * 2020-09-01-preview: :class:`StorageAccountCredentialsOperations` + * 2021-02-01: :class:`StorageAccountCredentialsOperations` * 2021-02-01-preview: :class:`StorageAccountCredentialsOperations` """ api_version = self._get_api_version('storage_account_credentials') @@ -554,6 +612,8 @@ def storage_account_credentials(self): from ..v2020_09_01.aio.operations import StorageAccountCredentialsOperations as OperationClass elif api_version == '2020-09-01-preview': from ..v2020_09_01_preview.aio.operations import StorageAccountCredentialsOperations as OperationClass + elif api_version == '2021-02-01': + from ..v2021_02_01.aio.operations import StorageAccountCredentialsOperations as OperationClass elif api_version == '2021-02-01-preview': from ..v2021_02_01_preview.aio.operations import StorageAccountCredentialsOperations as OperationClass else: @@ -568,6 +628,7 @@ def storage_accounts(self): * 2020-05-01-preview: :class:`StorageAccountsOperations` * 2020-09-01: :class:`StorageAccountsOperations` * 2020-09-01-preview: :class:`StorageAccountsOperations` + * 2021-02-01: :class:`StorageAccountsOperations` * 2021-02-01-preview: :class:`StorageAccountsOperations` """ api_version = self._get_api_version('storage_accounts') @@ -579,12 +640,27 @@ def storage_accounts(self): from ..v2020_09_01.aio.operations import StorageAccountsOperations as OperationClass elif api_version == '2020-09-01-preview': from ..v2020_09_01_preview.aio.operations import StorageAccountsOperations as OperationClass + elif api_version == '2021-02-01': + from ..v2021_02_01.aio.operations import StorageAccountsOperations as OperationClass elif api_version == '2021-02-01-preview': from ..v2021_02_01_preview.aio.operations import StorageAccountsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'storage_accounts'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def support_packages(self): + """Instance depends on the API version: + + * 2021-02-01: :class:`SupportPackagesOperations` + """ + api_version = self._get_api_version('support_packages') + if api_version == '2021-02-01': + from ..v2021_02_01.aio.operations import SupportPackagesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'support_packages'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def triggers(self): """Instance depends on the API version: @@ -595,6 +671,7 @@ def triggers(self): * 2020-05-01-preview: :class:`TriggersOperations` * 2020-09-01: :class:`TriggersOperations` * 2020-09-01-preview: :class:`TriggersOperations` + * 2021-02-01: :class:`TriggersOperations` * 2021-02-01-preview: :class:`TriggersOperations` """ api_version = self._get_api_version('triggers') @@ -610,6 +687,8 @@ def triggers(self): from ..v2020_09_01.aio.operations import TriggersOperations as OperationClass elif api_version == '2020-09-01-preview': from ..v2020_09_01_preview.aio.operations import TriggersOperations as OperationClass + elif api_version == '2021-02-01': + from ..v2021_02_01.aio.operations import TriggersOperations as OperationClass elif api_version == '2021-02-01-preview': from ..v2021_02_01_preview.aio.operations import TriggersOperations as OperationClass else: @@ -626,6 +705,7 @@ def users(self): * 2020-05-01-preview: :class:`UsersOperations` * 2020-09-01: :class:`UsersOperations` * 2020-09-01-preview: :class:`UsersOperations` + * 2021-02-01: :class:`UsersOperations` * 2021-02-01-preview: :class:`UsersOperations` """ api_version = self._get_api_version('users') @@ -641,6 +721,8 @@ def users(self): from ..v2020_09_01.aio.operations import UsersOperations as OperationClass elif api_version == '2020-09-01-preview': from ..v2020_09_01_preview.aio.operations import UsersOperations as OperationClass + elif api_version == '2021-02-01': + from ..v2021_02_01.aio.operations import UsersOperations as OperationClass elif api_version == '2021-02-01-preview': from ..v2021_02_01_preview.aio.operations import UsersOperations as OperationClass else: diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/models.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/models.py index 04574f8c176c..f63363e712e4 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/models.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/models.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- from .v2019_08_01.models import * -from .v2020_09_01.models import * +from .v2021_02_01.models import * diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/__init__.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/__init__.py index e63196b6b98f..577ebf317c02 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/__init__.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/__init__.py @@ -7,10 +7,12 @@ # -------------------------------------------------------------------------- from ._data_box_edge_management_client import DataBoxEdgeManagementClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['DataBoxEdgeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_configuration.py index 96175fc00331..caea1471b901 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_configuration.py @@ -6,19 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential -VERSION = "unknown" class DataBoxEdgeManagementClientConfiguration(Configuration): """Configuration for DataBoxEdgeManagementClient. @@ -34,16 +33,15 @@ class DataBoxEdgeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -67,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_data_box_edge_management_client.py index 03360a537bb9..667daba38adf 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_data_box_edge_management_client.py @@ -6,35 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import DataBoxEdgeManagementClientConfiguration +from .operations import AlertsOperations, BandwidthSchedulesOperations, DevicesOperations, JobsOperations, Operations, OperationsStatusOperations, OrdersOperations, RolesOperations, SharesOperations, StorageAccountCredentialsOperations, TriggersOperations, UsersOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import DataBoxEdgeManagementClientConfiguration -from .operations import Operations -from .operations import DevicesOperations -from .operations import AlertsOperations -from .operations import BandwidthSchedulesOperations -from .operations import JobsOperations -from .operations import OperationsStatusOperations -from .operations import OrdersOperations -from .operations import RolesOperations -from .operations import SharesOperations -from .operations import StorageAccountCredentialsOperations -from .operations import TriggersOperations -from .operations import UsersOperations -from . import models - -class DataBoxEdgeManagementClient(object): +class DataBoxEdgeManagementClient: """The DataBoxEdge Client. :ivar operations: Operations operations @@ -44,11 +31,13 @@ class DataBoxEdgeManagementClient(object): :ivar alerts: AlertsOperations operations :vartype alerts: azure.mgmt.databoxedge.v2019_03_01.operations.AlertsOperations :ivar bandwidth_schedules: BandwidthSchedulesOperations operations - :vartype bandwidth_schedules: azure.mgmt.databoxedge.v2019_03_01.operations.BandwidthSchedulesOperations + :vartype bandwidth_schedules: + azure.mgmt.databoxedge.v2019_03_01.operations.BandwidthSchedulesOperations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.databoxedge.v2019_03_01.operations.JobsOperations :ivar operations_status: OperationsStatusOperations operations - :vartype operations_status: azure.mgmt.databoxedge.v2019_03_01.operations.OperationsStatusOperations + :vartype operations_status: + azure.mgmt.databoxedge.v2019_03_01.operations.OperationsStatusOperations :ivar orders: OrdersOperations operations :vartype orders: azure.mgmt.databoxedge.v2019_03_01.operations.OrdersOperations :ivar roles: RolesOperations operations @@ -56,7 +45,8 @@ class DataBoxEdgeManagementClient(object): :ivar shares: SharesOperations operations :vartype shares: azure.mgmt.databoxedge.v2019_03_01.operations.SharesOperations :ivar storage_account_credentials: StorageAccountCredentialsOperations operations - :vartype storage_account_credentials: azure.mgmt.databoxedge.v2019_03_01.operations.StorageAccountCredentialsOperations + :vartype storage_account_credentials: + azure.mgmt.databoxedge.v2019_03_01.operations.StorageAccountCredentialsOperations :ivar triggers: TriggersOperations operations :vartype triggers: azure.mgmt.databoxedge.v2019_03_01.operations.TriggersOperations :ivar users: UsersOperations operations @@ -65,70 +55,65 @@ class DataBoxEdgeManagementClient(object): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = DataBoxEdgeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = DataBoxEdgeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.orders = OrdersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.shares = SharesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bandwidth_schedules = BandwidthSchedulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations_status = OperationsStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_account_credentials = StorageAccountCredentialsOperations(self._client, self._config, self._serialize, self._deserialize) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_metadata.json b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_metadata.json index 589c36de0e28..86c44b05627c 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_metadata.json +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_metadata.json @@ -5,13 +5,13 @@ "name": "DataBoxEdgeManagementClient", "filename": "_data_box_edge_management_client", "description": "The DataBoxEdge Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "operations": "Operations", diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_patch.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_vendor.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_version.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/__init__.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/__init__.py index c33d46ee91d8..f33cac1fd9b0 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/__init__.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._data_box_edge_management_client import DataBoxEdgeManagementClient __all__ = ['DataBoxEdgeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/_configuration.py index 72a7ebb67c7b..79d9527cf5c5 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/_configuration.py @@ -10,13 +10,14 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class DataBoxEdgeManagementClientConfiguration(Configuration): """Configuration for DataBoxEdgeManagementClient. @@ -36,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -63,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/_data_box_edge_management_client.py index 02a2f028deb6..361c4400fbd8 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/_data_box_edge_management_client.py @@ -6,33 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import DataBoxEdgeManagementClientConfiguration +from .operations import AlertsOperations, BandwidthSchedulesOperations, DevicesOperations, JobsOperations, Operations, OperationsStatusOperations, OrdersOperations, RolesOperations, SharesOperations, StorageAccountCredentialsOperations, TriggersOperations, UsersOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import DataBoxEdgeManagementClientConfiguration -from .operations import Operations -from .operations import DevicesOperations -from .operations import AlertsOperations -from .operations import BandwidthSchedulesOperations -from .operations import JobsOperations -from .operations import OperationsStatusOperations -from .operations import OrdersOperations -from .operations import RolesOperations -from .operations import SharesOperations -from .operations import StorageAccountCredentialsOperations -from .operations import TriggersOperations -from .operations import UsersOperations -from .. import models - - -class DataBoxEdgeManagementClient(object): +class DataBoxEdgeManagementClient: """The DataBoxEdge Client. :ivar operations: Operations operations @@ -42,11 +31,13 @@ class DataBoxEdgeManagementClient(object): :ivar alerts: AlertsOperations operations :vartype alerts: azure.mgmt.databoxedge.v2019_03_01.aio.operations.AlertsOperations :ivar bandwidth_schedules: BandwidthSchedulesOperations operations - :vartype bandwidth_schedules: azure.mgmt.databoxedge.v2019_03_01.aio.operations.BandwidthSchedulesOperations + :vartype bandwidth_schedules: + azure.mgmt.databoxedge.v2019_03_01.aio.operations.BandwidthSchedulesOperations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.databoxedge.v2019_03_01.aio.operations.JobsOperations :ivar operations_status: OperationsStatusOperations operations - :vartype operations_status: azure.mgmt.databoxedge.v2019_03_01.aio.operations.OperationsStatusOperations + :vartype operations_status: + azure.mgmt.databoxedge.v2019_03_01.aio.operations.OperationsStatusOperations :ivar orders: OrdersOperations operations :vartype orders: azure.mgmt.databoxedge.v2019_03_01.aio.operations.OrdersOperations :ivar roles: RolesOperations operations @@ -54,7 +45,8 @@ class DataBoxEdgeManagementClient(object): :ivar shares: SharesOperations operations :vartype shares: azure.mgmt.databoxedge.v2019_03_01.aio.operations.SharesOperations :ivar storage_account_credentials: StorageAccountCredentialsOperations operations - :vartype storage_account_credentials: azure.mgmt.databoxedge.v2019_03_01.aio.operations.StorageAccountCredentialsOperations + :vartype storage_account_credentials: + azure.mgmt.databoxedge.v2019_03_01.aio.operations.StorageAccountCredentialsOperations :ivar triggers: TriggersOperations operations :vartype triggers: azure.mgmt.databoxedge.v2019_03_01.aio.operations.TriggersOperations :ivar users: UsersOperations operations @@ -63,68 +55,65 @@ class DataBoxEdgeManagementClient(object): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = DataBoxEdgeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = DataBoxEdgeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bandwidth_schedules = BandwidthSchedulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations_status = OperationsStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_account_credentials = StorageAccountCredentialsOperations(self._client, self._config, self._serialize, self._deserialize) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) + - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.orders = OrdersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.shares = SharesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/_patch.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_alerts_operations.py index 9b4a8bd1eee8..d498ad2cc481 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_alerts_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._alerts_operations import build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,11 +46,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.AlertList"]: """Gets all the alerts for a data box edge/gateway device. @@ -55,7 +61,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AlertList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_03_01.models.AlertList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_03_01.models.AlertList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertList"] @@ -63,36 +70,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AlertList', pipeline_response) + deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,17 +114,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Alert": """Gets an alert by name. @@ -142,28 +148,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,4 +173,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_bandwidth_schedules_operations.py index daeb130f0fa5..652299e523b1 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_bandwidth_schedules_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._bandwidth_schedules_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.BandwidthSchedulesList"]: """Gets all the bandwidth schedules for a data box edge/gateway device. @@ -56,8 +62,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BandwidthSchedulesList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_03_01.models.BandwidthSchedulesList] + :return: An iterator like instance of either BandwidthSchedulesList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_03_01.models.BandwidthSchedulesList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedulesList"] @@ -65,36 +73,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BandwidthSchedulesList', pipeline_response) + deserialized = self._deserialize("BandwidthSchedulesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,17 +117,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.BandwidthSchedule": """Gets the properties of the specified bandwidth schedule. @@ -142,28 +149,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,48 +174,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, parameters: "_models.BandwidthSchedule", - **kwargs + **kwargs: Any ) -> Optional["_models.BandwidthSchedule"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BandwidthSchedule"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BandwidthSchedule') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BandwidthSchedule') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -234,15 +223,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, parameters: "_models.BandwidthSchedule", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.BandwidthSchedule"]: """Creates or updates a bandwidth schedule. @@ -256,15 +248,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.databoxedge.v2019_03_01.models.BandwidthSchedule :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BandwidthSchedule or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_03_01.models.BandwidthSchedule] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BandwidthSchedule or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_03_01.models.BandwidthSchedule] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedule"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,28 +274,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BandwidthSchedule', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -310,6 +300,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore async def _delete_initial( @@ -317,35 +308,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -358,12 +339,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the specified bandwidth schedule. @@ -375,15 +358,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -398,22 +383,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -425,4 +402,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_devices_operations.py index 8d94f947e8d9..b31a91654d18 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_devices_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._devices_operations import build_create_or_update_request_initial, build_create_or_update_security_settings_request_initial, build_delete_request_initial, build_download_updates_request_initial, build_get_extended_information_request, build_get_network_settings_request, build_get_request, build_get_update_summary_request, build_install_updates_request_initial, build_list_by_resource_group_request, build_list_by_subscription_request, build_scan_for_updates_request_initial, build_update_request, build_upload_certificate_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,10 +48,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, expand: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.DataBoxEdgeDeviceList"]: """Gets all the data box edge/gateway devices in a subscription. @@ -54,8 +60,10 @@ def list_by_subscription( Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_03_01.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_03_01.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -63,36 +71,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,16 +113,18 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, expand: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.DataBoxEdgeDeviceList"]: """Gets all the data box edge/gateway devices in a resource group. @@ -129,8 +134,10 @@ def list_by_resource_group( Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_03_01.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_03_01.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -138,37 +145,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -186,16 +189,18 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDevice": """Gets the properties of the data box edge/gateway device. @@ -213,27 +218,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,46 +242,38 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, resource_group_name: str, data_box_edge_device: "_models.DataBoxEdgeDevice", - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDevice": cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') + + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -300,14 +287,17 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, resource_group_name: str, data_box_edge_device: "_models.DataBoxEdgeDevice", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.DataBoxEdgeDevice"]: """Creates or updates a Data Box Edge/Gateway resource. @@ -319,15 +309,20 @@ async def begin_create_or_update( :type data_box_edge_device: ~azure.mgmt.databoxedge.v2019_03_01.models.DataBoxEdgeDevice :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DataBoxEdgeDevice or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_03_01.models.DataBoxEdgeDevice] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DataBoxEdgeDevice or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_03_01.models.DataBoxEdgeDevice] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] lro_delay = kwargs.pop( 'polling_interval', @@ -339,27 +334,21 @@ async def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, data_box_edge_device=data_box_edge_device, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DataBoxEdgeDevice', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -371,40 +360,31 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore async def _delete_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -417,11 +397,13 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the data box edge/gateway device. @@ -431,15 +413,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -453,21 +437,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -479,14 +456,16 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + @distributed_trace_async async def update( self, device_name: str, resource_group_name: str, parameters: "_models.DataBoxEdgeDevicePatch", - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDevice": """Modifies a Data Box Edge/Gateway resource. @@ -506,32 +485,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') + + request = build_update_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -545,40 +514,32 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + async def _download_updates_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._download_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_download_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._download_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -591,11 +552,13 @@ async def _download_updates_initial( _download_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + + @distributed_trace_async async def begin_download_updates( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Downloads the updates on a data box edge/gateway device. @@ -607,15 +570,17 @@ async def begin_download_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -629,21 +594,14 @@ async def begin_download_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -655,13 +613,15 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_download_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + @distributed_trace_async async def get_extended_information( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDeviceExtendedInfo": """Gets additional information for the specified data box edge/gateway device. @@ -679,27 +639,17 @@ async def get_extended_information( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get_extended_information.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_extended_information_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_extended_information.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -713,40 +663,32 @@ async def get_extended_information( return cls(pipeline_response, deserialized, {}) return deserialized + get_extended_information.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation'} # type: ignore + async def _install_updates_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._install_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_install_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._install_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -759,11 +701,13 @@ async def _install_updates_initial( _install_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + + @distributed_trace_async async def begin_install_updates( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Installs the updates on the data box edge/gateway device. @@ -775,15 +719,17 @@ async def begin_install_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -797,21 +743,14 @@ async def begin_install_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -823,13 +762,15 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_install_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + @distributed_trace_async async def get_network_settings( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.NetworkSettings": """Gets the network settings of the specified data box edge/gateway device. @@ -847,27 +788,17 @@ async def get_network_settings( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get_network_settings.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_network_settings_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_network_settings.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -881,40 +812,32 @@ async def get_network_settings( return cls(pipeline_response, deserialized, {}) return deserialized + get_network_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/networkSettings/default'} # type: ignore + async def _scan_for_updates_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._scan_for_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_scan_for_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._scan_for_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -927,11 +850,13 @@ async def _scan_for_updates_initial( _scan_for_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore + + @distributed_trace_async async def begin_scan_for_updates( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Scans for updates on a data box edge/gateway device. @@ -943,15 +868,17 @@ async def begin_scan_for_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -965,21 +892,14 @@ async def begin_scan_for_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -991,6 +911,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_scan_for_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore async def _create_or_update_security_settings_initial( @@ -998,39 +919,29 @@ async def _create_or_update_security_settings_initial( device_name: str, resource_group_name: str, security_settings: "_models.SecuritySettings", - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_security_settings_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(security_settings, 'SecuritySettings') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_security_settings_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_security_settings_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(security_settings, 'SecuritySettings') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1043,12 +954,14 @@ async def _create_or_update_security_settings_initial( _create_or_update_security_settings_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + + @distributed_trace_async async def begin_create_or_update_security_settings( self, device_name: str, resource_group_name: str, security_settings: "_models.SecuritySettings", - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Updates the security settings on a data box edge/gateway device. @@ -1060,15 +973,18 @@ async def begin_create_or_update_security_settings( :type security_settings: ~azure.mgmt.databoxedge.v2019_03_01.models.SecuritySettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1080,24 +996,18 @@ async def begin_create_or_update_security_settings( device_name=device_name, resource_group_name=resource_group_name, security_settings=security_settings, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1109,15 +1019,18 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_security_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + @distributed_trace_async async def get_update_summary( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.UpdateSummary": - """Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. + """Gets information about the availability of updates based on the last scan of the device. It + also gets information about any ongoing download or install jobs on the device. Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. @@ -1136,27 +1049,17 @@ async def get_update_summary( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get_update_summary.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_update_summary_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_update_summary.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1170,14 +1073,17 @@ async def get_update_summary( return cls(pipeline_response, deserialized, {}) return deserialized + get_update_summary.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default'} # type: ignore + + @distributed_trace_async async def upload_certificate( self, device_name: str, resource_group_name: str, parameters: "_models.UploadCertificateRequest", - **kwargs + **kwargs: Any ) -> "_models.UploadCertificateResponse": """Uploads registration certificate for the device. @@ -1197,32 +1103,22 @@ async def upload_certificate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.upload_certificate.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'UploadCertificateRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_upload_certificate_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.upload_certificate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'UploadCertificateRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1236,4 +1132,6 @@ async def upload_certificate( return cls(pipeline_response, deserialized, {}) return deserialized + upload_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/uploadCertificate'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_jobs_operations.py index 235b4f5cd3cf..870c7e659917 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_jobs_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._jobs_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,12 +44,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Job": """Gets the details of a specified job on a data box edge/gateway device. @@ -67,28 +72,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -102,4 +97,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_operations.py index 196ad6bf122d..80bcef2e3584 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,9 +46,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OperationsList"]: """List all the supported operations. @@ -51,7 +57,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_03_01.models.OperationsList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_03_01.models.OperationsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationsList"] @@ -59,30 +66,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationsList', pipeline_response) + deserialized = self._deserialize("OperationsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -100,6 +104,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_operations_status_operations.py index 4eb25dfba79d..6751c71f7dbe 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_operations_status_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations_status_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,12 +44,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Job": """Gets the details of a specified job on a data box edge/gateway device. @@ -67,28 +72,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -102,4 +97,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/operationsStatus/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_orders_operations.py index 0fe065e6e1bf..b8733e34cddb 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_orders_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._orders_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OrderList"]: """Lists all the orders related to a data box edge/gateway device. @@ -59,7 +65,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OrderList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_03_01.models.OrderList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_03_01.models.OrderList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OrderList"] @@ -67,36 +74,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OrderList', pipeline_response) + deserialized = self._deserialize("OrderList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,16 +118,18 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Order": """Gets a specific order by name. @@ -143,27 +149,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,46 +173,38 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + async def _create_or_update_initial( self, device_name: str, resource_group_name: str, order: "_models.Order", - **kwargs + **kwargs: Any ) -> Optional["_models.Order"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Order"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(order, 'Order') + + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(order, 'Order') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -232,14 +220,17 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, resource_group_name: str, order: "_models.Order", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Order"]: """Creates or updates an order. @@ -253,15 +244,18 @@ async def begin_create_or_update( :type order: ~azure.mgmt.databoxedge.v2019_03_01.models.Order :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Order or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_03_01.models.Order] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Order"] lro_delay = kwargs.pop( 'polling_interval', @@ -273,27 +267,21 @@ async def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, order=order, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Order', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -305,40 +293,31 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore async def _delete_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -351,11 +330,13 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the order related to the device. @@ -367,15 +348,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -389,21 +372,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -415,4 +391,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_roles_operations.py index 0ba335a802c4..a221d775fd79 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_roles_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._roles_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.RoleList"]: """Lists all the roles configured in a data box edge/gateway device. @@ -57,7 +63,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RoleList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_03_01.models.RoleList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_03_01.models.RoleList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleList"] @@ -65,36 +72,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RoleList', pipeline_response) + deserialized = self._deserialize("RoleList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,17 +116,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Role": """Gets a specific role by name. @@ -142,28 +148,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,48 +173,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, role: "_models.Role", - **kwargs + **kwargs: Any ) -> Optional["_models.Role"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Role"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(role, 'Role') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(role, 'Role') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -234,15 +222,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, role: "_models.Role", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Role"]: """Create or update a role. @@ -256,15 +247,18 @@ async def begin_create_or_update( :type role: ~azure.mgmt.databoxedge.v2019_03_01.models.Role :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Role or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_03_01.models.Role] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Role"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,28 +271,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, role=role, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Role', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -310,6 +297,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore async def _delete_initial( @@ -317,35 +305,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -358,12 +336,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the role on the data box edge device. @@ -375,15 +355,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -398,22 +380,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -425,4 +399,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_shares_operations.py index 01dbe891f708..c046f0fd7615 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_shares_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._shares_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request, build_refresh_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ShareList"]: """Lists all the shares in a data box edge/gateway device. @@ -59,7 +65,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ShareList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_03_01.models.ShareList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_03_01.models.ShareList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ShareList"] @@ -67,36 +74,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ShareList', pipeline_response) + deserialized = self._deserialize("ShareList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,17 +118,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Share": """Gets a share by name. @@ -146,28 +152,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -181,48 +177,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, share: "_models.Share", - **kwargs + **kwargs: Any ) -> Optional["_models.Share"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Share"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(share, 'Share') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(share, 'Share') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -238,15 +226,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, share: "_models.Share", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Share"]: """Creates a new share or updates an existing share on the device. @@ -262,15 +253,18 @@ async def begin_create_or_update( :type share: ~azure.mgmt.databoxedge.v2019_03_01.models.Share :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Share or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_03_01.models.Share] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Share"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,28 +277,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, share=share, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Share', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -316,6 +303,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore async def _delete_initial( @@ -323,35 +311,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,12 +342,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the share on the data box edge/gateway device. @@ -381,15 +361,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -404,22 +386,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -431,6 +405,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore async def _refresh_initial( @@ -438,35 +413,25 @@ async def _refresh_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -479,12 +444,14 @@ async def _refresh_initial( _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore + + @distributed_trace_async async def begin_refresh( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Refreshes the share metadata with the data from the cloud. @@ -498,15 +465,17 @@ async def begin_refresh( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -521,22 +490,14 @@ async def begin_refresh( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -548,4 +509,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_storage_account_credentials_operations.py index df213b29b49d..dba7019fed33 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_storage_account_credentials_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._storage_account_credentials_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.StorageAccountCredentialList"]: """Gets all the storage account credentials in a data box edge/gateway device. @@ -58,8 +64,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountCredentialList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_03_01.models.StorageAccountCredentialList] + :return: An iterator like instance of either StorageAccountCredentialList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_03_01.models.StorageAccountCredentialList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredentialList"] @@ -67,36 +75,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('StorageAccountCredentialList', pipeline_response) + deserialized = self._deserialize("StorageAccountCredentialList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,17 +119,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.StorageAccountCredential": """Gets the properties of the specified storage account credential. @@ -144,28 +151,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -179,48 +176,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, storage_account_credential: "_models.StorageAccountCredential", - **kwargs + **kwargs: Any ) -> Optional["_models.StorageAccountCredential"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccountCredential"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(storage_account_credential, 'StorageAccountCredential') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_account_credential, 'StorageAccountCredential') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -236,15 +225,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, storage_account_credential: "_models.StorageAccountCredential", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.StorageAccountCredential"]: """Creates or updates the storage account credential. @@ -255,18 +247,24 @@ async def begin_create_or_update( :param resource_group_name: The resource group name. :type resource_group_name: str :param storage_account_credential: The storage account credential. - :type storage_account_credential: ~azure.mgmt.databoxedge.v2019_03_01.models.StorageAccountCredential + :type storage_account_credential: + ~azure.mgmt.databoxedge.v2019_03_01.models.StorageAccountCredential :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either StorageAccountCredential or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_03_01.models.StorageAccountCredential] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageAccountCredential or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_03_01.models.StorageAccountCredential] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredential"] lro_delay = kwargs.pop( 'polling_interval', @@ -279,28 +277,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, storage_account_credential=storage_account_credential, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccountCredential', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -312,6 +303,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore async def _delete_initial( @@ -319,35 +311,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -360,12 +342,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the storage account credential. @@ -377,15 +361,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -400,22 +386,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -427,4 +405,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_triggers_operations.py index 33ecf8aa7a8d..4afcfb261b83 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_triggers_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._triggers_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, expand: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.TriggerList"]: """Lists all the triggers configured in the device. @@ -61,7 +67,8 @@ def list_by_data_box_edge_device( :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TriggerList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_03_01.models.TriggerList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_03_01.models.TriggerList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TriggerList"] @@ -69,38 +76,35 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TriggerList', pipeline_response) + deserialized = self._deserialize("TriggerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,17 +122,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Trigger": """Get a specific trigger by name. @@ -148,28 +154,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,48 +179,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, trigger: "_models.Trigger", - **kwargs + **kwargs: Any ) -> Optional["_models.Trigger"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Trigger"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(trigger, 'Trigger') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(trigger, 'Trigger') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,15 +228,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, trigger: "_models.Trigger", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Trigger"]: """Creates or updates a trigger. @@ -262,15 +253,19 @@ async def begin_create_or_update( :type trigger: ~azure.mgmt.databoxedge.v2019_03_01.models.Trigger :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Trigger or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Trigger or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_03_01.models.Trigger] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Trigger"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,28 +278,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, trigger=trigger, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Trigger', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -316,6 +304,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore async def _delete_initial( @@ -323,35 +312,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,12 +343,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the trigger on the gateway device. @@ -381,15 +362,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -404,22 +387,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -431,4 +406,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_users_operations.py index 303c99d24052..a70d2936cc3e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_users_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._users_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.UserList"]: """Gets all the users registered on a data box edge/gateway device. @@ -57,7 +63,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_03_01.models.UserList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_03_01.models.UserList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UserList"] @@ -65,36 +72,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('UserList', pipeline_response) + deserialized = self._deserialize("UserList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,17 +116,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.User": """Gets the properties of the specified user. @@ -142,28 +148,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,48 +173,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, user: "_models.User", - **kwargs + **kwargs: Any ) -> Optional["_models.User"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.User"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(user, 'User') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(user, 'User') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -234,15 +222,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, user: "_models.User", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.User"]: """Creates a new user or updates an existing user's information on a data box edge/gateway device. @@ -256,15 +247,18 @@ async def begin_create_or_update( :type user: ~azure.mgmt.databoxedge.v2019_03_01.models.User :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either User or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_03_01.models.User] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.User"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,28 +271,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, user=user, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('User', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -310,6 +297,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore async def _delete_initial( @@ -317,35 +305,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -358,12 +336,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the user on a databox edge/gateway device. @@ -375,15 +355,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -398,22 +380,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -425,4 +399,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/models/__init__.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/models/__init__.py index d86147179315..bb490befaee1 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/models/__init__.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/models/__init__.py @@ -6,136 +6,71 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ARMBaseModel - from ._models_py3 import Address - from ._models_py3 import Alert - from ._models_py3 import AlertErrorDetails - from ._models_py3 import AlertList - from ._models_py3 import AsymmetricEncryptedSecret - from ._models_py3 import Authentication - from ._models_py3 import AzureContainerInfo - from ._models_py3 import BandwidthSchedule - from ._models_py3 import BandwidthSchedulesList - from ._models_py3 import ClientAccessRight - from ._models_py3 import CloudErrorBody - from ._models_py3 import ContactDetails - from ._models_py3 import DataBoxEdgeDevice - from ._models_py3 import DataBoxEdgeDeviceExtendedInfo - from ._models_py3 import DataBoxEdgeDeviceList - from ._models_py3 import DataBoxEdgeDevicePatch - from ._models_py3 import FileEventTrigger - from ._models_py3 import FileSourceInfo - from ._models_py3 import IoTDeviceInfo - from ._models_py3 import IoTRole - from ._models_py3 import Ipv4Config - from ._models_py3 import Ipv6Config - from ._models_py3 import Job - from ._models_py3 import JobErrorDetails - from ._models_py3 import JobErrorItem - from ._models_py3 import MetricDimensionV1 - from ._models_py3 import MetricSpecificationV1 - from ._models_py3 import MountPointMap - from ._models_py3 import NetworkAdapter - from ._models_py3 import NetworkAdapterPosition - from ._models_py3 import NetworkSettings - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationsList - from ._models_py3 import Order - from ._models_py3 import OrderList - from ._models_py3 import OrderStatus - from ._models_py3 import PeriodicTimerEventTrigger - from ._models_py3 import PeriodicTimerSourceInfo - from ._models_py3 import RefreshDetails - from ._models_py3 import Role - from ._models_py3 import RoleList - from ._models_py3 import RoleSinkInfo - from ._models_py3 import SecuritySettings - from ._models_py3 import ServiceSpecification - from ._models_py3 import Share - from ._models_py3 import ShareAccessRight - from ._models_py3 import ShareList - from ._models_py3 import Sku - from ._models_py3 import StorageAccountCredential - from ._models_py3 import StorageAccountCredentialList - from ._models_py3 import SymmetricKey - from ._models_py3 import TrackingInfo - from ._models_py3 import Trigger - from ._models_py3 import TriggerList - from ._models_py3 import UpdateDownloadProgress - from ._models_py3 import UpdateInstallProgress - from ._models_py3 import UpdateSummary - from ._models_py3 import UploadCertificateRequest - from ._models_py3 import UploadCertificateResponse - from ._models_py3 import User - from ._models_py3 import UserAccessRight - from ._models_py3 import UserList -except (SyntaxError, ImportError): - from ._models import ARMBaseModel # type: ignore - from ._models import Address # type: ignore - from ._models import Alert # type: ignore - from ._models import AlertErrorDetails # type: ignore - from ._models import AlertList # type: ignore - from ._models import AsymmetricEncryptedSecret # type: ignore - from ._models import Authentication # type: ignore - from ._models import AzureContainerInfo # type: ignore - from ._models import BandwidthSchedule # type: ignore - from ._models import BandwidthSchedulesList # type: ignore - from ._models import ClientAccessRight # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import ContactDetails # type: ignore - from ._models import DataBoxEdgeDevice # type: ignore - from ._models import DataBoxEdgeDeviceExtendedInfo # type: ignore - from ._models import DataBoxEdgeDeviceList # type: ignore - from ._models import DataBoxEdgeDevicePatch # type: ignore - from ._models import FileEventTrigger # type: ignore - from ._models import FileSourceInfo # type: ignore - from ._models import IoTDeviceInfo # type: ignore - from ._models import IoTRole # type: ignore - from ._models import Ipv4Config # type: ignore - from ._models import Ipv6Config # type: ignore - from ._models import Job # type: ignore - from ._models import JobErrorDetails # type: ignore - from ._models import JobErrorItem # type: ignore - from ._models import MetricDimensionV1 # type: ignore - from ._models import MetricSpecificationV1 # type: ignore - from ._models import MountPointMap # type: ignore - from ._models import NetworkAdapter # type: ignore - from ._models import NetworkAdapterPosition # type: ignore - from ._models import NetworkSettings # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationsList # type: ignore - from ._models import Order # type: ignore - from ._models import OrderList # type: ignore - from ._models import OrderStatus # type: ignore - from ._models import PeriodicTimerEventTrigger # type: ignore - from ._models import PeriodicTimerSourceInfo # type: ignore - from ._models import RefreshDetails # type: ignore - from ._models import Role # type: ignore - from ._models import RoleList # type: ignore - from ._models import RoleSinkInfo # type: ignore - from ._models import SecuritySettings # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Share # type: ignore - from ._models import ShareAccessRight # type: ignore - from ._models import ShareList # type: ignore - from ._models import Sku # type: ignore - from ._models import StorageAccountCredential # type: ignore - from ._models import StorageAccountCredentialList # type: ignore - from ._models import SymmetricKey # type: ignore - from ._models import TrackingInfo # type: ignore - from ._models import Trigger # type: ignore - from ._models import TriggerList # type: ignore - from ._models import UpdateDownloadProgress # type: ignore - from ._models import UpdateInstallProgress # type: ignore - from ._models import UpdateSummary # type: ignore - from ._models import UploadCertificateRequest # type: ignore - from ._models import UploadCertificateResponse # type: ignore - from ._models import User # type: ignore - from ._models import UserAccessRight # type: ignore - from ._models import UserList # type: ignore +from ._models_py3 import ARMBaseModel +from ._models_py3 import Address +from ._models_py3 import Alert +from ._models_py3 import AlertErrorDetails +from ._models_py3 import AlertList +from ._models_py3 import AsymmetricEncryptedSecret +from ._models_py3 import Authentication +from ._models_py3 import AzureContainerInfo +from ._models_py3 import BandwidthSchedule +from ._models_py3 import BandwidthSchedulesList +from ._models_py3 import ClientAccessRight +from ._models_py3 import CloudErrorBody +from ._models_py3 import ContactDetails +from ._models_py3 import DataBoxEdgeDevice +from ._models_py3 import DataBoxEdgeDeviceExtendedInfo +from ._models_py3 import DataBoxEdgeDeviceList +from ._models_py3 import DataBoxEdgeDevicePatch +from ._models_py3 import FileEventTrigger +from ._models_py3 import FileSourceInfo +from ._models_py3 import IoTDeviceInfo +from ._models_py3 import IoTRole +from ._models_py3 import Ipv4Config +from ._models_py3 import Ipv6Config +from ._models_py3 import Job +from ._models_py3 import JobErrorDetails +from ._models_py3 import JobErrorItem +from ._models_py3 import MetricDimensionV1 +from ._models_py3 import MetricSpecificationV1 +from ._models_py3 import MountPointMap +from ._models_py3 import NetworkAdapter +from ._models_py3 import NetworkAdapterPosition +from ._models_py3 import NetworkSettings +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationsList +from ._models_py3 import Order +from ._models_py3 import OrderList +from ._models_py3 import OrderStatus +from ._models_py3 import PeriodicTimerEventTrigger +from ._models_py3 import PeriodicTimerSourceInfo +from ._models_py3 import RefreshDetails +from ._models_py3 import Role +from ._models_py3 import RoleList +from ._models_py3 import RoleSinkInfo +from ._models_py3 import SecuritySettings +from ._models_py3 import ServiceSpecification +from ._models_py3 import Share +from ._models_py3 import ShareAccessRight +from ._models_py3 import ShareList +from ._models_py3 import Sku +from ._models_py3 import StorageAccountCredential +from ._models_py3 import StorageAccountCredentialList +from ._models_py3 import SymmetricKey +from ._models_py3 import TrackingInfo +from ._models_py3 import Trigger +from ._models_py3 import TriggerList +from ._models_py3 import UpdateDownloadProgress +from ._models_py3 import UpdateInstallProgress +from ._models_py3 import UpdateSummary +from ._models_py3 import UploadCertificateRequest +from ._models_py3 import UploadCertificateResponse +from ._models_py3 import User +from ._models_py3 import UserAccessRight +from ._models_py3 import UserList + from ._data_box_edge_management_client_enums import ( AccountType, diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/models/_data_box_edge_management_client_enums.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/models/_data_box_edge_management_client_enums.py index 03b262f20b0d..fe1c25d1d1f7 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/models/_data_box_edge_management_client_enums.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/models/_data_box_edge_management_client_enums.py @@ -6,34 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccountType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of storage accessed on the storage account. """ GENERAL_PURPOSE_STORAGE = "GeneralPurposeStorage" BLOB_STORAGE = "BlobStorage" -class AlertSeverity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AlertSeverity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Severity of the alert. """ @@ -41,14 +26,14 @@ class AlertSeverity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" CRITICAL = "Critical" -class AuthenticationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AuthenticationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The authentication type. """ INVALID = "Invalid" AZURE_ACTIVE_DIRECTORY = "AzureActiveDirectory" -class AzureContainerDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AzureContainerDataFormat(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Storage format used for the file represented by the share. """ @@ -56,7 +41,7 @@ class AzureContainerDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu PAGE_BLOB = "PageBlob" AZURE_FILE = "AzureFile" -class ClientPermissionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ClientPermissionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of access to be allowed for the client. """ @@ -64,7 +49,7 @@ class ClientPermissionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ_ONLY = "ReadOnly" READ_WRITE = "ReadWrite" -class DataBoxEdgeDeviceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DataBoxEdgeDeviceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the Data Box Edge/Gateway device. """ @@ -75,14 +60,14 @@ class DataBoxEdgeDeviceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum DISCONNECTED = "Disconnected" PARTIALLY_DISCONNECTED = "PartiallyDisconnected" -class DataPolicy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DataPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Data policy of the share. """ CLOUD = "Cloud" LOCAL = "Local" -class DayOfWeek(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DayOfWeek(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SUNDAY = "Sunday" MONDAY = "Monday" @@ -92,13 +77,13 @@ class DayOfWeek(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FRIDAY = "Friday" SATURDAY = "Saturday" -class DeviceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeviceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the Data Box Edge/Gateway device. """ DATA_BOX_EDGE_DEVICE = "DataBoxEdgeDevice" -class DownloadPhase(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DownloadPhase(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The download phase. """ @@ -107,7 +92,7 @@ class DownloadPhase(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DOWNLOADING = "Downloading" VERIFYING = "Verifying" -class EncryptionAlgorithm(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The algorithm used to encrypt "Value". """ @@ -115,7 +100,7 @@ class EncryptionAlgorithm(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AES256 = "AES256" RSAES_PKCS1_V1_5 = "RSAES_PKCS1_v_1_5" -class InstallRebootBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InstallRebootBehavior(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates if updates are available and at least one of the updates needs a reboot. """ @@ -123,7 +108,7 @@ class InstallRebootBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) REQUIRES_REBOOT = "RequiresReboot" REQUEST_REBOOT = "RequestReboot" -class JobStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JobStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current status of the job. """ @@ -135,7 +120,7 @@ class JobStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PAUSED = "Paused" SCHEDULED = "Scheduled" -class JobType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JobType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the job. """ @@ -145,7 +130,7 @@ class JobType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): INSTALL_UPDATES = "InstallUpdates" REFRESH_SHARE = "RefreshShare" -class MetricAggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricAggregationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Metric aggregation type. """ @@ -157,14 +142,14 @@ class MetricAggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) TOTAL = "Total" COUNT = "Count" -class MetricCategory(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricCategory(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Metric category. """ CAPACITY = "Capacity" TRANSACTION = "Transaction" -class MetricUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Metric units. """ @@ -177,35 +162,35 @@ class MetricUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BYTES_PER_SECOND = "BytesPerSecond" COUNT_PER_SECOND = "CountPerSecond" -class MonitoringStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MonitoringStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current monitoring status of the share. """ ENABLED = "Enabled" DISABLED = "Disabled" -class NetworkAdapterDHCPStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkAdapterDHCPStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Value indicating whether this adapter has DHCP enabled. """ DISABLED = "Disabled" ENABLED = "Enabled" -class NetworkAdapterRDMAStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkAdapterRDMAStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Value indicating whether this adapter is RDMA capable. """ INCAPABLE = "Incapable" CAPABLE = "Capable" -class NetworkAdapterStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkAdapterStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Value indicating whether this adapter is valid. """ INACTIVE = "Inactive" ACTIVE = "Active" -class NetworkGroup(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkGroup(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The network group. """ @@ -213,7 +198,7 @@ class NetworkGroup(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): NON_RDMA = "NonRDMA" RDMA = "RDMA" -class OrderState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OrderState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the order as per the allowed status types. """ @@ -232,35 +217,35 @@ class OrderState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SHIPPED_BACK = "ShippedBack" COLLECTED_AT_MICROSOFT = "CollectedAtMicrosoft" -class PlatformType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PlatformType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Host OS supported by the IoT role. """ WINDOWS = "Windows" LINUX = "Linux" -class RoleStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RoleStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Role status. """ ENABLED = "Enabled" DISABLED = "Disabled" -class RoleTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RoleTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): IOT = "IOT" ASA = "ASA" FUNCTIONS = "Functions" COGNITIVE = "Cognitive" -class ShareAccessProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareAccessProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Access protocol to be used by the share. """ SMB = "SMB" NFS = "NFS" -class ShareAccessType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareAccessType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of access to be allowed on the share for this user. """ @@ -268,34 +253,34 @@ class ShareAccessType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ = "Read" CUSTOM = "Custom" -class ShareStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current status of the share. """ ONLINE = "Online" OFFLINE = "Offline" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """SKU name. """ GATEWAY = "Gateway" EDGE = "Edge" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SKU tier. This is based on the SKU name. """ STANDARD = "Standard" -class SSLStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SSLStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Signifies whether SSL needs to be enabled or not. """ ENABLED = "Enabled" DISABLED = "Disabled" -class TimeGrain(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TimeGrain(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PT1_M = "PT1M" PT5_M = "PT5M" @@ -306,14 +291,14 @@ class TimeGrain(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PT12_H = "PT12H" PT1_D = "PT1D" -class TriggerEventType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TriggerEventType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Trigger Kind. """ FILE_EVENT = "FileEvent" PERIODIC_TIMER_EVENT = "PeriodicTimerEvent" -class UpdateOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpdateOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current update operation. """ @@ -322,7 +307,7 @@ class UpdateOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DOWNLOAD = "Download" INSTALL = "Install" -class UpdateOperationStage(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpdateOperationStage(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current stage of the update operation. """ diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/models/_models.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/models/_models.py deleted file mode 100644 index 721721347494..000000000000 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/models/_models.py +++ /dev/null @@ -1,2752 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class Address(msrest.serialization.Model): - """The shipping address of the customer. - - All required parameters must be populated in order to send to Azure. - - :param address_line1: Required. The address line1. - :type address_line1: str - :param address_line2: The address line2. - :type address_line2: str - :param address_line3: The address line3. - :type address_line3: str - :param postal_code: Required. The postal code. - :type postal_code: str - :param city: Required. The city name. - :type city: str - :param state: Required. The state name. - :type state: str - :param country: Required. The country name. - :type country: str - """ - - _validation = { - 'address_line1': {'required': True}, - 'postal_code': {'required': True}, - 'city': {'required': True}, - 'state': {'required': True}, - 'country': {'required': True}, - } - - _attribute_map = { - 'address_line1': {'key': 'addressLine1', 'type': 'str'}, - 'address_line2': {'key': 'addressLine2', 'type': 'str'}, - 'address_line3': {'key': 'addressLine3', 'type': 'str'}, - 'postal_code': {'key': 'postalCode', 'type': 'str'}, - 'city': {'key': 'city', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'country': {'key': 'country', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Address, self).__init__(**kwargs) - self.address_line1 = kwargs['address_line1'] - self.address_line2 = kwargs.get('address_line2', None) - self.address_line3 = kwargs.get('address_line3', None) - self.postal_code = kwargs['postal_code'] - self.city = kwargs['city'] - self.state = kwargs['state'] - self.country = kwargs['country'] - - -class ARMBaseModel(msrest.serialization.Model): - """Represents the base class for all object models. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ARMBaseModel, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class Alert(ARMBaseModel): - """Alert on the data box edge/gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar title: Alert title. - :vartype title: str - :ivar alert_type: Alert type. - :vartype alert_type: str - :ivar appeared_at_date_time: UTC time when the alert appeared. - :vartype appeared_at_date_time: ~datetime.datetime - :ivar recommendation: Alert recommendation. - :vartype recommendation: str - :ivar severity: Severity of the alert. Possible values include: "Informational", "Warning", - "Critical". - :vartype severity: str or ~azure.mgmt.databoxedge.v2019_03_01.models.AlertSeverity - :ivar error_details: Error details of the alert. - :vartype error_details: ~azure.mgmt.databoxedge.v2019_03_01.models.AlertErrorDetails - :ivar detailed_information: Alert details. - :vartype detailed_information: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'title': {'readonly': True}, - 'alert_type': {'readonly': True}, - 'appeared_at_date_time': {'readonly': True}, - 'recommendation': {'readonly': True}, - 'severity': {'readonly': True}, - 'error_details': {'readonly': True}, - 'detailed_information': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'title': {'key': 'properties.title', 'type': 'str'}, - 'alert_type': {'key': 'properties.alertType', 'type': 'str'}, - 'appeared_at_date_time': {'key': 'properties.appearedAtDateTime', 'type': 'iso-8601'}, - 'recommendation': {'key': 'properties.recommendation', 'type': 'str'}, - 'severity': {'key': 'properties.severity', 'type': 'str'}, - 'error_details': {'key': 'properties.errorDetails', 'type': 'AlertErrorDetails'}, - 'detailed_information': {'key': 'properties.detailedInformation', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(Alert, self).__init__(**kwargs) - self.title = None - self.alert_type = None - self.appeared_at_date_time = None - self.recommendation = None - self.severity = None - self.error_details = None - self.detailed_information = None - - -class AlertErrorDetails(msrest.serialization.Model): - """Error details for the alert. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error_code: Error code. - :vartype error_code: str - :ivar error_message: Error Message. - :vartype error_message: str - :ivar occurrences: Number of occurrences. - :vartype occurrences: int - """ - - _validation = { - 'error_code': {'readonly': True}, - 'error_message': {'readonly': True}, - 'occurrences': {'readonly': True}, - } - - _attribute_map = { - 'error_code': {'key': 'errorCode', 'type': 'str'}, - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - 'occurrences': {'key': 'occurrences', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(AlertErrorDetails, self).__init__(**kwargs) - self.error_code = None - self.error_message = None - self.occurrences = None - - -class AlertList(msrest.serialization.Model): - """Collection of alerts. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The value. - :vartype value: list[~azure.mgmt.databoxedge.v2019_03_01.models.Alert] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Alert]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AlertList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class AsymmetricEncryptedSecret(msrest.serialization.Model): - """Represent the secrets intended for encryption with asymmetric key pair. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The value of the secret. - :type value: str - :param encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the - value is unencrypted, it will be null. - :type encryption_cert_thumbprint: str - :param encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values - include: "None", "AES256", "RSAES_PKCS1_v_1_5". - :type encryption_algorithm: str or - ~azure.mgmt.databoxedge.v2019_03_01.models.EncryptionAlgorithm - """ - - _validation = { - 'value': {'required': True}, - 'encryption_algorithm': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'encryption_cert_thumbprint': {'key': 'encryptionCertThumbprint', 'type': 'str'}, - 'encryption_algorithm': {'key': 'encryptionAlgorithm', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AsymmetricEncryptedSecret, self).__init__(**kwargs) - self.value = kwargs['value'] - self.encryption_cert_thumbprint = kwargs.get('encryption_cert_thumbprint', None) - self.encryption_algorithm = kwargs['encryption_algorithm'] - - -class Authentication(msrest.serialization.Model): - """Authentication mechanism for IoT devices. - - :param symmetric_key: Symmetric key for authentication. - :type symmetric_key: ~azure.mgmt.databoxedge.v2019_03_01.models.SymmetricKey - """ - - _attribute_map = { - 'symmetric_key': {'key': 'symmetricKey', 'type': 'SymmetricKey'}, - } - - def __init__( - self, - **kwargs - ): - super(Authentication, self).__init__(**kwargs) - self.symmetric_key = kwargs.get('symmetric_key', None) - - -class AzureContainerInfo(msrest.serialization.Model): - """Azure container mapping of the endpoint. - - All required parameters must be populated in order to send to Azure. - - :param storage_account_credential_id: Required. ID of the storage account credential used to - access storage. - :type storage_account_credential_id: str - :param container_name: Required. Container name (Based on the data format specified, this - represents the name of Azure Files/Page blob/Block blob). - :type container_name: str - :param data_format: Required. Storage format used for the file represented by the share. - Possible values include: "BlockBlob", "PageBlob", "AzureFile". - :type data_format: str or ~azure.mgmt.databoxedge.v2019_03_01.models.AzureContainerDataFormat - """ - - _validation = { - 'storage_account_credential_id': {'required': True}, - 'container_name': {'required': True}, - 'data_format': {'required': True}, - } - - _attribute_map = { - 'storage_account_credential_id': {'key': 'storageAccountCredentialId', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'data_format': {'key': 'dataFormat', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureContainerInfo, self).__init__(**kwargs) - self.storage_account_credential_id = kwargs['storage_account_credential_id'] - self.container_name = kwargs['container_name'] - self.data_format = kwargs['data_format'] - - -class BandwidthSchedule(ARMBaseModel): - """The bandwidth schedule details. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param start: Required. The start time of the schedule in UTC. - :type start: str - :param stop: Required. The stop time of the schedule in UTC. - :type stop: str - :param rate_in_mbps: Required. The bandwidth rate in Mbps. - :type rate_in_mbps: int - :param days: Required. The days of the week when this schedule is applicable. - :type days: list[str or ~azure.mgmt.databoxedge.v2019_03_01.models.DayOfWeek] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'start': {'required': True}, - 'stop': {'required': True}, - 'rate_in_mbps': {'required': True}, - 'days': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'start': {'key': 'properties.start', 'type': 'str'}, - 'stop': {'key': 'properties.stop', 'type': 'str'}, - 'rate_in_mbps': {'key': 'properties.rateInMbps', 'type': 'int'}, - 'days': {'key': 'properties.days', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(BandwidthSchedule, self).__init__(**kwargs) - self.start = kwargs['start'] - self.stop = kwargs['stop'] - self.rate_in_mbps = kwargs['rate_in_mbps'] - self.days = kwargs['days'] - - -class BandwidthSchedulesList(msrest.serialization.Model): - """The collection of bandwidth schedules. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of bandwidth schedules. - :vartype value: list[~azure.mgmt.databoxedge.v2019_03_01.models.BandwidthSchedule] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BandwidthSchedule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BandwidthSchedulesList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ClientAccessRight(msrest.serialization.Model): - """The mapping between a particular client IP and the type of access client has on the NFS share. - - All required parameters must be populated in order to send to Azure. - - :param client: Required. IP of the client. - :type client: str - :param access_permission: Required. Type of access to be allowed for the client. Possible - values include: "NoAccess", "ReadOnly", "ReadWrite". - :type access_permission: str or ~azure.mgmt.databoxedge.v2019_03_01.models.ClientPermissionType - """ - - _validation = { - 'client': {'required': True}, - 'access_permission': {'required': True}, - } - - _attribute_map = { - 'client': {'key': 'client', 'type': 'str'}, - 'access_permission': {'key': 'accessPermission', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClientAccessRight, self).__init__(**kwargs) - self.client = kwargs['client'] - self.access_permission = kwargs['access_permission'] - - -class CloudErrorBody(msrest.serialization.Model): - """An error response from the service. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.databoxedge.v2019_03_01.models.CloudErrorBody] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudErrorBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.details = kwargs.get('details', None) - - -class ContactDetails(msrest.serialization.Model): - """Contains all the contact details of the customer. - - All required parameters must be populated in order to send to Azure. - - :param contact_person: Required. The contact person name. - :type contact_person: str - :param company_name: Required. The name of the company. - :type company_name: str - :param phone: Required. The phone number. - :type phone: str - :param email_list: Required. The email list. - :type email_list: list[str] - """ - - _validation = { - 'contact_person': {'required': True}, - 'company_name': {'required': True}, - 'phone': {'required': True}, - 'email_list': {'required': True}, - } - - _attribute_map = { - 'contact_person': {'key': 'contactPerson', 'type': 'str'}, - 'company_name': {'key': 'companyName', 'type': 'str'}, - 'phone': {'key': 'phone', 'type': 'str'}, - 'email_list': {'key': 'emailList', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ContactDetails, self).__init__(**kwargs) - self.contact_person = kwargs['contact_person'] - self.company_name = kwargs['company_name'] - self.phone = kwargs['phone'] - self.email_list = kwargs['email_list'] - - -class DataBoxEdgeDevice(ARMBaseModel): - """The Data Box Edge/Gateway device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param location: Required. The location of the device. This is a supported and registered Azure - geographical region (for example, West US, East US, or Southeast Asia). The geographical region - of a device cannot be changed once it is created, but if an identical geographical region is - specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. The list of tags that describe the device. These tags can be used - to view and group this device (across resource groups). - :type tags: dict[str, str] - :param sku: The SKU type. - :type sku: ~azure.mgmt.databoxedge.v2019_03_01.models.Sku - :param etag: The etag for the devices. - :type etag: str - :param data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible - values include: "ReadyToSetup", "Online", "Offline", "NeedsAttention", "Disconnected", - "PartiallyDisconnected". - :type data_box_edge_device_status: str or - ~azure.mgmt.databoxedge.v2019_03_01.models.DataBoxEdgeDeviceStatus - :ivar serial_number: The Serial Number of Data Box Edge/Gateway device. - :vartype serial_number: str - :param description: The Description of the Data Box Edge/Gateway device. - :type description: str - :param model_description: The description of the Data Box Edge/Gateway device model. - :type model_description: str - :ivar device_type: The type of the Data Box Edge/Gateway device. Possible values include: - "DataBoxEdgeDevice". - :vartype device_type: str or ~azure.mgmt.databoxedge.v2019_03_01.models.DeviceType - :param friendly_name: The Data Box Edge/Gateway device name. - :type friendly_name: str - :ivar culture: The Data Box Edge/Gateway device culture. - :vartype culture: str - :ivar device_model: The Data Box Edge/Gateway device model. - :vartype device_model: str - :ivar device_software_version: The Data Box Edge/Gateway device software version. - :vartype device_software_version: str - :ivar device_local_capacity: The Data Box Edge/Gateway device local capacity in MB. - :vartype device_local_capacity: long - :ivar time_zone: The Data Box Edge/Gateway device timezone. - :vartype time_zone: str - :ivar device_hcs_version: The device software version number of the device (eg: 1.2.18105.6). - :vartype device_hcs_version: str - :ivar configured_role_types: Type of compute roles configured. - :vartype configured_role_types: list[str or - ~azure.mgmt.databoxedge.v2019_03_01.models.RoleTypes] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'serial_number': {'readonly': True}, - 'device_type': {'readonly': True}, - 'culture': {'readonly': True}, - 'device_model': {'readonly': True}, - 'device_software_version': {'readonly': True}, - 'device_local_capacity': {'readonly': True}, - 'time_zone': {'readonly': True}, - 'device_hcs_version': {'readonly': True}, - 'configured_role_types': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'data_box_edge_device_status': {'key': 'properties.dataBoxEdgeDeviceStatus', 'type': 'str'}, - 'serial_number': {'key': 'properties.serialNumber', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'model_description': {'key': 'properties.modelDescription', 'type': 'str'}, - 'device_type': {'key': 'properties.deviceType', 'type': 'str'}, - 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, - 'culture': {'key': 'properties.culture', 'type': 'str'}, - 'device_model': {'key': 'properties.deviceModel', 'type': 'str'}, - 'device_software_version': {'key': 'properties.deviceSoftwareVersion', 'type': 'str'}, - 'device_local_capacity': {'key': 'properties.deviceLocalCapacity', 'type': 'long'}, - 'time_zone': {'key': 'properties.timeZone', 'type': 'str'}, - 'device_hcs_version': {'key': 'properties.deviceHcsVersion', 'type': 'str'}, - 'configured_role_types': {'key': 'properties.configuredRoleTypes', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeDevice, self).__init__(**kwargs) - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.etag = kwargs.get('etag', None) - self.data_box_edge_device_status = kwargs.get('data_box_edge_device_status', None) - self.serial_number = None - self.description = kwargs.get('description', None) - self.model_description = kwargs.get('model_description', None) - self.device_type = None - self.friendly_name = kwargs.get('friendly_name', None) - self.culture = None - self.device_model = None - self.device_software_version = None - self.device_local_capacity = None - self.time_zone = None - self.device_hcs_version = None - self.configured_role_types = None - - -class DataBoxEdgeDeviceExtendedInfo(ARMBaseModel): - """The extended Info of the Data Box Edge/Gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param encryption_key_thumbprint: The digital signature of encrypted certificate. - :type encryption_key_thumbprint: str - :param encryption_key: The public part of the encryption certificate. Client uses this to - encrypt any secret. - :type encryption_key: str - :ivar resource_key: The Resource ID of the Resource. - :vartype resource_key: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'resource_key': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'encryption_key_thumbprint': {'key': 'properties.encryptionKeyThumbprint', 'type': 'str'}, - 'encryption_key': {'key': 'properties.encryptionKey', 'type': 'str'}, - 'resource_key': {'key': 'properties.resourceKey', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeDeviceExtendedInfo, self).__init__(**kwargs) - self.encryption_key_thumbprint = kwargs.get('encryption_key_thumbprint', None) - self.encryption_key = kwargs.get('encryption_key', None) - self.resource_key = None - - -class DataBoxEdgeDeviceList(msrest.serialization.Model): - """The collection of Data Box Edge/Gateway devices. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of Data Box Edge/Gateway devices. - :vartype value: list[~azure.mgmt.databoxedge.v2019_03_01.models.DataBoxEdgeDevice] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DataBoxEdgeDevice]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeDeviceList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class DataBoxEdgeDevicePatch(msrest.serialization.Model): - """The Data Box Edge/Gateway device patch. - - :param tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeDevicePatch, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class Trigger(ARMBaseModel): - """Trigger details. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: FileEventTrigger, PeriodicTimerEventTrigger. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: - "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2019_03_01.models.TriggerEventType - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - } - - _subtype_map = { - 'kind': {'FileEvent': 'FileEventTrigger', 'PeriodicTimerEvent': 'PeriodicTimerEventTrigger'} - } - - def __init__( - self, - **kwargs - ): - super(Trigger, self).__init__(**kwargs) - self.kind = 'Trigger' # type: str - - -class FileEventTrigger(Trigger): - """Trigger details. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: - "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2019_03_01.models.TriggerEventType - :param source_info: Required. File event source details. - :type source_info: ~azure.mgmt.databoxedge.v2019_03_01.models.FileSourceInfo - :param sink_info: Required. Role sink info. - :type sink_info: ~azure.mgmt.databoxedge.v2019_03_01.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against - its usage. For example, if a periodic timer trigger is intended for certain specific IoT - modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'source_info': {'required': True}, - 'sink_info': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'source_info': {'key': 'properties.sourceInfo', 'type': 'FileSourceInfo'}, - 'sink_info': {'key': 'properties.sinkInfo', 'type': 'RoleSinkInfo'}, - 'custom_context_tag': {'key': 'properties.customContextTag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FileEventTrigger, self).__init__(**kwargs) - self.kind = 'FileEvent' # type: str - self.source_info = kwargs['source_info'] - self.sink_info = kwargs['sink_info'] - self.custom_context_tag = kwargs.get('custom_context_tag', None) - - -class FileSourceInfo(msrest.serialization.Model): - """File source details. - - All required parameters must be populated in order to send to Azure. - - :param share_id: Required. File share ID. - :type share_id: str - """ - - _validation = { - 'share_id': {'required': True}, - } - - _attribute_map = { - 'share_id': {'key': 'shareId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FileSourceInfo, self).__init__(**kwargs) - self.share_id = kwargs['share_id'] - - -class IoTDeviceInfo(msrest.serialization.Model): - """Metadata of IoT device/IoT Edge device to be configured. - - All required parameters must be populated in order to send to Azure. - - :param device_id: Required. ID of the IoT device/edge device. - :type device_id: str - :param io_t_host_hub: Required. Host name for the IoT hub associated to the device. - :type io_t_host_hub: str - :param authentication: IoT device authentication info. - :type authentication: ~azure.mgmt.databoxedge.v2019_03_01.models.Authentication - """ - - _validation = { - 'device_id': {'required': True}, - 'io_t_host_hub': {'required': True}, - } - - _attribute_map = { - 'device_id': {'key': 'deviceId', 'type': 'str'}, - 'io_t_host_hub': {'key': 'ioTHostHub', 'type': 'str'}, - 'authentication': {'key': 'authentication', 'type': 'Authentication'}, - } - - def __init__( - self, - **kwargs - ): - super(IoTDeviceInfo, self).__init__(**kwargs) - self.device_id = kwargs['device_id'] - self.io_t_host_hub = kwargs['io_t_host_hub'] - self.authentication = kwargs.get('authentication', None) - - -class Role(ARMBaseModel): - """Compute role. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: IoTRole. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", - "ASA", "Functions", "Cognitive". - :type kind: str or ~azure.mgmt.databoxedge.v2019_03_01.models.RoleTypes - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - } - - _subtype_map = { - 'kind': {'IOT': 'IoTRole'} - } - - def __init__( - self, - **kwargs - ): - super(Role, self).__init__(**kwargs) - self.kind = 'Role' # type: str - - -class IoTRole(Role): - """Compute role. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", - "ASA", "Functions", "Cognitive". - :type kind: str or ~azure.mgmt.databoxedge.v2019_03_01.models.RoleTypes - :param host_platform: Host OS supported by the IoT role. Possible values include: "Windows", - "Linux". - :type host_platform: str or ~azure.mgmt.databoxedge.v2019_03_01.models.PlatformType - :param io_t_device_details: IoT device metadata to which data box edge device needs to be - connected. - :type io_t_device_details: ~azure.mgmt.databoxedge.v2019_03_01.models.IoTDeviceInfo - :param io_t_edge_device_details: IoT edge device to which the IoT role needs to be configured. - :type io_t_edge_device_details: ~azure.mgmt.databoxedge.v2019_03_01.models.IoTDeviceInfo - :param share_mappings: Mount points of shares in role(s). - :type share_mappings: list[~azure.mgmt.databoxedge.v2019_03_01.models.MountPointMap] - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2019_03_01.models.RoleStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'host_platform': {'key': 'properties.hostPlatform', 'type': 'str'}, - 'io_t_device_details': {'key': 'properties.ioTDeviceDetails', 'type': 'IoTDeviceInfo'}, - 'io_t_edge_device_details': {'key': 'properties.ioTEdgeDeviceDetails', 'type': 'IoTDeviceInfo'}, - 'share_mappings': {'key': 'properties.shareMappings', 'type': '[MountPointMap]'}, - 'role_status': {'key': 'properties.roleStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IoTRole, self).__init__(**kwargs) - self.kind = 'IOT' # type: str - self.host_platform = kwargs.get('host_platform', None) - self.io_t_device_details = kwargs.get('io_t_device_details', None) - self.io_t_edge_device_details = kwargs.get('io_t_edge_device_details', None) - self.share_mappings = kwargs.get('share_mappings', None) - self.role_status = kwargs.get('role_status', None) - - -class Ipv4Config(msrest.serialization.Model): - """Details related to the IPv4 address configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar ip_address: The IPv4 address of the network adapter. - :vartype ip_address: str - :ivar subnet: The IPv4 subnet of the network adapter. - :vartype subnet: str - :ivar gateway: The IPv4 gateway of the network adapter. - :vartype gateway: str - """ - - _validation = { - 'ip_address': {'readonly': True}, - 'subnet': {'readonly': True}, - 'gateway': {'readonly': True}, - } - - _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'subnet': {'key': 'subnet', 'type': 'str'}, - 'gateway': {'key': 'gateway', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Ipv4Config, self).__init__(**kwargs) - self.ip_address = None - self.subnet = None - self.gateway = None - - -class Ipv6Config(msrest.serialization.Model): - """Details related to the IPv6 address configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar ip_address: The IPv6 address of the network adapter. - :vartype ip_address: str - :ivar prefix_length: The IPv6 prefix of the network adapter. - :vartype prefix_length: int - :ivar gateway: The IPv6 gateway of the network adapter. - :vartype gateway: str - """ - - _validation = { - 'ip_address': {'readonly': True}, - 'prefix_length': {'readonly': True}, - 'gateway': {'readonly': True}, - } - - _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'prefix_length': {'key': 'prefixLength', 'type': 'int'}, - 'gateway': {'key': 'gateway', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Ipv6Config, self).__init__(**kwargs) - self.ip_address = None - self.prefix_length = None - self.gateway = None - - -class Job(msrest.serialization.Model): - """A device job. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The name of the object. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar status: The current status of the job. Possible values include: "Invalid", "Running", - "Succeeded", "Failed", "Canceled", "Paused", "Scheduled". - :vartype status: str or ~azure.mgmt.databoxedge.v2019_03_01.models.JobStatus - :ivar start_time: The UTC date and time at which the job started. - :vartype start_time: ~datetime.datetime - :ivar end_time: The UTC date and time at which the job completed. - :vartype end_time: ~datetime.datetime - :ivar percent_complete: The percentage of the job that is complete. - :vartype percent_complete: int - :ivar error: The error details. - :vartype error: ~azure.mgmt.databoxedge.v2019_03_01.models.JobErrorDetails - :ivar job_type: The type of the job. Possible values include: "Invalid", "ScanForUpdates", - "DownloadUpdates", "InstallUpdates", "RefreshShare". - :vartype job_type: str or ~azure.mgmt.databoxedge.v2019_03_01.models.JobType - :ivar current_stage: Current stage of the update operation. Possible values include: "Unknown", - "Initial", "ScanStarted", "ScanComplete", "ScanFailed", "DownloadStarted", "DownloadComplete", - "DownloadFailed", "InstallStarted", "InstallComplete", "InstallFailed", "RebootInitiated", - "Success", "Failure", "RescanStarted", "RescanComplete", "RescanFailed". - :vartype current_stage: str or ~azure.mgmt.databoxedge.v2019_03_01.models.UpdateOperationStage - :ivar download_progress: The download progress. - :vartype download_progress: ~azure.mgmt.databoxedge.v2019_03_01.models.UpdateDownloadProgress - :ivar install_progress: The install progress. - :vartype install_progress: ~azure.mgmt.databoxedge.v2019_03_01.models.UpdateInstallProgress - :ivar total_refresh_errors: Total number of errors encountered during the refresh process. - :vartype total_refresh_errors: int - :ivar error_manifest_file: Local share/remote container relative path to the error manifest - file of the refresh. - :vartype error_manifest_file: str - :ivar share_id: ARM ID of the share that was refreshed. - :vartype share_id: str - :param folder: If only subfolders need to be refreshed, then the subfolder path inside the - share. (The path is empty if there are no subfolders.). - :type folder: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'status': {'readonly': True}, - 'start_time': {'readonly': True}, - 'end_time': {'readonly': True}, - 'percent_complete': {'readonly': True}, - 'error': {'readonly': True}, - 'job_type': {'readonly': True}, - 'current_stage': {'readonly': True}, - 'download_progress': {'readonly': True}, - 'install_progress': {'readonly': True}, - 'total_refresh_errors': {'readonly': True}, - 'error_manifest_file': {'readonly': True}, - 'share_id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'percent_complete': {'key': 'percentComplete', 'type': 'int'}, - 'error': {'key': 'error', 'type': 'JobErrorDetails'}, - 'job_type': {'key': 'properties.jobType', 'type': 'str'}, - 'current_stage': {'key': 'properties.currentStage', 'type': 'str'}, - 'download_progress': {'key': 'properties.downloadProgress', 'type': 'UpdateDownloadProgress'}, - 'install_progress': {'key': 'properties.installProgress', 'type': 'UpdateInstallProgress'}, - 'total_refresh_errors': {'key': 'properties.totalRefreshErrors', 'type': 'int'}, - 'error_manifest_file': {'key': 'properties.errorManifestFile', 'type': 'str'}, - 'share_id': {'key': 'properties.shareId', 'type': 'str'}, - 'folder': {'key': 'properties.folder', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Job, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.status = None - self.start_time = None - self.end_time = None - self.percent_complete = None - self.error = None - self.job_type = None - self.current_stage = None - self.download_progress = None - self.install_progress = None - self.total_refresh_errors = None - self.error_manifest_file = None - self.share_id = None - self.folder = kwargs.get('folder', None) - - -class JobErrorDetails(msrest.serialization.Model): - """The job error information containing the list of job errors. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error_details: The error details. - :vartype error_details: list[~azure.mgmt.databoxedge.v2019_03_01.models.JobErrorItem] - :ivar code: The code intended for programmatic access. - :vartype code: str - :ivar message: The message that describes the error in detail. - :vartype message: str - """ - - _validation = { - 'error_details': {'readonly': True}, - 'code': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'error_details': {'key': 'errorDetails', 'type': '[JobErrorItem]'}, - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(JobErrorDetails, self).__init__(**kwargs) - self.error_details = None - self.code = None - self.message = None - - -class JobErrorItem(msrest.serialization.Model): - """The job error items. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar recommendations: The recommended actions. - :vartype recommendations: list[str] - :ivar code: The code intended for programmatic access. - :vartype code: str - :ivar message: The message that describes the error in detail. - :vartype message: str - """ - - _validation = { - 'recommendations': {'readonly': True}, - 'code': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'recommendations': {'key': 'recommendations', 'type': '[str]'}, - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(JobErrorItem, self).__init__(**kwargs) - self.recommendations = None - self.code = None - self.message = None - - -class MetricDimensionV1(msrest.serialization.Model): - """Metric Dimension v1. - - :param name: Name of the metrics dimension. - :type name: str - :param display_name: Display name of the metrics dimension. - :type display_name: str - :param to_be_exported_for_shoebox: To be exported to shoe box. - :type to_be_exported_for_shoebox: bool - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricDimensionV1, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) - - -class MetricSpecificationV1(msrest.serialization.Model): - """Metric specification version 1. - - :param name: Name of the metric. - :type name: str - :param display_name: Display name of the metric. - :type display_name: str - :param display_description: Description of the metric to be displayed. - :type display_description: str - :param unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", - "Seconds", "Milliseconds", "Bytes", "BytesPerSecond", "CountPerSecond". - :type unit: str or ~azure.mgmt.databoxedge.v2019_03_01.models.MetricUnit - :param aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", - "None", "Average", "Minimum", "Maximum", "Total", "Count". - :type aggregation_type: str or ~azure.mgmt.databoxedge.v2019_03_01.models.MetricAggregationType - :param dimensions: Metric dimensions, other than default dimension which is resource. - :type dimensions: list[~azure.mgmt.databoxedge.v2019_03_01.models.MetricDimensionV1] - :param fill_gap_with_zero: Set true to fill the gaps with zero. - :type fill_gap_with_zero: bool - :param category: Metric category. Possible values include: "Capacity", "Transaction". - :type category: str or ~azure.mgmt.databoxedge.v2019_03_01.models.MetricCategory - :param resource_id_dimension_name_override: Resource name override. - :type resource_id_dimension_name_override: str - :param supported_time_grain_types: Support granularity of metrics. - :type supported_time_grain_types: list[str or - ~azure.mgmt.databoxedge.v2019_03_01.models.TimeGrain] - :param supported_aggregation_types: Support metric aggregation type. - :type supported_aggregation_types: list[str or - ~azure.mgmt.databoxedge.v2019_03_01.models.MetricAggregationType] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[MetricDimensionV1]'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'category': {'key': 'category', 'type': 'str'}, - 'resource_id_dimension_name_override': {'key': 'resourceIdDimensionNameOverride', 'type': 'str'}, - 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, - 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricSpecificationV1, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.dimensions = kwargs.get('dimensions', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.category = kwargs.get('category', None) - self.resource_id_dimension_name_override = kwargs.get('resource_id_dimension_name_override', None) - self.supported_time_grain_types = kwargs.get('supported_time_grain_types', None) - self.supported_aggregation_types = kwargs.get('supported_aggregation_types', None) - - -class MountPointMap(msrest.serialization.Model): - """The share mount point. - - 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 share_id: Required. ID of the share mounted to the role VM. - :type share_id: str - :ivar role_id: ID of the role to which share is mounted. - :vartype role_id: str - :ivar mount_point: Mount point for the share. - :vartype mount_point: str - :ivar role_type: Role type. Possible values include: "IOT", "ASA", "Functions", "Cognitive". - :vartype role_type: str or ~azure.mgmt.databoxedge.v2019_03_01.models.RoleTypes - """ - - _validation = { - 'share_id': {'required': True}, - 'role_id': {'readonly': True}, - 'mount_point': {'readonly': True}, - 'role_type': {'readonly': True}, - } - - _attribute_map = { - 'share_id': {'key': 'shareId', 'type': 'str'}, - 'role_id': {'key': 'roleId', 'type': 'str'}, - 'mount_point': {'key': 'mountPoint', 'type': 'str'}, - 'role_type': {'key': 'roleType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MountPointMap, self).__init__(**kwargs) - self.share_id = kwargs['share_id'] - self.role_id = None - self.mount_point = None - self.role_type = None - - -class NetworkAdapter(msrest.serialization.Model): - """Represents the networkAdapter on a device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar adapter_id: Instance ID of network adapter. - :vartype adapter_id: str - :ivar adapter_position: Hardware position of network adapter. - :vartype adapter_position: ~azure.mgmt.databoxedge.v2019_03_01.models.NetworkAdapterPosition - :ivar index: Logical index of the adapter. - :vartype index: int - :ivar node_id: Node ID of the network adapter. - :vartype node_id: str - :ivar network_adapter_name: Network adapter name. - :vartype network_adapter_name: str - :ivar label: Hardware label for the adapter. - :vartype label: str - :ivar mac_address: MAC address. - :vartype mac_address: str - :ivar link_speed: Link speed. - :vartype link_speed: long - :ivar status: Value indicating whether this adapter is valid. Possible values include: - "Inactive", "Active". - :vartype status: str or ~azure.mgmt.databoxedge.v2019_03_01.models.NetworkAdapterStatus - :param rdma_status: Value indicating whether this adapter is RDMA capable. Possible values - include: "Incapable", "Capable". - :type rdma_status: str or ~azure.mgmt.databoxedge.v2019_03_01.models.NetworkAdapterRDMAStatus - :param dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values - include: "Disabled", "Enabled". - :type dhcp_status: str or ~azure.mgmt.databoxedge.v2019_03_01.models.NetworkAdapterDHCPStatus - :ivar ipv4_configuration: The IPv4 configuration of the network adapter. - :vartype ipv4_configuration: ~azure.mgmt.databoxedge.v2019_03_01.models.Ipv4Config - :ivar ipv6_configuration: The IPv6 configuration of the network adapter. - :vartype ipv6_configuration: ~azure.mgmt.databoxedge.v2019_03_01.models.Ipv6Config - :ivar ipv6_link_local_address: The IPv6 local address. - :vartype ipv6_link_local_address: str - :ivar dns_servers: The list of DNS Servers of the device. - :vartype dns_servers: list[str] - """ - - _validation = { - 'adapter_id': {'readonly': True}, - 'adapter_position': {'readonly': True}, - 'index': {'readonly': True}, - 'node_id': {'readonly': True}, - 'network_adapter_name': {'readonly': True}, - 'label': {'readonly': True}, - 'mac_address': {'readonly': True}, - 'link_speed': {'readonly': True}, - 'status': {'readonly': True}, - 'ipv4_configuration': {'readonly': True}, - 'ipv6_configuration': {'readonly': True}, - 'ipv6_link_local_address': {'readonly': True}, - 'dns_servers': {'readonly': True}, - } - - _attribute_map = { - 'adapter_id': {'key': 'adapterId', 'type': 'str'}, - 'adapter_position': {'key': 'adapterPosition', 'type': 'NetworkAdapterPosition'}, - 'index': {'key': 'index', 'type': 'int'}, - 'node_id': {'key': 'nodeId', 'type': 'str'}, - 'network_adapter_name': {'key': 'networkAdapterName', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'mac_address': {'key': 'macAddress', 'type': 'str'}, - 'link_speed': {'key': 'linkSpeed', 'type': 'long'}, - 'status': {'key': 'status', 'type': 'str'}, - 'rdma_status': {'key': 'rdmaStatus', 'type': 'str'}, - 'dhcp_status': {'key': 'dhcpStatus', 'type': 'str'}, - 'ipv4_configuration': {'key': 'ipv4Configuration', 'type': 'Ipv4Config'}, - 'ipv6_configuration': {'key': 'ipv6Configuration', 'type': 'Ipv6Config'}, - 'ipv6_link_local_address': {'key': 'ipv6LinkLocalAddress', 'type': 'str'}, - 'dns_servers': {'key': 'dnsServers', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkAdapter, self).__init__(**kwargs) - self.adapter_id = None - self.adapter_position = None - self.index = None - self.node_id = None - self.network_adapter_name = None - self.label = None - self.mac_address = None - self.link_speed = None - self.status = None - self.rdma_status = kwargs.get('rdma_status', None) - self.dhcp_status = kwargs.get('dhcp_status', None) - self.ipv4_configuration = None - self.ipv6_configuration = None - self.ipv6_link_local_address = None - self.dns_servers = None - - -class NetworkAdapterPosition(msrest.serialization.Model): - """The network adapter position. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar network_group: The network group. Possible values include: "None", "NonRDMA", "RDMA". - :vartype network_group: str or ~azure.mgmt.databoxedge.v2019_03_01.models.NetworkGroup - :ivar port: The port. - :vartype port: int - """ - - _validation = { - 'network_group': {'readonly': True}, - 'port': {'readonly': True}, - } - - _attribute_map = { - 'network_group': {'key': 'networkGroup', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkAdapterPosition, self).__init__(**kwargs) - self.network_group = None - self.port = None - - -class NetworkSettings(ARMBaseModel): - """The network settings of a device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar network_adapters: The network adapter list on the device. - :vartype network_adapters: list[~azure.mgmt.databoxedge.v2019_03_01.models.NetworkAdapter] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'network_adapters': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'network_adapters': {'key': 'properties.networkAdapters', 'type': '[NetworkAdapter]'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkSettings, self).__init__(**kwargs) - self.network_adapters = None - - -class Operation(msrest.serialization.Model): - """Operations. - - :param name: Name of the operation. - :type name: str - :param display: Properties displayed for the operation. - :type display: ~azure.mgmt.databoxedge.v2019_03_01.models.OperationDisplay - :param origin: Origin of the operation. - :type origin: str - :param service_specification: Service specification. - :type service_specification: ~azure.mgmt.databoxedge.v2019_03_01.models.ServiceSpecification - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplay(msrest.serialization.Model): - """Operation display properties. - - :param provider: Provider name. - :type provider: str - :param resource: The type of resource in which the operation is performed. - :type resource: str - :param operation: Operation to be performed on the resource. - :type operation: str - :param description: Description of the operation to be performed. - :type description: str - """ - - _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 - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationsList(msrest.serialization.Model): - """The list of operations used for the discovery of available provider operations. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The value. - :type value: list[~azure.mgmt.databoxedge.v2019_03_01.models.Operation] - :param next_link: Link to the next set of results. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationsList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class Order(ARMBaseModel): - """The order details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param contact_information: The contact details. - :type contact_information: ~azure.mgmt.databoxedge.v2019_03_01.models.ContactDetails - :param shipping_address: The shipping address. - :type shipping_address: ~azure.mgmt.databoxedge.v2019_03_01.models.Address - :param current_status: Current status of the order. - :type current_status: ~azure.mgmt.databoxedge.v2019_03_01.models.OrderStatus - :ivar order_history: List of status changes in the order. - :vartype order_history: list[~azure.mgmt.databoxedge.v2019_03_01.models.OrderStatus] - :ivar serial_number: Serial number of the device. - :vartype serial_number: str - :ivar delivery_tracking_info: Tracking information for the package delivered to the customer - whether it has an original or a replacement device. - :vartype delivery_tracking_info: list[~azure.mgmt.databoxedge.v2019_03_01.models.TrackingInfo] - :ivar return_tracking_info: Tracking information for the package returned from the customer - whether it has an original or a replacement device. - :vartype return_tracking_info: list[~azure.mgmt.databoxedge.v2019_03_01.models.TrackingInfo] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'order_history': {'readonly': True}, - 'serial_number': {'readonly': True}, - 'delivery_tracking_info': {'readonly': True}, - 'return_tracking_info': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'contact_information': {'key': 'properties.contactInformation', 'type': 'ContactDetails'}, - 'shipping_address': {'key': 'properties.shippingAddress', 'type': 'Address'}, - 'current_status': {'key': 'properties.currentStatus', 'type': 'OrderStatus'}, - 'order_history': {'key': 'properties.orderHistory', 'type': '[OrderStatus]'}, - 'serial_number': {'key': 'properties.serialNumber', 'type': 'str'}, - 'delivery_tracking_info': {'key': 'properties.deliveryTrackingInfo', 'type': '[TrackingInfo]'}, - 'return_tracking_info': {'key': 'properties.returnTrackingInfo', 'type': '[TrackingInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(Order, self).__init__(**kwargs) - self.contact_information = kwargs.get('contact_information', None) - self.shipping_address = kwargs.get('shipping_address', None) - self.current_status = kwargs.get('current_status', None) - self.order_history = None - self.serial_number = None - self.delivery_tracking_info = None - self.return_tracking_info = None - - -class OrderList(msrest.serialization.Model): - """List of order entities. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of orders. - :vartype value: list[~azure.mgmt.databoxedge.v2019_03_01.models.Order] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Order]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OrderList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class OrderStatus(msrest.serialization.Model): - """Represents a single status change. - - 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 status: Required. Status of the order as per the allowed status types. Possible values - include: "Untracked", "AwaitingFulfilment", "AwaitingPreparation", "AwaitingShipment", - "Shipped", "Arriving", "Delivered", "ReplacementRequested", "LostDevice", "Declined", - "ReturnInitiated", "AwaitingReturnShipment", "ShippedBack", "CollectedAtMicrosoft". - :type status: str or ~azure.mgmt.databoxedge.v2019_03_01.models.OrderState - :ivar update_date_time: Time of status update. - :vartype update_date_time: ~datetime.datetime - :param comments: Comments related to this status change. - :type comments: str - """ - - _validation = { - 'status': {'required': True}, - 'update_date_time': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'update_date_time': {'key': 'updateDateTime', 'type': 'iso-8601'}, - 'comments': {'key': 'comments', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OrderStatus, self).__init__(**kwargs) - self.status = kwargs['status'] - self.update_date_time = None - self.comments = kwargs.get('comments', None) - - -class PeriodicTimerEventTrigger(Trigger): - """Trigger details. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: - "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2019_03_01.models.TriggerEventType - :param source_info: Required. Periodic timer details. - :type source_info: ~azure.mgmt.databoxedge.v2019_03_01.models.PeriodicTimerSourceInfo - :param sink_info: Required. Role Sink information. - :type sink_info: ~azure.mgmt.databoxedge.v2019_03_01.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against - its usage. For example, if a periodic timer trigger is intended for certain specific IoT - modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'source_info': {'required': True}, - 'sink_info': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'source_info': {'key': 'properties.sourceInfo', 'type': 'PeriodicTimerSourceInfo'}, - 'sink_info': {'key': 'properties.sinkInfo', 'type': 'RoleSinkInfo'}, - 'custom_context_tag': {'key': 'properties.customContextTag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PeriodicTimerEventTrigger, self).__init__(**kwargs) - self.kind = 'PeriodicTimerEvent' # type: str - self.source_info = kwargs['source_info'] - self.sink_info = kwargs['sink_info'] - self.custom_context_tag = kwargs.get('custom_context_tag', None) - - -class PeriodicTimerSourceInfo(msrest.serialization.Model): - """Periodic timer event source. - - All required parameters must be populated in order to send to Azure. - - :param start_time: Required. The time of the day that results in a valid trigger. Schedule is - computed with reference to the time specified up to seconds. If timezone is not specified the - time will considered to be in device timezone. The value will always be returned as UTC time. - :type start_time: ~datetime.datetime - :param schedule: Required. Periodic frequency at which timer event needs to be raised. Supports - daily, hourly, minutes, and seconds. - :type schedule: str - :param topic: Topic where periodic events are published to IoT device. - :type topic: str - """ - - _validation = { - 'start_time': {'required': True}, - 'schedule': {'required': True}, - } - - _attribute_map = { - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'schedule': {'key': 'schedule', 'type': 'str'}, - 'topic': {'key': 'topic', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PeriodicTimerSourceInfo, self).__init__(**kwargs) - self.start_time = kwargs['start_time'] - self.schedule = kwargs['schedule'] - self.topic = kwargs.get('topic', None) - - -class RefreshDetails(msrest.serialization.Model): - """Fields for tracking refresh job on the share. - - :param in_progress_refresh_job_id: If a refresh share job is currently in progress on this - share, this field indicates the ARM resource ID of that job. The field is empty if no job is in - progress. - :type in_progress_refresh_job_id: str - :param last_completed_refresh_job_time_in_utc: Indicates the completed time for the last - refresh job on this particular share, if any.This could be a failed job or a successful job. - :type last_completed_refresh_job_time_in_utc: ~datetime.datetime - :param error_manifest_file: Indicates the relative path of the error xml for the last refresh - job on this particular share, if any. This could be a failed job or a successful job. - :type error_manifest_file: str - :param last_job: Indicates the id of the last refresh job on this particular share,if any. This - could be a failed job or a successful job. - :type last_job: str - """ - - _attribute_map = { - 'in_progress_refresh_job_id': {'key': 'inProgressRefreshJobId', 'type': 'str'}, - 'last_completed_refresh_job_time_in_utc': {'key': 'lastCompletedRefreshJobTimeInUTC', 'type': 'iso-8601'}, - 'error_manifest_file': {'key': 'errorManifestFile', 'type': 'str'}, - 'last_job': {'key': 'lastJob', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RefreshDetails, self).__init__(**kwargs) - self.in_progress_refresh_job_id = kwargs.get('in_progress_refresh_job_id', None) - self.last_completed_refresh_job_time_in_utc = kwargs.get('last_completed_refresh_job_time_in_utc', None) - self.error_manifest_file = kwargs.get('error_manifest_file', None) - self.last_job = kwargs.get('last_job', None) - - -class RoleList(msrest.serialization.Model): - """Collection of all the roles on the Data Box Edge device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The Value. - :vartype value: list[~azure.mgmt.databoxedge.v2019_03_01.models.Role] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Role]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RoleList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class RoleSinkInfo(msrest.serialization.Model): - """Compute role against which events will be raised. - - All required parameters must be populated in order to send to Azure. - - :param role_id: Required. Compute role ID. - :type role_id: str - """ - - _validation = { - 'role_id': {'required': True}, - } - - _attribute_map = { - 'role_id': {'key': 'roleId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RoleSinkInfo, self).__init__(**kwargs) - self.role_id = kwargs['role_id'] - - -class SecuritySettings(ARMBaseModel): - """The security settings of a device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param device_admin_password: Required. Device administrator password as an encrypted string - (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual - password should have at least 8 characters that are a combination of uppercase, lowercase, - numeric, and special characters. - :type device_admin_password: - ~azure.mgmt.databoxedge.v2019_03_01.models.AsymmetricEncryptedSecret - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'device_admin_password': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'device_admin_password': {'key': 'properties.deviceAdminPassword', 'type': 'AsymmetricEncryptedSecret'}, - } - - def __init__( - self, - **kwargs - ): - super(SecuritySettings, self).__init__(**kwargs) - self.device_admin_password = kwargs['device_admin_password'] - - -class ServiceSpecification(msrest.serialization.Model): - """Service specification. - - :param metric_specifications: Metric specification as defined by shoebox. - :type metric_specifications: - list[~azure.mgmt.databoxedge.v2019_03_01.models.MetricSpecificationV1] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecificationV1]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class Share(ARMBaseModel): - """Represents a share on the Data Box Edge/Gateway device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param description: Description for the share. - :type description: str - :param share_status: Required. Current status of the share. Possible values include: "Online", - "Offline". - :type share_status: str or ~azure.mgmt.databoxedge.v2019_03_01.models.ShareStatus - :param monitoring_status: Required. Current monitoring status of the share. Possible values - include: "Enabled", "Disabled". - :type monitoring_status: str or ~azure.mgmt.databoxedge.v2019_03_01.models.MonitoringStatus - :param azure_container_info: Azure container mapping for the share. - :type azure_container_info: ~azure.mgmt.databoxedge.v2019_03_01.models.AzureContainerInfo - :param access_protocol: Required. Access protocol to be used by the share. Possible values - include: "SMB", "NFS". - :type access_protocol: str or ~azure.mgmt.databoxedge.v2019_03_01.models.ShareAccessProtocol - :param user_access_rights: Mapping of users and corresponding access rights on the share - (required for SMB protocol). - :type user_access_rights: list[~azure.mgmt.databoxedge.v2019_03_01.models.UserAccessRight] - :param client_access_rights: List of IP addresses and corresponding access rights on the - share(required for NFS protocol). - :type client_access_rights: list[~azure.mgmt.databoxedge.v2019_03_01.models.ClientAccessRight] - :param refresh_details: Details of the refresh job on this share. - :type refresh_details: ~azure.mgmt.databoxedge.v2019_03_01.models.RefreshDetails - :ivar share_mappings: Share mount point to the role. - :vartype share_mappings: list[~azure.mgmt.databoxedge.v2019_03_01.models.MountPointMap] - :param data_policy: Data policy of the share. Possible values include: "Cloud", "Local". - :type data_policy: str or ~azure.mgmt.databoxedge.v2019_03_01.models.DataPolicy - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'share_status': {'required': True}, - 'monitoring_status': {'required': True}, - 'access_protocol': {'required': True}, - 'share_mappings': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'share_status': {'key': 'properties.shareStatus', 'type': 'str'}, - 'monitoring_status': {'key': 'properties.monitoringStatus', 'type': 'str'}, - 'azure_container_info': {'key': 'properties.azureContainerInfo', 'type': 'AzureContainerInfo'}, - 'access_protocol': {'key': 'properties.accessProtocol', 'type': 'str'}, - 'user_access_rights': {'key': 'properties.userAccessRights', 'type': '[UserAccessRight]'}, - 'client_access_rights': {'key': 'properties.clientAccessRights', 'type': '[ClientAccessRight]'}, - 'refresh_details': {'key': 'properties.refreshDetails', 'type': 'RefreshDetails'}, - 'share_mappings': {'key': 'properties.shareMappings', 'type': '[MountPointMap]'}, - 'data_policy': {'key': 'properties.dataPolicy', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Share, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.share_status = kwargs['share_status'] - self.monitoring_status = kwargs['monitoring_status'] - self.azure_container_info = kwargs.get('azure_container_info', None) - self.access_protocol = kwargs['access_protocol'] - self.user_access_rights = kwargs.get('user_access_rights', None) - self.client_access_rights = kwargs.get('client_access_rights', None) - self.refresh_details = kwargs.get('refresh_details', None) - self.share_mappings = None - self.data_policy = kwargs.get('data_policy', None) - - -class ShareAccessRight(msrest.serialization.Model): - """Specifies the mapping between this particular user and the type of access he has on shares on this device. - - All required parameters must be populated in order to send to Azure. - - :param share_id: Required. The share ID. - :type share_id: str - :param access_type: Required. Type of access to be allowed on the share for this user. Possible - values include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2019_03_01.models.ShareAccessType - """ - - _validation = { - 'share_id': {'required': True}, - 'access_type': {'required': True}, - } - - _attribute_map = { - 'share_id': {'key': 'shareId', 'type': 'str'}, - 'access_type': {'key': 'accessType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ShareAccessRight, self).__init__(**kwargs) - self.share_id = kwargs['share_id'] - self.access_type = kwargs['access_type'] - - -class ShareList(msrest.serialization.Model): - """Collection of all the shares on the Data Box Edge/Gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of shares. - :vartype value: list[~azure.mgmt.databoxedge.v2019_03_01.models.Share] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Share]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ShareList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class Sku(msrest.serialization.Model): - """The SKU type. - - :param name: SKU name. Possible values include: "Gateway", "Edge". - :type name: str or ~azure.mgmt.databoxedge.v2019_03_01.models.SkuName - :param tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard". - :type tier: str or ~azure.mgmt.databoxedge.v2019_03_01.models.SkuTier - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = kwargs.get('tier', None) - - -class StorageAccountCredential(ARMBaseModel): - """The storage account credential. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param alias: Required. Alias for the storage account. - :type alias: str - :param user_name: Username for the storage account. - :type user_name: str - :param account_key: Encrypted storage key. - :type account_key: ~azure.mgmt.databoxedge.v2019_03_01.models.AsymmetricEncryptedSecret - :param connection_string: Connection string for the storage account. Use this string if - username and account key are not specified. - :type connection_string: str - :param ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible values - include: "Enabled", "Disabled". - :type ssl_status: str or ~azure.mgmt.databoxedge.v2019_03_01.models.SSLStatus - :param blob_domain_name: Blob end point for private clouds. - :type blob_domain_name: str - :param account_type: Required. Type of storage accessed on the storage account. Possible values - include: "GeneralPurposeStorage", "BlobStorage". - :type account_type: str or ~azure.mgmt.databoxedge.v2019_03_01.models.AccountType - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'alias': {'required': True}, - 'ssl_status': {'required': True}, - 'account_type': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'alias': {'key': 'properties.alias', 'type': 'str'}, - 'user_name': {'key': 'properties.userName', 'type': 'str'}, - 'account_key': {'key': 'properties.accountKey', 'type': 'AsymmetricEncryptedSecret'}, - 'connection_string': {'key': 'properties.connectionString', 'type': 'str'}, - 'ssl_status': {'key': 'properties.sslStatus', 'type': 'str'}, - 'blob_domain_name': {'key': 'properties.blobDomainName', 'type': 'str'}, - 'account_type': {'key': 'properties.accountType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCredential, self).__init__(**kwargs) - self.alias = kwargs['alias'] - self.user_name = kwargs.get('user_name', None) - self.account_key = kwargs.get('account_key', None) - self.connection_string = kwargs.get('connection_string', None) - self.ssl_status = kwargs['ssl_status'] - self.blob_domain_name = kwargs.get('blob_domain_name', None) - self.account_type = kwargs['account_type'] - - -class StorageAccountCredentialList(msrest.serialization.Model): - """The collection of storage account credentials. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The value. - :vartype value: list[~azure.mgmt.databoxedge.v2019_03_01.models.StorageAccountCredential] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccountCredential]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCredentialList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SymmetricKey(msrest.serialization.Model): - """Symmetric key for authentication. - - :param connection_string: Connection string based on the symmetric key. - :type connection_string: ~azure.mgmt.databoxedge.v2019_03_01.models.AsymmetricEncryptedSecret - """ - - _attribute_map = { - 'connection_string': {'key': 'connectionString', 'type': 'AsymmetricEncryptedSecret'}, - } - - def __init__( - self, - **kwargs - ): - super(SymmetricKey, self).__init__(**kwargs) - self.connection_string = kwargs.get('connection_string', None) - - -class TrackingInfo(msrest.serialization.Model): - """Tracking courier information. - - :param serial_number: Serial number of the device being tracked. - :type serial_number: str - :param carrier_name: Name of the carrier used in the delivery. - :type carrier_name: str - :param tracking_id: Tracking ID of the shipment. - :type tracking_id: str - :param tracking_url: Tracking URL of the shipment. - :type tracking_url: str - """ - - _attribute_map = { - 'serial_number': {'key': 'serialNumber', 'type': 'str'}, - 'carrier_name': {'key': 'carrierName', 'type': 'str'}, - 'tracking_id': {'key': 'trackingId', 'type': 'str'}, - 'tracking_url': {'key': 'trackingUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackingInfo, self).__init__(**kwargs) - self.serial_number = kwargs.get('serial_number', None) - self.carrier_name = kwargs.get('carrier_name', None) - self.tracking_id = kwargs.get('tracking_id', None) - self.tracking_url = kwargs.get('tracking_url', None) - - -class TriggerList(msrest.serialization.Model): - """Collection of all trigger on the data box edge device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of triggers. - :vartype value: list[~azure.mgmt.databoxedge.v2019_03_01.models.Trigger] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Trigger]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TriggerList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class UpdateDownloadProgress(msrest.serialization.Model): - """Details about the download progress of update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar download_phase: The download phase. Possible values include: "Unknown", "Initializing", - "Downloading", "Verifying". - :vartype download_phase: str or ~azure.mgmt.databoxedge.v2019_03_01.models.DownloadPhase - :ivar percent_complete: Percentage of completion. - :vartype percent_complete: int - :ivar total_bytes_to_download: Total bytes to download. - :vartype total_bytes_to_download: float - :ivar total_bytes_downloaded: Total bytes downloaded. - :vartype total_bytes_downloaded: float - :ivar number_of_updates_to_download: Number of updates to download. - :vartype number_of_updates_to_download: int - :ivar number_of_updates_downloaded: Number of updates downloaded. - :vartype number_of_updates_downloaded: int - """ - - _validation = { - 'download_phase': {'readonly': True}, - 'percent_complete': {'readonly': True}, - 'total_bytes_to_download': {'readonly': True}, - 'total_bytes_downloaded': {'readonly': True}, - 'number_of_updates_to_download': {'readonly': True}, - 'number_of_updates_downloaded': {'readonly': True}, - } - - _attribute_map = { - 'download_phase': {'key': 'downloadPhase', 'type': 'str'}, - 'percent_complete': {'key': 'percentComplete', 'type': 'int'}, - 'total_bytes_to_download': {'key': 'totalBytesToDownload', 'type': 'float'}, - 'total_bytes_downloaded': {'key': 'totalBytesDownloaded', 'type': 'float'}, - 'number_of_updates_to_download': {'key': 'numberOfUpdatesToDownload', 'type': 'int'}, - 'number_of_updates_downloaded': {'key': 'numberOfUpdatesDownloaded', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateDownloadProgress, self).__init__(**kwargs) - self.download_phase = None - self.percent_complete = None - self.total_bytes_to_download = None - self.total_bytes_downloaded = None - self.number_of_updates_to_download = None - self.number_of_updates_downloaded = None - - -class UpdateInstallProgress(msrest.serialization.Model): - """Progress details during installation of updates. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar percent_complete: Percentage completed. - :vartype percent_complete: int - :ivar number_of_updates_to_install: Number of updates to install. - :vartype number_of_updates_to_install: int - :ivar number_of_updates_installed: Number of updates installed. - :vartype number_of_updates_installed: int - """ - - _validation = { - 'percent_complete': {'readonly': True}, - 'number_of_updates_to_install': {'readonly': True}, - 'number_of_updates_installed': {'readonly': True}, - } - - _attribute_map = { - 'percent_complete': {'key': 'percentComplete', 'type': 'int'}, - 'number_of_updates_to_install': {'key': 'numberOfUpdatesToInstall', 'type': 'int'}, - 'number_of_updates_installed': {'key': 'numberOfUpdatesInstalled', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateInstallProgress, self).__init__(**kwargs) - self.percent_complete = None - self.number_of_updates_to_install = None - self.number_of_updates_installed = None - - -class UpdateSummary(ARMBaseModel): - """Details about ongoing updates and availability of updates on the device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param device_version_number: The current version of the device in format: 1.2.17312.13.",. - :type device_version_number: str - :param friendly_device_version_name: The current version of the device in text format. - :type friendly_device_version_name: str - :param device_last_scanned_date_time: The last time when a scan was done on the device. - :type device_last_scanned_date_time: ~datetime.datetime - :param last_completed_scan_job_date_time: The time when the last scan job was completed - (success/cancelled/failed) on the appliance. - :type last_completed_scan_job_date_time: ~datetime.datetime - :ivar last_completed_download_job_date_time: The time when the last Download job was completed - (success/cancelled/failed) on the appliance. - :vartype last_completed_download_job_date_time: ~datetime.datetime - :ivar last_completed_install_job_date_time: The time when the last Install job was completed - (success/cancelled/failed) on the appliance. - :vartype last_completed_install_job_date_time: ~datetime.datetime - :ivar total_number_of_updates_available: The number of updates available for the current device - version as per the last device scan. - :vartype total_number_of_updates_available: int - :ivar total_number_of_updates_pending_download: The total number of items pending download. - :vartype total_number_of_updates_pending_download: int - :ivar total_number_of_updates_pending_install: The total number of items pending install. - :vartype total_number_of_updates_pending_install: int - :ivar reboot_behavior: Indicates if updates are available and at least one of the updates needs - a reboot. Possible values include: "NeverReboots", "RequiresReboot", "RequestReboot". - :vartype reboot_behavior: str or - ~azure.mgmt.databoxedge.v2019_03_01.models.InstallRebootBehavior - :ivar ongoing_update_operation: The current update operation. Possible values include: "None", - "Scan", "Download", "Install". - :vartype ongoing_update_operation: str or - ~azure.mgmt.databoxedge.v2019_03_01.models.UpdateOperation - :ivar in_progress_download_job_id: The job ID of the download job in progress. - :vartype in_progress_download_job_id: str - :ivar in_progress_install_job_id: The job ID of the install job in progress. - :vartype in_progress_install_job_id: str - :ivar in_progress_download_job_started_date_time: The time when the currently running download - (if any) started. - :vartype in_progress_download_job_started_date_time: ~datetime.datetime - :ivar in_progress_install_job_started_date_time: The time when the currently running install - (if any) started. - :vartype in_progress_install_job_started_date_time: ~datetime.datetime - :ivar update_titles: The list of updates available for install. - :vartype update_titles: list[str] - :ivar total_update_size_in_bytes: The total size of updates available for download in bytes. - :vartype total_update_size_in_bytes: float - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'last_completed_download_job_date_time': {'readonly': True}, - 'last_completed_install_job_date_time': {'readonly': True}, - 'total_number_of_updates_available': {'readonly': True}, - 'total_number_of_updates_pending_download': {'readonly': True}, - 'total_number_of_updates_pending_install': {'readonly': True}, - 'reboot_behavior': {'readonly': True}, - 'ongoing_update_operation': {'readonly': True}, - 'in_progress_download_job_id': {'readonly': True}, - 'in_progress_install_job_id': {'readonly': True}, - 'in_progress_download_job_started_date_time': {'readonly': True}, - 'in_progress_install_job_started_date_time': {'readonly': True}, - 'update_titles': {'readonly': True}, - 'total_update_size_in_bytes': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'device_version_number': {'key': 'properties.deviceVersionNumber', 'type': 'str'}, - 'friendly_device_version_name': {'key': 'properties.friendlyDeviceVersionName', 'type': 'str'}, - 'device_last_scanned_date_time': {'key': 'properties.deviceLastScannedDateTime', 'type': 'iso-8601'}, - 'last_completed_scan_job_date_time': {'key': 'properties.lastCompletedScanJobDateTime', 'type': 'iso-8601'}, - 'last_completed_download_job_date_time': {'key': 'properties.lastCompletedDownloadJobDateTime', 'type': 'iso-8601'}, - 'last_completed_install_job_date_time': {'key': 'properties.lastCompletedInstallJobDateTime', 'type': 'iso-8601'}, - 'total_number_of_updates_available': {'key': 'properties.totalNumberOfUpdatesAvailable', 'type': 'int'}, - 'total_number_of_updates_pending_download': {'key': 'properties.totalNumberOfUpdatesPendingDownload', 'type': 'int'}, - 'total_number_of_updates_pending_install': {'key': 'properties.totalNumberOfUpdatesPendingInstall', 'type': 'int'}, - 'reboot_behavior': {'key': 'properties.rebootBehavior', 'type': 'str'}, - 'ongoing_update_operation': {'key': 'properties.ongoingUpdateOperation', 'type': 'str'}, - 'in_progress_download_job_id': {'key': 'properties.inProgressDownloadJobId', 'type': 'str'}, - 'in_progress_install_job_id': {'key': 'properties.inProgressInstallJobId', 'type': 'str'}, - 'in_progress_download_job_started_date_time': {'key': 'properties.inProgressDownloadJobStartedDateTime', 'type': 'iso-8601'}, - 'in_progress_install_job_started_date_time': {'key': 'properties.inProgressInstallJobStartedDateTime', 'type': 'iso-8601'}, - 'update_titles': {'key': 'properties.updateTitles', 'type': '[str]'}, - 'total_update_size_in_bytes': {'key': 'properties.totalUpdateSizeInBytes', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateSummary, self).__init__(**kwargs) - self.device_version_number = kwargs.get('device_version_number', None) - self.friendly_device_version_name = kwargs.get('friendly_device_version_name', None) - self.device_last_scanned_date_time = kwargs.get('device_last_scanned_date_time', None) - self.last_completed_scan_job_date_time = kwargs.get('last_completed_scan_job_date_time', None) - self.last_completed_download_job_date_time = None - self.last_completed_install_job_date_time = None - self.total_number_of_updates_available = None - self.total_number_of_updates_pending_download = None - self.total_number_of_updates_pending_install = None - self.reboot_behavior = None - self.ongoing_update_operation = None - self.in_progress_download_job_id = None - self.in_progress_install_job_id = None - self.in_progress_download_job_started_date_time = None - self.in_progress_install_job_started_date_time = None - self.update_titles = None - self.total_update_size_in_bytes = None - - -class UploadCertificateRequest(msrest.serialization.Model): - """The upload certificate request. - - All required parameters must be populated in order to send to Azure. - - :param authentication_type: The authentication type. Possible values include: "Invalid", - "AzureActiveDirectory". - :type authentication_type: str or ~azure.mgmt.databoxedge.v2019_03_01.models.AuthenticationType - :param certificate: Required. The base64 encoded certificate raw data. - :type certificate: str - """ - - _validation = { - 'certificate': {'required': True}, - } - - _attribute_map = { - 'authentication_type': {'key': 'properties.authenticationType', 'type': 'str'}, - 'certificate': {'key': 'properties.certificate', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UploadCertificateRequest, self).__init__(**kwargs) - self.authentication_type = kwargs.get('authentication_type', None) - self.certificate = kwargs['certificate'] - - -class UploadCertificateResponse(msrest.serialization.Model): - """The upload registration certificate response. - - All required parameters must be populated in order to send to Azure. - - :param auth_type: Specifies authentication type. Possible values include: "Invalid", - "AzureActiveDirectory". - :type auth_type: str or ~azure.mgmt.databoxedge.v2019_03_01.models.AuthenticationType - :param resource_id: Required. The resource ID of the Data Box Edge/Gateway device. - :type resource_id: str - :param aad_authority: Required. Azure Active Directory tenant authority. - :type aad_authority: str - :param aad_tenant_id: Required. Azure Active Directory tenant ID. - :type aad_tenant_id: str - :param service_principal_client_id: Required. Azure Active Directory service principal client - ID. - :type service_principal_client_id: str - :param service_principal_object_id: Required. Azure Active Directory service principal object - ID. - :type service_principal_object_id: str - :param azure_management_endpoint_audience: Required. The azure management endpoint audience. - :type azure_management_endpoint_audience: str - """ - - _validation = { - 'resource_id': {'required': True}, - 'aad_authority': {'required': True}, - 'aad_tenant_id': {'required': True}, - 'service_principal_client_id': {'required': True}, - 'service_principal_object_id': {'required': True}, - 'azure_management_endpoint_audience': {'required': True}, - } - - _attribute_map = { - 'auth_type': {'key': 'authType', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'aad_authority': {'key': 'aadAuthority', 'type': 'str'}, - 'aad_tenant_id': {'key': 'aadTenantId', 'type': 'str'}, - 'service_principal_client_id': {'key': 'servicePrincipalClientId', 'type': 'str'}, - 'service_principal_object_id': {'key': 'servicePrincipalObjectId', 'type': 'str'}, - 'azure_management_endpoint_audience': {'key': 'azureManagementEndpointAudience', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UploadCertificateResponse, self).__init__(**kwargs) - self.auth_type = kwargs.get('auth_type', None) - self.resource_id = kwargs['resource_id'] - self.aad_authority = kwargs['aad_authority'] - self.aad_tenant_id = kwargs['aad_tenant_id'] - self.service_principal_client_id = kwargs['service_principal_client_id'] - self.service_principal_object_id = kwargs['service_principal_object_id'] - self.azure_management_endpoint_audience = kwargs['azure_management_endpoint_audience'] - - -class User(ARMBaseModel): - """Represents a user who has access to one or more shares on the Data Box Edge/Gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param encrypted_password: The password details. - :type encrypted_password: ~azure.mgmt.databoxedge.v2019_03_01.models.AsymmetricEncryptedSecret - :param share_access_rights: List of shares that the user has rights on. This field should not - be specified during user creation. - :type share_access_rights: list[~azure.mgmt.databoxedge.v2019_03_01.models.ShareAccessRight] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'encrypted_password': {'key': 'properties.encryptedPassword', 'type': 'AsymmetricEncryptedSecret'}, - 'share_access_rights': {'key': 'properties.shareAccessRights', 'type': '[ShareAccessRight]'}, - } - - def __init__( - self, - **kwargs - ): - super(User, self).__init__(**kwargs) - self.encrypted_password = kwargs.get('encrypted_password', None) - self.share_access_rights = kwargs.get('share_access_rights', None) - - -class UserAccessRight(msrest.serialization.Model): - """The mapping between a particular user and the access type on the SMB share. - - All required parameters must be populated in order to send to Azure. - - :param user_id: Required. User ID (already existing in the device). - :type user_id: str - :param access_type: Required. Type of access to be allowed for the user. Possible values - include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2019_03_01.models.ShareAccessType - """ - - _validation = { - 'user_id': {'required': True}, - 'access_type': {'required': True}, - } - - _attribute_map = { - 'user_id': {'key': 'userId', 'type': 'str'}, - 'access_type': {'key': 'accessType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserAccessRight, self).__init__(**kwargs) - self.user_id = kwargs['user_id'] - self.access_type = kwargs['access_type'] - - -class UserList(msrest.serialization.Model): - """Collection of users. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of users. - :vartype value: list[~azure.mgmt.databoxedge.v2019_03_01.models.User] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[User]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserList, self).__init__(**kwargs) - self.value = None - self.next_link = None diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/models/_models_py3.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/models/_models_py3.py index 14dd7a6c2d22..98a0e40cf78b 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/models/_models_py3.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/models/_models_py3.py @@ -19,20 +19,20 @@ class Address(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param address_line1: Required. The address line1. - :type address_line1: str - :param address_line2: The address line2. - :type address_line2: str - :param address_line3: The address line3. - :type address_line3: str - :param postal_code: Required. The postal code. - :type postal_code: str - :param city: Required. The city name. - :type city: str - :param state: Required. The state name. - :type state: str - :param country: Required. The country name. - :type country: str + :ivar address_line1: Required. The address line1. + :vartype address_line1: str + :ivar address_line2: The address line2. + :vartype address_line2: str + :ivar address_line3: The address line3. + :vartype address_line3: str + :ivar postal_code: Required. The postal code. + :vartype postal_code: str + :ivar city: Required. The city name. + :vartype city: str + :ivar state: Required. The state name. + :vartype state: str + :ivar country: Required. The country name. + :vartype country: str """ _validation = { @@ -65,6 +65,22 @@ def __init__( address_line3: Optional[str] = None, **kwargs ): + """ + :keyword address_line1: Required. The address line1. + :paramtype address_line1: str + :keyword address_line2: The address line2. + :paramtype address_line2: str + :keyword address_line3: The address line3. + :paramtype address_line3: str + :keyword postal_code: Required. The postal code. + :paramtype postal_code: str + :keyword city: Required. The city name. + :paramtype city: str + :keyword state: Required. The state name. + :paramtype state: str + :keyword country: Required. The country name. + :paramtype country: str + """ super(Address, self).__init__(**kwargs) self.address_line1 = address_line1 self.address_line2 = address_line2 @@ -104,6 +120,8 @@ def __init__( self, **kwargs ): + """ + """ super(ARMBaseModel, self).__init__(**kwargs) self.id = None self.name = None @@ -168,6 +186,8 @@ def __init__( self, **kwargs ): + """ + """ super(Alert, self).__init__(**kwargs) self.title = None self.alert_type = None @@ -207,6 +227,8 @@ def __init__( self, **kwargs ): + """ + """ super(AlertErrorDetails, self).__init__(**kwargs) self.error_code = None self.error_message = None @@ -238,6 +260,8 @@ def __init__( self, **kwargs ): + """ + """ super(AlertList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -248,14 +272,14 @@ class AsymmetricEncryptedSecret(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The value of the secret. - :type value: str - :param encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the + :ivar value: Required. The value of the secret. + :vartype value: str + :ivar encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the value is unencrypted, it will be null. - :type encryption_cert_thumbprint: str - :param encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values + :vartype encryption_cert_thumbprint: str + :ivar encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values include: "None", "AES256", "RSAES_PKCS1_v_1_5". - :type encryption_algorithm: str or + :vartype encryption_algorithm: str or ~azure.mgmt.databoxedge.v2019_03_01.models.EncryptionAlgorithm """ @@ -278,6 +302,17 @@ def __init__( encryption_cert_thumbprint: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The value of the secret. + :paramtype value: str + :keyword encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the + value is unencrypted, it will be null. + :paramtype encryption_cert_thumbprint: str + :keyword encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values + include: "None", "AES256", "RSAES_PKCS1_v_1_5". + :paramtype encryption_algorithm: str or + ~azure.mgmt.databoxedge.v2019_03_01.models.EncryptionAlgorithm + """ super(AsymmetricEncryptedSecret, self).__init__(**kwargs) self.value = value self.encryption_cert_thumbprint = encryption_cert_thumbprint @@ -287,8 +322,8 @@ def __init__( class Authentication(msrest.serialization.Model): """Authentication mechanism for IoT devices. - :param symmetric_key: Symmetric key for authentication. - :type symmetric_key: ~azure.mgmt.databoxedge.v2019_03_01.models.SymmetricKey + :ivar symmetric_key: Symmetric key for authentication. + :vartype symmetric_key: ~azure.mgmt.databoxedge.v2019_03_01.models.SymmetricKey """ _attribute_map = { @@ -301,6 +336,10 @@ def __init__( symmetric_key: Optional["SymmetricKey"] = None, **kwargs ): + """ + :keyword symmetric_key: Symmetric key for authentication. + :paramtype symmetric_key: ~azure.mgmt.databoxedge.v2019_03_01.models.SymmetricKey + """ super(Authentication, self).__init__(**kwargs) self.symmetric_key = symmetric_key @@ -310,15 +349,16 @@ class AzureContainerInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param storage_account_credential_id: Required. ID of the storage account credential used to + :ivar storage_account_credential_id: Required. ID of the storage account credential used to access storage. - :type storage_account_credential_id: str - :param container_name: Required. Container name (Based on the data format specified, this + :vartype storage_account_credential_id: str + :ivar container_name: Required. Container name (Based on the data format specified, this represents the name of Azure Files/Page blob/Block blob). - :type container_name: str - :param data_format: Required. Storage format used for the file represented by the share. + :vartype container_name: str + :ivar data_format: Required. Storage format used for the file represented by the share. Possible values include: "BlockBlob", "PageBlob", "AzureFile". - :type data_format: str or ~azure.mgmt.databoxedge.v2019_03_01.models.AzureContainerDataFormat + :vartype data_format: str or + ~azure.mgmt.databoxedge.v2019_03_01.models.AzureContainerDataFormat """ _validation = { @@ -341,6 +381,18 @@ def __init__( data_format: Union[str, "AzureContainerDataFormat"], **kwargs ): + """ + :keyword storage_account_credential_id: Required. ID of the storage account credential used to + access storage. + :paramtype storage_account_credential_id: str + :keyword container_name: Required. Container name (Based on the data format specified, this + represents the name of Azure Files/Page blob/Block blob). + :paramtype container_name: str + :keyword data_format: Required. Storage format used for the file represented by the share. + Possible values include: "BlockBlob", "PageBlob", "AzureFile". + :paramtype data_format: str or + ~azure.mgmt.databoxedge.v2019_03_01.models.AzureContainerDataFormat + """ super(AzureContainerInfo, self).__init__(**kwargs) self.storage_account_credential_id = storage_account_credential_id self.container_name = container_name @@ -360,14 +412,14 @@ class BandwidthSchedule(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param start: Required. The start time of the schedule in UTC. - :type start: str - :param stop: Required. The stop time of the schedule in UTC. - :type stop: str - :param rate_in_mbps: Required. The bandwidth rate in Mbps. - :type rate_in_mbps: int - :param days: Required. The days of the week when this schedule is applicable. - :type days: list[str or ~azure.mgmt.databoxedge.v2019_03_01.models.DayOfWeek] + :ivar start: Required. The start time of the schedule in UTC. + :vartype start: str + :ivar stop: Required. The stop time of the schedule in UTC. + :vartype stop: str + :ivar rate_in_mbps: Required. The bandwidth rate in Mbps. + :vartype rate_in_mbps: int + :ivar days: Required. The days of the week when this schedule is applicable. + :vartype days: list[str or ~azure.mgmt.databoxedge.v2019_03_01.models.DayOfWeek] """ _validation = { @@ -399,6 +451,16 @@ def __init__( days: List[Union[str, "DayOfWeek"]], **kwargs ): + """ + :keyword start: Required. The start time of the schedule in UTC. + :paramtype start: str + :keyword stop: Required. The stop time of the schedule in UTC. + :paramtype stop: str + :keyword rate_in_mbps: Required. The bandwidth rate in Mbps. + :paramtype rate_in_mbps: int + :keyword days: Required. The days of the week when this schedule is applicable. + :paramtype days: list[str or ~azure.mgmt.databoxedge.v2019_03_01.models.DayOfWeek] + """ super(BandwidthSchedule, self).__init__(**kwargs) self.start = start self.stop = stop @@ -431,6 +493,8 @@ def __init__( self, **kwargs ): + """ + """ super(BandwidthSchedulesList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -441,11 +505,12 @@ class ClientAccessRight(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param client: Required. IP of the client. - :type client: str - :param access_permission: Required. Type of access to be allowed for the client. Possible - values include: "NoAccess", "ReadOnly", "ReadWrite". - :type access_permission: str or ~azure.mgmt.databoxedge.v2019_03_01.models.ClientPermissionType + :ivar client: Required. IP of the client. + :vartype client: str + :ivar access_permission: Required. Type of access to be allowed for the client. Possible values + include: "NoAccess", "ReadOnly", "ReadWrite". + :vartype access_permission: str or + ~azure.mgmt.databoxedge.v2019_03_01.models.ClientPermissionType """ _validation = { @@ -465,6 +530,14 @@ def __init__( access_permission: Union[str, "ClientPermissionType"], **kwargs ): + """ + :keyword client: Required. IP of the client. + :paramtype client: str + :keyword access_permission: Required. Type of access to be allowed for the client. Possible + values include: "NoAccess", "ReadOnly", "ReadWrite". + :paramtype access_permission: str or + ~azure.mgmt.databoxedge.v2019_03_01.models.ClientPermissionType + """ super(ClientAccessRight, self).__init__(**kwargs) self.client = client self.access_permission = access_permission @@ -473,14 +546,14 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from the service. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.databoxedge.v2019_03_01.models.CloudErrorBody] + :vartype message: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.databoxedge.v2019_03_01.models.CloudErrorBody] """ _attribute_map = { @@ -497,6 +570,16 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.databoxedge.v2019_03_01.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -508,14 +591,14 @@ class ContactDetails(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param contact_person: Required. The contact person name. - :type contact_person: str - :param company_name: Required. The name of the company. - :type company_name: str - :param phone: Required. The phone number. - :type phone: str - :param email_list: Required. The email list. - :type email_list: list[str] + :ivar contact_person: Required. The contact person name. + :vartype contact_person: str + :ivar company_name: Required. The name of the company. + :vartype company_name: str + :ivar phone: Required. The phone number. + :vartype phone: str + :ivar email_list: Required. The email list. + :vartype email_list: list[str] """ _validation = { @@ -541,6 +624,16 @@ def __init__( email_list: List[str], **kwargs ): + """ + :keyword contact_person: Required. The contact person name. + :paramtype contact_person: str + :keyword company_name: Required. The name of the company. + :paramtype company_name: str + :keyword phone: Required. The phone number. + :paramtype phone: str + :keyword email_list: Required. The email list. + :paramtype email_list: list[str] + """ super(ContactDetails, self).__init__(**kwargs) self.contact_person = contact_person self.company_name = company_name @@ -561,34 +654,34 @@ class DataBoxEdgeDevice(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param location: Required. The location of the device. This is a supported and registered Azure + :ivar location: Required. The location of the device. This is a supported and registered Azure geographical region (for example, West US, East US, or Southeast Asia). The geographical region of a device cannot be changed once it is created, but if an identical geographical region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. The list of tags that describe the device. These tags can be used - to view and group this device (across resource groups). - :type tags: dict[str, str] - :param sku: The SKU type. - :type sku: ~azure.mgmt.databoxedge.v2019_03_01.models.Sku - :param etag: The etag for the devices. - :type etag: str - :param data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible + :vartype location: str + :ivar tags: A set of tags. The list of tags that describe the device. These tags can be used to + view and group this device (across resource groups). + :vartype tags: dict[str, str] + :ivar sku: The SKU type. + :vartype sku: ~azure.mgmt.databoxedge.v2019_03_01.models.Sku + :ivar etag: The etag for the devices. + :vartype etag: str + :ivar data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible values include: "ReadyToSetup", "Online", "Offline", "NeedsAttention", "Disconnected", "PartiallyDisconnected". - :type data_box_edge_device_status: str or + :vartype data_box_edge_device_status: str or ~azure.mgmt.databoxedge.v2019_03_01.models.DataBoxEdgeDeviceStatus :ivar serial_number: The Serial Number of Data Box Edge/Gateway device. :vartype serial_number: str - :param description: The Description of the Data Box Edge/Gateway device. - :type description: str - :param model_description: The description of the Data Box Edge/Gateway device model. - :type model_description: str + :ivar description: The Description of the Data Box Edge/Gateway device. + :vartype description: str + :ivar model_description: The description of the Data Box Edge/Gateway device model. + :vartype model_description: str :ivar device_type: The type of the Data Box Edge/Gateway device. Possible values include: "DataBoxEdgeDevice". :vartype device_type: str or ~azure.mgmt.databoxedge.v2019_03_01.models.DeviceType - :param friendly_name: The Data Box Edge/Gateway device name. - :type friendly_name: str + :ivar friendly_name: The Data Box Edge/Gateway device name. + :vartype friendly_name: str :ivar culture: The Data Box Edge/Gateway device culture. :vartype culture: str :ivar device_model: The Data Box Edge/Gateway device model. @@ -658,6 +751,31 @@ def __init__( friendly_name: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. The location of the device. This is a supported and registered + Azure geographical region (for example, West US, East US, or Southeast Asia). The geographical + region of a device cannot be changed once it is created, but if an identical geographical + region is specified on update, the request will succeed. + :paramtype location: str + :keyword tags: A set of tags. The list of tags that describe the device. These tags can be used + to view and group this device (across resource groups). + :paramtype tags: dict[str, str] + :keyword sku: The SKU type. + :paramtype sku: ~azure.mgmt.databoxedge.v2019_03_01.models.Sku + :keyword etag: The etag for the devices. + :paramtype etag: str + :keyword data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible + values include: "ReadyToSetup", "Online", "Offline", "NeedsAttention", "Disconnected", + "PartiallyDisconnected". + :paramtype data_box_edge_device_status: str or + ~azure.mgmt.databoxedge.v2019_03_01.models.DataBoxEdgeDeviceStatus + :keyword description: The Description of the Data Box Edge/Gateway device. + :paramtype description: str + :keyword model_description: The description of the Data Box Edge/Gateway device model. + :paramtype model_description: str + :keyword friendly_name: The Data Box Edge/Gateway device name. + :paramtype friendly_name: str + """ super(DataBoxEdgeDevice, self).__init__(**kwargs) self.location = location self.tags = tags @@ -689,11 +807,11 @@ class DataBoxEdgeDeviceExtendedInfo(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param encryption_key_thumbprint: The digital signature of encrypted certificate. - :type encryption_key_thumbprint: str - :param encryption_key: The public part of the encryption certificate. Client uses this to + :ivar encryption_key_thumbprint: The digital signature of encrypted certificate. + :vartype encryption_key_thumbprint: str + :ivar encryption_key: The public part of the encryption certificate. Client uses this to encrypt any secret. - :type encryption_key: str + :vartype encryption_key: str :ivar resource_key: The Resource ID of the Resource. :vartype resource_key: str """ @@ -721,6 +839,13 @@ def __init__( encryption_key: Optional[str] = None, **kwargs ): + """ + :keyword encryption_key_thumbprint: The digital signature of encrypted certificate. + :paramtype encryption_key_thumbprint: str + :keyword encryption_key: The public part of the encryption certificate. Client uses this to + encrypt any secret. + :paramtype encryption_key: str + """ super(DataBoxEdgeDeviceExtendedInfo, self).__init__(**kwargs) self.encryption_key_thumbprint = encryption_key_thumbprint self.encryption_key = encryption_key @@ -752,6 +877,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataBoxEdgeDeviceList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -760,8 +887,8 @@ def __init__( class DataBoxEdgeDevicePatch(msrest.serialization.Model): """The Data Box Edge/Gateway device patch. - :param tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. - :type tags: dict[str, str] + :ivar tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -774,6 +901,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. + :paramtype tags: dict[str, str] + """ super(DataBoxEdgeDevicePatch, self).__init__(**kwargs) self.tags = tags @@ -794,9 +925,9 @@ class Trigger(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: + :ivar kind: Required. Trigger Kind.Constant filled by server. Possible values include: "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2019_03_01.models.TriggerEventType + :vartype kind: str or ~azure.mgmt.databoxedge.v2019_03_01.models.TriggerEventType """ _validation = { @@ -821,6 +952,8 @@ def __init__( self, **kwargs ): + """ + """ super(Trigger, self).__init__(**kwargs) self.kind = 'Trigger' # type: str @@ -838,17 +971,17 @@ class FileEventTrigger(Trigger): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: + :ivar kind: Required. Trigger Kind.Constant filled by server. Possible values include: "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2019_03_01.models.TriggerEventType - :param source_info: Required. File event source details. - :type source_info: ~azure.mgmt.databoxedge.v2019_03_01.models.FileSourceInfo - :param sink_info: Required. Role sink info. - :type sink_info: ~azure.mgmt.databoxedge.v2019_03_01.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against + :vartype kind: str or ~azure.mgmt.databoxedge.v2019_03_01.models.TriggerEventType + :ivar source_info: Required. File event source details. + :vartype source_info: ~azure.mgmt.databoxedge.v2019_03_01.models.FileSourceInfo + :ivar sink_info: Required. Role sink info. + :vartype sink_info: ~azure.mgmt.databoxedge.v2019_03_01.models.RoleSinkInfo + :ivar custom_context_tag: A custom context tag typically used to correlate the trigger against its usage. For example, if a periodic timer trigger is intended for certain specific IoT modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str + :vartype custom_context_tag: str """ _validation = { @@ -878,6 +1011,16 @@ def __init__( custom_context_tag: Optional[str] = None, **kwargs ): + """ + :keyword source_info: Required. File event source details. + :paramtype source_info: ~azure.mgmt.databoxedge.v2019_03_01.models.FileSourceInfo + :keyword sink_info: Required. Role sink info. + :paramtype sink_info: ~azure.mgmt.databoxedge.v2019_03_01.models.RoleSinkInfo + :keyword custom_context_tag: A custom context tag typically used to correlate the trigger + against its usage. For example, if a periodic timer trigger is intended for certain specific + IoT modules in the device, the tag can be the name or the image URL of the module. + :paramtype custom_context_tag: str + """ super(FileEventTrigger, self).__init__(**kwargs) self.kind = 'FileEvent' # type: str self.source_info = source_info @@ -890,8 +1033,8 @@ class FileSourceInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param share_id: Required. File share ID. - :type share_id: str + :ivar share_id: Required. File share ID. + :vartype share_id: str """ _validation = { @@ -908,6 +1051,10 @@ def __init__( share_id: str, **kwargs ): + """ + :keyword share_id: Required. File share ID. + :paramtype share_id: str + """ super(FileSourceInfo, self).__init__(**kwargs) self.share_id = share_id @@ -917,12 +1064,12 @@ class IoTDeviceInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param device_id: Required. ID of the IoT device/edge device. - :type device_id: str - :param io_t_host_hub: Required. Host name for the IoT hub associated to the device. - :type io_t_host_hub: str - :param authentication: IoT device authentication info. - :type authentication: ~azure.mgmt.databoxedge.v2019_03_01.models.Authentication + :ivar device_id: Required. ID of the IoT device/edge device. + :vartype device_id: str + :ivar io_t_host_hub: Required. Host name for the IoT hub associated to the device. + :vartype io_t_host_hub: str + :ivar authentication: IoT device authentication info. + :vartype authentication: ~azure.mgmt.databoxedge.v2019_03_01.models.Authentication """ _validation = { @@ -944,6 +1091,14 @@ def __init__( authentication: Optional["Authentication"] = None, **kwargs ): + """ + :keyword device_id: Required. ID of the IoT device/edge device. + :paramtype device_id: str + :keyword io_t_host_hub: Required. Host name for the IoT hub associated to the device. + :paramtype io_t_host_hub: str + :keyword authentication: IoT device authentication info. + :paramtype authentication: ~azure.mgmt.databoxedge.v2019_03_01.models.Authentication + """ super(IoTDeviceInfo, self).__init__(**kwargs) self.device_id = device_id self.io_t_host_hub = io_t_host_hub @@ -966,9 +1121,9 @@ class Role(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive". - :type kind: str or ~azure.mgmt.databoxedge.v2019_03_01.models.RoleTypes + :vartype kind: str or ~azure.mgmt.databoxedge.v2019_03_01.models.RoleTypes """ _validation = { @@ -993,6 +1148,8 @@ def __init__( self, **kwargs ): + """ + """ super(Role, self).__init__(**kwargs) self.kind = 'Role' # type: str @@ -1010,21 +1167,21 @@ class IoTRole(Role): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive". - :type kind: str or ~azure.mgmt.databoxedge.v2019_03_01.models.RoleTypes - :param host_platform: Host OS supported by the IoT role. Possible values include: "Windows", + :vartype kind: str or ~azure.mgmt.databoxedge.v2019_03_01.models.RoleTypes + :ivar host_platform: Host OS supported by the IoT role. Possible values include: "Windows", "Linux". - :type host_platform: str or ~azure.mgmt.databoxedge.v2019_03_01.models.PlatformType - :param io_t_device_details: IoT device metadata to which data box edge device needs to be + :vartype host_platform: str or ~azure.mgmt.databoxedge.v2019_03_01.models.PlatformType + :ivar io_t_device_details: IoT device metadata to which data box edge device needs to be connected. - :type io_t_device_details: ~azure.mgmt.databoxedge.v2019_03_01.models.IoTDeviceInfo - :param io_t_edge_device_details: IoT edge device to which the IoT role needs to be configured. - :type io_t_edge_device_details: ~azure.mgmt.databoxedge.v2019_03_01.models.IoTDeviceInfo - :param share_mappings: Mount points of shares in role(s). - :type share_mappings: list[~azure.mgmt.databoxedge.v2019_03_01.models.MountPointMap] - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2019_03_01.models.RoleStatus + :vartype io_t_device_details: ~azure.mgmt.databoxedge.v2019_03_01.models.IoTDeviceInfo + :ivar io_t_edge_device_details: IoT edge device to which the IoT role needs to be configured. + :vartype io_t_edge_device_details: ~azure.mgmt.databoxedge.v2019_03_01.models.IoTDeviceInfo + :ivar share_mappings: Mount points of shares in role(s). + :vartype share_mappings: list[~azure.mgmt.databoxedge.v2019_03_01.models.MountPointMap] + :ivar role_status: Role status. Possible values include: "Enabled", "Disabled". + :vartype role_status: str or ~azure.mgmt.databoxedge.v2019_03_01.models.RoleStatus """ _validation = { @@ -1056,6 +1213,21 @@ def __init__( role_status: Optional[Union[str, "RoleStatus"]] = None, **kwargs ): + """ + :keyword host_platform: Host OS supported by the IoT role. Possible values include: "Windows", + "Linux". + :paramtype host_platform: str or ~azure.mgmt.databoxedge.v2019_03_01.models.PlatformType + :keyword io_t_device_details: IoT device metadata to which data box edge device needs to be + connected. + :paramtype io_t_device_details: ~azure.mgmt.databoxedge.v2019_03_01.models.IoTDeviceInfo + :keyword io_t_edge_device_details: IoT edge device to which the IoT role needs to be + configured. + :paramtype io_t_edge_device_details: ~azure.mgmt.databoxedge.v2019_03_01.models.IoTDeviceInfo + :keyword share_mappings: Mount points of shares in role(s). + :paramtype share_mappings: list[~azure.mgmt.databoxedge.v2019_03_01.models.MountPointMap] + :keyword role_status: Role status. Possible values include: "Enabled", "Disabled". + :paramtype role_status: str or ~azure.mgmt.databoxedge.v2019_03_01.models.RoleStatus + """ super(IoTRole, self).__init__(**kwargs) self.kind = 'IOT' # type: str self.host_platform = host_platform @@ -1094,6 +1266,8 @@ def __init__( self, **kwargs ): + """ + """ super(Ipv4Config, self).__init__(**kwargs) self.ip_address = None self.subnet = None @@ -1129,6 +1303,8 @@ def __init__( self, **kwargs ): + """ + """ super(Ipv6Config, self).__init__(**kwargs) self.ip_address = None self.prefix_length = None @@ -1176,9 +1352,9 @@ class Job(msrest.serialization.Model): :vartype error_manifest_file: str :ivar share_id: ARM ID of the share that was refreshed. :vartype share_id: str - :param folder: If only subfolders need to be refreshed, then the subfolder path inside the + :ivar folder: If only subfolders need to be refreshed, then the subfolder path inside the share. (The path is empty if there are no subfolders.). - :type folder: str + :vartype folder: str """ _validation = { @@ -1224,6 +1400,11 @@ def __init__( folder: Optional[str] = None, **kwargs ): + """ + :keyword folder: If only subfolders need to be refreshed, then the subfolder path inside the + share. (The path is empty if there are no subfolders.). + :paramtype folder: str + """ super(Job, self).__init__(**kwargs) self.id = None self.name = None @@ -1272,6 +1453,8 @@ def __init__( self, **kwargs ): + """ + """ super(JobErrorDetails, self).__init__(**kwargs) self.error_details = None self.code = None @@ -1307,6 +1490,8 @@ def __init__( self, **kwargs ): + """ + """ super(JobErrorItem, self).__init__(**kwargs) self.recommendations = None self.code = None @@ -1316,12 +1501,12 @@ def __init__( class MetricDimensionV1(msrest.serialization.Model): """Metric Dimension v1. - :param name: Name of the metrics dimension. - :type name: str - :param display_name: Display name of the metrics dimension. - :type display_name: str - :param to_be_exported_for_shoebox: To be exported to shoe box. - :type to_be_exported_for_shoebox: bool + :ivar name: Name of the metrics dimension. + :vartype name: str + :ivar display_name: Display name of the metrics dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: To be exported to shoe box. + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -1338,6 +1523,14 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): + """ + :keyword name: Name of the metrics dimension. + :paramtype name: str + :keyword display_name: Display name of the metrics dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: To be exported to shoe box. + :paramtype to_be_exported_for_shoebox: bool + """ super(MetricDimensionV1, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1347,31 +1540,32 @@ def __init__( class MetricSpecificationV1(msrest.serialization.Model): """Metric specification version 1. - :param name: Name of the metric. - :type name: str - :param display_name: Display name of the metric. - :type display_name: str - :param display_description: Description of the metric to be displayed. - :type display_description: str - :param unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Display name of the metric. + :vartype display_name: str + :ivar display_description: Description of the metric to be displayed. + :vartype display_description: str + :ivar unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", "Seconds", "Milliseconds", "Bytes", "BytesPerSecond", "CountPerSecond". - :type unit: str or ~azure.mgmt.databoxedge.v2019_03_01.models.MetricUnit - :param aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", + :vartype unit: str or ~azure.mgmt.databoxedge.v2019_03_01.models.MetricUnit + :ivar aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", "None", "Average", "Minimum", "Maximum", "Total", "Count". - :type aggregation_type: str or ~azure.mgmt.databoxedge.v2019_03_01.models.MetricAggregationType - :param dimensions: Metric dimensions, other than default dimension which is resource. - :type dimensions: list[~azure.mgmt.databoxedge.v2019_03_01.models.MetricDimensionV1] - :param fill_gap_with_zero: Set true to fill the gaps with zero. - :type fill_gap_with_zero: bool - :param category: Metric category. Possible values include: "Capacity", "Transaction". - :type category: str or ~azure.mgmt.databoxedge.v2019_03_01.models.MetricCategory - :param resource_id_dimension_name_override: Resource name override. - :type resource_id_dimension_name_override: str - :param supported_time_grain_types: Support granularity of metrics. - :type supported_time_grain_types: list[str or + :vartype aggregation_type: str or + ~azure.mgmt.databoxedge.v2019_03_01.models.MetricAggregationType + :ivar dimensions: Metric dimensions, other than default dimension which is resource. + :vartype dimensions: list[~azure.mgmt.databoxedge.v2019_03_01.models.MetricDimensionV1] + :ivar fill_gap_with_zero: Set true to fill the gaps with zero. + :vartype fill_gap_with_zero: bool + :ivar category: Metric category. Possible values include: "Capacity", "Transaction". + :vartype category: str or ~azure.mgmt.databoxedge.v2019_03_01.models.MetricCategory + :ivar resource_id_dimension_name_override: Resource name override. + :vartype resource_id_dimension_name_override: str + :ivar supported_time_grain_types: Support granularity of metrics. + :vartype supported_time_grain_types: list[str or ~azure.mgmt.databoxedge.v2019_03_01.models.TimeGrain] - :param supported_aggregation_types: Support metric aggregation type. - :type supported_aggregation_types: list[str or + :ivar supported_aggregation_types: Support metric aggregation type. + :vartype supported_aggregation_types: list[str or ~azure.mgmt.databoxedge.v2019_03_01.models.MetricAggregationType] """ @@ -1405,6 +1599,35 @@ def __init__( supported_aggregation_types: Optional[List[Union[str, "MetricAggregationType"]]] = None, **kwargs ): + """ + :keyword name: Name of the metric. + :paramtype name: str + :keyword display_name: Display name of the metric. + :paramtype display_name: str + :keyword display_description: Description of the metric to be displayed. + :paramtype display_description: str + :keyword unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", + "Seconds", "Milliseconds", "Bytes", "BytesPerSecond", "CountPerSecond". + :paramtype unit: str or ~azure.mgmt.databoxedge.v2019_03_01.models.MetricUnit + :keyword aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", + "None", "Average", "Minimum", "Maximum", "Total", "Count". + :paramtype aggregation_type: str or + ~azure.mgmt.databoxedge.v2019_03_01.models.MetricAggregationType + :keyword dimensions: Metric dimensions, other than default dimension which is resource. + :paramtype dimensions: list[~azure.mgmt.databoxedge.v2019_03_01.models.MetricDimensionV1] + :keyword fill_gap_with_zero: Set true to fill the gaps with zero. + :paramtype fill_gap_with_zero: bool + :keyword category: Metric category. Possible values include: "Capacity", "Transaction". + :paramtype category: str or ~azure.mgmt.databoxedge.v2019_03_01.models.MetricCategory + :keyword resource_id_dimension_name_override: Resource name override. + :paramtype resource_id_dimension_name_override: str + :keyword supported_time_grain_types: Support granularity of metrics. + :paramtype supported_time_grain_types: list[str or + ~azure.mgmt.databoxedge.v2019_03_01.models.TimeGrain] + :keyword supported_aggregation_types: Support metric aggregation type. + :paramtype supported_aggregation_types: list[str or + ~azure.mgmt.databoxedge.v2019_03_01.models.MetricAggregationType] + """ super(MetricSpecificationV1, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1426,8 +1649,8 @@ class MountPointMap(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param share_id: Required. ID of the share mounted to the role VM. - :type share_id: str + :ivar share_id: Required. ID of the share mounted to the role VM. + :vartype share_id: str :ivar role_id: ID of the role to which share is mounted. :vartype role_id: str :ivar mount_point: Mount point for the share. @@ -1456,6 +1679,10 @@ def __init__( share_id: str, **kwargs ): + """ + :keyword share_id: Required. ID of the share mounted to the role VM. + :paramtype share_id: str + """ super(MountPointMap, self).__init__(**kwargs) self.share_id = share_id self.role_id = None @@ -1487,12 +1714,14 @@ class NetworkAdapter(msrest.serialization.Model): :ivar status: Value indicating whether this adapter is valid. Possible values include: "Inactive", "Active". :vartype status: str or ~azure.mgmt.databoxedge.v2019_03_01.models.NetworkAdapterStatus - :param rdma_status: Value indicating whether this adapter is RDMA capable. Possible values + :ivar rdma_status: Value indicating whether this adapter is RDMA capable. Possible values include: "Incapable", "Capable". - :type rdma_status: str or ~azure.mgmt.databoxedge.v2019_03_01.models.NetworkAdapterRDMAStatus - :param dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values + :vartype rdma_status: str or + ~azure.mgmt.databoxedge.v2019_03_01.models.NetworkAdapterRDMAStatus + :ivar dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values include: "Disabled", "Enabled". - :type dhcp_status: str or ~azure.mgmt.databoxedge.v2019_03_01.models.NetworkAdapterDHCPStatus + :vartype dhcp_status: str or + ~azure.mgmt.databoxedge.v2019_03_01.models.NetworkAdapterDHCPStatus :ivar ipv4_configuration: The IPv4 configuration of the network adapter. :vartype ipv4_configuration: ~azure.mgmt.databoxedge.v2019_03_01.models.Ipv4Config :ivar ipv6_configuration: The IPv6 configuration of the network adapter. @@ -1544,6 +1773,16 @@ def __init__( dhcp_status: Optional[Union[str, "NetworkAdapterDHCPStatus"]] = None, **kwargs ): + """ + :keyword rdma_status: Value indicating whether this adapter is RDMA capable. Possible values + include: "Incapable", "Capable". + :paramtype rdma_status: str or + ~azure.mgmt.databoxedge.v2019_03_01.models.NetworkAdapterRDMAStatus + :keyword dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values + include: "Disabled", "Enabled". + :paramtype dhcp_status: str or + ~azure.mgmt.databoxedge.v2019_03_01.models.NetworkAdapterDHCPStatus + """ super(NetworkAdapter, self).__init__(**kwargs) self.adapter_id = None self.adapter_position = None @@ -1587,6 +1826,8 @@ def __init__( self, **kwargs ): + """ + """ super(NetworkAdapterPosition, self).__init__(**kwargs) self.network_group = None self.port = None @@ -1625,6 +1866,8 @@ def __init__( self, **kwargs ): + """ + """ super(NetworkSettings, self).__init__(**kwargs) self.network_adapters = None @@ -1632,14 +1875,14 @@ def __init__( class Operation(msrest.serialization.Model): """Operations. - :param name: Name of the operation. - :type name: str - :param display: Properties displayed for the operation. - :type display: ~azure.mgmt.databoxedge.v2019_03_01.models.OperationDisplay - :param origin: Origin of the operation. - :type origin: str - :param service_specification: Service specification. - :type service_specification: ~azure.mgmt.databoxedge.v2019_03_01.models.ServiceSpecification + :ivar name: Name of the operation. + :vartype name: str + :ivar display: Properties displayed for the operation. + :vartype display: ~azure.mgmt.databoxedge.v2019_03_01.models.OperationDisplay + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar service_specification: Service specification. + :vartype service_specification: ~azure.mgmt.databoxedge.v2019_03_01.models.ServiceSpecification """ _attribute_map = { @@ -1658,6 +1901,17 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword name: Name of the operation. + :paramtype name: str + :keyword display: Properties displayed for the operation. + :paramtype display: ~azure.mgmt.databoxedge.v2019_03_01.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword service_specification: Service specification. + :paramtype service_specification: + ~azure.mgmt.databoxedge.v2019_03_01.models.ServiceSpecification + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -1668,14 +1922,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Operation display properties. - :param provider: Provider name. - :type provider: str - :param resource: The type of resource in which the operation is performed. - :type resource: str - :param operation: Operation to be performed on the resource. - :type operation: str - :param description: Description of the operation to be performed. - :type description: str + :ivar provider: Provider name. + :vartype provider: str + :ivar resource: The type of resource in which the operation is performed. + :vartype resource: str + :ivar operation: Operation to be performed on the resource. + :vartype operation: str + :ivar description: Description of the operation to be performed. + :vartype description: str """ _attribute_map = { @@ -1694,6 +1948,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Provider name. + :paramtype provider: str + :keyword resource: The type of resource in which the operation is performed. + :paramtype resource: str + :keyword operation: Operation to be performed on the resource. + :paramtype operation: str + :keyword description: Description of the operation to be performed. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1706,10 +1970,10 @@ class OperationsList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The value. - :type value: list[~azure.mgmt.databoxedge.v2019_03_01.models.Operation] - :param next_link: Link to the next set of results. - :type next_link: str + :ivar value: Required. The value. + :vartype value: list[~azure.mgmt.databoxedge.v2019_03_01.models.Operation] + :ivar next_link: Link to the next set of results. + :vartype next_link: str """ _validation = { @@ -1728,6 +1992,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The value. + :paramtype value: list[~azure.mgmt.databoxedge.v2019_03_01.models.Operation] + :keyword next_link: Link to the next set of results. + :paramtype next_link: str + """ super(OperationsList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1744,12 +2014,12 @@ class Order(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param contact_information: The contact details. - :type contact_information: ~azure.mgmt.databoxedge.v2019_03_01.models.ContactDetails - :param shipping_address: The shipping address. - :type shipping_address: ~azure.mgmt.databoxedge.v2019_03_01.models.Address - :param current_status: Current status of the order. - :type current_status: ~azure.mgmt.databoxedge.v2019_03_01.models.OrderStatus + :ivar contact_information: The contact details. + :vartype contact_information: ~azure.mgmt.databoxedge.v2019_03_01.models.ContactDetails + :ivar shipping_address: The shipping address. + :vartype shipping_address: ~azure.mgmt.databoxedge.v2019_03_01.models.Address + :ivar current_status: Current status of the order. + :vartype current_status: ~azure.mgmt.databoxedge.v2019_03_01.models.OrderStatus :ivar order_history: List of status changes in the order. :vartype order_history: list[~azure.mgmt.databoxedge.v2019_03_01.models.OrderStatus] :ivar serial_number: Serial number of the device. @@ -1793,6 +2063,14 @@ def __init__( current_status: Optional["OrderStatus"] = None, **kwargs ): + """ + :keyword contact_information: The contact details. + :paramtype contact_information: ~azure.mgmt.databoxedge.v2019_03_01.models.ContactDetails + :keyword shipping_address: The shipping address. + :paramtype shipping_address: ~azure.mgmt.databoxedge.v2019_03_01.models.Address + :keyword current_status: Current status of the order. + :paramtype current_status: ~azure.mgmt.databoxedge.v2019_03_01.models.OrderStatus + """ super(Order, self).__init__(**kwargs) self.contact_information = contact_information self.shipping_address = shipping_address @@ -1828,6 +2106,8 @@ def __init__( self, **kwargs ): + """ + """ super(OrderList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1840,15 +2120,15 @@ class OrderStatus(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param status: Required. Status of the order as per the allowed status types. Possible values + :ivar status: Required. Status of the order as per the allowed status types. Possible values include: "Untracked", "AwaitingFulfilment", "AwaitingPreparation", "AwaitingShipment", "Shipped", "Arriving", "Delivered", "ReplacementRequested", "LostDevice", "Declined", "ReturnInitiated", "AwaitingReturnShipment", "ShippedBack", "CollectedAtMicrosoft". - :type status: str or ~azure.mgmt.databoxedge.v2019_03_01.models.OrderState + :vartype status: str or ~azure.mgmt.databoxedge.v2019_03_01.models.OrderState :ivar update_date_time: Time of status update. :vartype update_date_time: ~datetime.datetime - :param comments: Comments related to this status change. - :type comments: str + :ivar comments: Comments related to this status change. + :vartype comments: str """ _validation = { @@ -1869,6 +2149,15 @@ def __init__( comments: Optional[str] = None, **kwargs ): + """ + :keyword status: Required. Status of the order as per the allowed status types. Possible values + include: "Untracked", "AwaitingFulfilment", "AwaitingPreparation", "AwaitingShipment", + "Shipped", "Arriving", "Delivered", "ReplacementRequested", "LostDevice", "Declined", + "ReturnInitiated", "AwaitingReturnShipment", "ShippedBack", "CollectedAtMicrosoft". + :paramtype status: str or ~azure.mgmt.databoxedge.v2019_03_01.models.OrderState + :keyword comments: Comments related to this status change. + :paramtype comments: str + """ super(OrderStatus, self).__init__(**kwargs) self.status = status self.update_date_time = None @@ -1888,17 +2177,17 @@ class PeriodicTimerEventTrigger(Trigger): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: + :ivar kind: Required. Trigger Kind.Constant filled by server. Possible values include: "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2019_03_01.models.TriggerEventType - :param source_info: Required. Periodic timer details. - :type source_info: ~azure.mgmt.databoxedge.v2019_03_01.models.PeriodicTimerSourceInfo - :param sink_info: Required. Role Sink information. - :type sink_info: ~azure.mgmt.databoxedge.v2019_03_01.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against + :vartype kind: str or ~azure.mgmt.databoxedge.v2019_03_01.models.TriggerEventType + :ivar source_info: Required. Periodic timer details. + :vartype source_info: ~azure.mgmt.databoxedge.v2019_03_01.models.PeriodicTimerSourceInfo + :ivar sink_info: Required. Role Sink information. + :vartype sink_info: ~azure.mgmt.databoxedge.v2019_03_01.models.RoleSinkInfo + :ivar custom_context_tag: A custom context tag typically used to correlate the trigger against its usage. For example, if a periodic timer trigger is intended for certain specific IoT modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str + :vartype custom_context_tag: str """ _validation = { @@ -1928,6 +2217,16 @@ def __init__( custom_context_tag: Optional[str] = None, **kwargs ): + """ + :keyword source_info: Required. Periodic timer details. + :paramtype source_info: ~azure.mgmt.databoxedge.v2019_03_01.models.PeriodicTimerSourceInfo + :keyword sink_info: Required. Role Sink information. + :paramtype sink_info: ~azure.mgmt.databoxedge.v2019_03_01.models.RoleSinkInfo + :keyword custom_context_tag: A custom context tag typically used to correlate the trigger + against its usage. For example, if a periodic timer trigger is intended for certain specific + IoT modules in the device, the tag can be the name or the image URL of the module. + :paramtype custom_context_tag: str + """ super(PeriodicTimerEventTrigger, self).__init__(**kwargs) self.kind = 'PeriodicTimerEvent' # type: str self.source_info = source_info @@ -1940,15 +2239,15 @@ class PeriodicTimerSourceInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param start_time: Required. The time of the day that results in a valid trigger. Schedule is + :ivar start_time: Required. The time of the day that results in a valid trigger. Schedule is computed with reference to the time specified up to seconds. If timezone is not specified the time will considered to be in device timezone. The value will always be returned as UTC time. - :type start_time: ~datetime.datetime - :param schedule: Required. Periodic frequency at which timer event needs to be raised. Supports + :vartype start_time: ~datetime.datetime + :ivar schedule: Required. Periodic frequency at which timer event needs to be raised. Supports daily, hourly, minutes, and seconds. - :type schedule: str - :param topic: Topic where periodic events are published to IoT device. - :type topic: str + :vartype schedule: str + :ivar topic: Topic where periodic events are published to IoT device. + :vartype topic: str """ _validation = { @@ -1970,6 +2269,17 @@ def __init__( topic: Optional[str] = None, **kwargs ): + """ + :keyword start_time: Required. The time of the day that results in a valid trigger. Schedule is + computed with reference to the time specified up to seconds. If timezone is not specified the + time will considered to be in device timezone. The value will always be returned as UTC time. + :paramtype start_time: ~datetime.datetime + :keyword schedule: Required. Periodic frequency at which timer event needs to be raised. + Supports daily, hourly, minutes, and seconds. + :paramtype schedule: str + :keyword topic: Topic where periodic events are published to IoT device. + :paramtype topic: str + """ super(PeriodicTimerSourceInfo, self).__init__(**kwargs) self.start_time = start_time self.schedule = schedule @@ -1979,19 +2289,19 @@ def __init__( class RefreshDetails(msrest.serialization.Model): """Fields for tracking refresh job on the share. - :param in_progress_refresh_job_id: If a refresh share job is currently in progress on this + :ivar in_progress_refresh_job_id: If a refresh share job is currently in progress on this share, this field indicates the ARM resource ID of that job. The field is empty if no job is in progress. - :type in_progress_refresh_job_id: str - :param last_completed_refresh_job_time_in_utc: Indicates the completed time for the last - refresh job on this particular share, if any.This could be a failed job or a successful job. - :type last_completed_refresh_job_time_in_utc: ~datetime.datetime - :param error_manifest_file: Indicates the relative path of the error xml for the last refresh + :vartype in_progress_refresh_job_id: str + :ivar last_completed_refresh_job_time_in_utc: Indicates the completed time for the last refresh + job on this particular share, if any.This could be a failed job or a successful job. + :vartype last_completed_refresh_job_time_in_utc: ~datetime.datetime + :ivar error_manifest_file: Indicates the relative path of the error xml for the last refresh job on this particular share, if any. This could be a failed job or a successful job. - :type error_manifest_file: str - :param last_job: Indicates the id of the last refresh job on this particular share,if any. This + :vartype error_manifest_file: str + :ivar last_job: Indicates the id of the last refresh job on this particular share,if any. This could be a failed job or a successful job. - :type last_job: str + :vartype last_job: str """ _attribute_map = { @@ -2010,6 +2320,21 @@ def __init__( last_job: Optional[str] = None, **kwargs ): + """ + :keyword in_progress_refresh_job_id: If a refresh share job is currently in progress on this + share, this field indicates the ARM resource ID of that job. The field is empty if no job is in + progress. + :paramtype in_progress_refresh_job_id: str + :keyword last_completed_refresh_job_time_in_utc: Indicates the completed time for the last + refresh job on this particular share, if any.This could be a failed job or a successful job. + :paramtype last_completed_refresh_job_time_in_utc: ~datetime.datetime + :keyword error_manifest_file: Indicates the relative path of the error xml for the last refresh + job on this particular share, if any. This could be a failed job or a successful job. + :paramtype error_manifest_file: str + :keyword last_job: Indicates the id of the last refresh job on this particular share,if any. + This could be a failed job or a successful job. + :paramtype last_job: str + """ super(RefreshDetails, self).__init__(**kwargs) self.in_progress_refresh_job_id = in_progress_refresh_job_id self.last_completed_refresh_job_time_in_utc = last_completed_refresh_job_time_in_utc @@ -2042,6 +2367,8 @@ def __init__( self, **kwargs ): + """ + """ super(RoleList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2052,8 +2379,8 @@ class RoleSinkInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param role_id: Required. Compute role ID. - :type role_id: str + :ivar role_id: Required. Compute role ID. + :vartype role_id: str """ _validation = { @@ -2070,6 +2397,10 @@ def __init__( role_id: str, **kwargs ): + """ + :keyword role_id: Required. Compute role ID. + :paramtype role_id: str + """ super(RoleSinkInfo, self).__init__(**kwargs) self.role_id = role_id @@ -2087,11 +2418,11 @@ class SecuritySettings(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param device_admin_password: Required. Device administrator password as an encrypted string + :ivar device_admin_password: Required. Device administrator password as an encrypted string (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual password should have at least 8 characters that are a combination of uppercase, lowercase, numeric, and special characters. - :type device_admin_password: + :vartype device_admin_password: ~azure.mgmt.databoxedge.v2019_03_01.models.AsymmetricEncryptedSecret """ @@ -2115,6 +2446,14 @@ def __init__( device_admin_password: "AsymmetricEncryptedSecret", **kwargs ): + """ + :keyword device_admin_password: Required. Device administrator password as an encrypted string + (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual + password should have at least 8 characters that are a combination of uppercase, lowercase, + numeric, and special characters. + :paramtype device_admin_password: + ~azure.mgmt.databoxedge.v2019_03_01.models.AsymmetricEncryptedSecret + """ super(SecuritySettings, self).__init__(**kwargs) self.device_admin_password = device_admin_password @@ -2122,8 +2461,8 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """Service specification. - :param metric_specifications: Metric specification as defined by shoebox. - :type metric_specifications: + :ivar metric_specifications: Metric specification as defined by shoebox. + :vartype metric_specifications: list[~azure.mgmt.databoxedge.v2019_03_01.models.MetricSpecificationV1] """ @@ -2137,6 +2476,11 @@ def __init__( metric_specifications: Optional[List["MetricSpecificationV1"]] = None, **kwargs ): + """ + :keyword metric_specifications: Metric specification as defined by shoebox. + :paramtype metric_specifications: + list[~azure.mgmt.databoxedge.v2019_03_01.models.MetricSpecificationV1] + """ super(ServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications @@ -2154,31 +2498,32 @@ class Share(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param description: Description for the share. - :type description: str - :param share_status: Required. Current status of the share. Possible values include: "Online", + :ivar description: Description for the share. + :vartype description: str + :ivar share_status: Required. Current status of the share. Possible values include: "Online", "Offline". - :type share_status: str or ~azure.mgmt.databoxedge.v2019_03_01.models.ShareStatus - :param monitoring_status: Required. Current monitoring status of the share. Possible values + :vartype share_status: str or ~azure.mgmt.databoxedge.v2019_03_01.models.ShareStatus + :ivar monitoring_status: Required. Current monitoring status of the share. Possible values include: "Enabled", "Disabled". - :type monitoring_status: str or ~azure.mgmt.databoxedge.v2019_03_01.models.MonitoringStatus - :param azure_container_info: Azure container mapping for the share. - :type azure_container_info: ~azure.mgmt.databoxedge.v2019_03_01.models.AzureContainerInfo - :param access_protocol: Required. Access protocol to be used by the share. Possible values + :vartype monitoring_status: str or ~azure.mgmt.databoxedge.v2019_03_01.models.MonitoringStatus + :ivar azure_container_info: Azure container mapping for the share. + :vartype azure_container_info: ~azure.mgmt.databoxedge.v2019_03_01.models.AzureContainerInfo + :ivar access_protocol: Required. Access protocol to be used by the share. Possible values include: "SMB", "NFS". - :type access_protocol: str or ~azure.mgmt.databoxedge.v2019_03_01.models.ShareAccessProtocol - :param user_access_rights: Mapping of users and corresponding access rights on the share + :vartype access_protocol: str or ~azure.mgmt.databoxedge.v2019_03_01.models.ShareAccessProtocol + :ivar user_access_rights: Mapping of users and corresponding access rights on the share (required for SMB protocol). - :type user_access_rights: list[~azure.mgmt.databoxedge.v2019_03_01.models.UserAccessRight] - :param client_access_rights: List of IP addresses and corresponding access rights on the + :vartype user_access_rights: list[~azure.mgmt.databoxedge.v2019_03_01.models.UserAccessRight] + :ivar client_access_rights: List of IP addresses and corresponding access rights on the share(required for NFS protocol). - :type client_access_rights: list[~azure.mgmt.databoxedge.v2019_03_01.models.ClientAccessRight] - :param refresh_details: Details of the refresh job on this share. - :type refresh_details: ~azure.mgmt.databoxedge.v2019_03_01.models.RefreshDetails + :vartype client_access_rights: + list[~azure.mgmt.databoxedge.v2019_03_01.models.ClientAccessRight] + :ivar refresh_details: Details of the refresh job on this share. + :vartype refresh_details: ~azure.mgmt.databoxedge.v2019_03_01.models.RefreshDetails :ivar share_mappings: Share mount point to the role. :vartype share_mappings: list[~azure.mgmt.databoxedge.v2019_03_01.models.MountPointMap] - :param data_policy: Data policy of the share. Possible values include: "Cloud", "Local". - :type data_policy: str or ~azure.mgmt.databoxedge.v2019_03_01.models.DataPolicy + :ivar data_policy: Data policy of the share. Possible values include: "Cloud", "Local". + :vartype data_policy: str or ~azure.mgmt.databoxedge.v2019_03_01.models.DataPolicy """ _validation = { @@ -2221,6 +2566,34 @@ def __init__( data_policy: Optional[Union[str, "DataPolicy"]] = None, **kwargs ): + """ + :keyword description: Description for the share. + :paramtype description: str + :keyword share_status: Required. Current status of the share. Possible values include: + "Online", "Offline". + :paramtype share_status: str or ~azure.mgmt.databoxedge.v2019_03_01.models.ShareStatus + :keyword monitoring_status: Required. Current monitoring status of the share. Possible values + include: "Enabled", "Disabled". + :paramtype monitoring_status: str or + ~azure.mgmt.databoxedge.v2019_03_01.models.MonitoringStatus + :keyword azure_container_info: Azure container mapping for the share. + :paramtype azure_container_info: ~azure.mgmt.databoxedge.v2019_03_01.models.AzureContainerInfo + :keyword access_protocol: Required. Access protocol to be used by the share. Possible values + include: "SMB", "NFS". + :paramtype access_protocol: str or + ~azure.mgmt.databoxedge.v2019_03_01.models.ShareAccessProtocol + :keyword user_access_rights: Mapping of users and corresponding access rights on the share + (required for SMB protocol). + :paramtype user_access_rights: list[~azure.mgmt.databoxedge.v2019_03_01.models.UserAccessRight] + :keyword client_access_rights: List of IP addresses and corresponding access rights on the + share(required for NFS protocol). + :paramtype client_access_rights: + list[~azure.mgmt.databoxedge.v2019_03_01.models.ClientAccessRight] + :keyword refresh_details: Details of the refresh job on this share. + :paramtype refresh_details: ~azure.mgmt.databoxedge.v2019_03_01.models.RefreshDetails + :keyword data_policy: Data policy of the share. Possible values include: "Cloud", "Local". + :paramtype data_policy: str or ~azure.mgmt.databoxedge.v2019_03_01.models.DataPolicy + """ super(Share, self).__init__(**kwargs) self.description = description self.share_status = share_status @@ -2239,11 +2612,11 @@ class ShareAccessRight(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param share_id: Required. The share ID. - :type share_id: str - :param access_type: Required. Type of access to be allowed on the share for this user. Possible + :ivar share_id: Required. The share ID. + :vartype share_id: str + :ivar access_type: Required. Type of access to be allowed on the share for this user. Possible values include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2019_03_01.models.ShareAccessType + :vartype access_type: str or ~azure.mgmt.databoxedge.v2019_03_01.models.ShareAccessType """ _validation = { @@ -2263,6 +2636,13 @@ def __init__( access_type: Union[str, "ShareAccessType"], **kwargs ): + """ + :keyword share_id: Required. The share ID. + :paramtype share_id: str + :keyword access_type: Required. Type of access to be allowed on the share for this user. + Possible values include: "Change", "Read", "Custom". + :paramtype access_type: str or ~azure.mgmt.databoxedge.v2019_03_01.models.ShareAccessType + """ super(ShareAccessRight, self).__init__(**kwargs) self.share_id = share_id self.access_type = access_type @@ -2293,6 +2673,8 @@ def __init__( self, **kwargs ): + """ + """ super(ShareList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2301,10 +2683,10 @@ def __init__( class Sku(msrest.serialization.Model): """The SKU type. - :param name: SKU name. Possible values include: "Gateway", "Edge". - :type name: str or ~azure.mgmt.databoxedge.v2019_03_01.models.SkuName - :param tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard". - :type tier: str or ~azure.mgmt.databoxedge.v2019_03_01.models.SkuTier + :ivar name: SKU name. Possible values include: "Gateway", "Edge". + :vartype name: str or ~azure.mgmt.databoxedge.v2019_03_01.models.SkuName + :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard". + :vartype tier: str or ~azure.mgmt.databoxedge.v2019_03_01.models.SkuTier """ _attribute_map = { @@ -2319,6 +2701,13 @@ def __init__( tier: Optional[Union[str, "SkuTier"]] = None, **kwargs ): + """ + :keyword name: SKU name. Possible values include: "Gateway", "Edge". + :paramtype name: str or ~azure.mgmt.databoxedge.v2019_03_01.models.SkuName + :keyword tier: The SKU tier. This is based on the SKU name. Possible values include: + "Standard". + :paramtype tier: str or ~azure.mgmt.databoxedge.v2019_03_01.models.SkuTier + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -2337,23 +2726,23 @@ class StorageAccountCredential(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param alias: Required. Alias for the storage account. - :type alias: str - :param user_name: Username for the storage account. - :type user_name: str - :param account_key: Encrypted storage key. - :type account_key: ~azure.mgmt.databoxedge.v2019_03_01.models.AsymmetricEncryptedSecret - :param connection_string: Connection string for the storage account. Use this string if - username and account key are not specified. - :type connection_string: str - :param ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible values + :ivar alias: Required. Alias for the storage account. + :vartype alias: str + :ivar user_name: Username for the storage account. + :vartype user_name: str + :ivar account_key: Encrypted storage key. + :vartype account_key: ~azure.mgmt.databoxedge.v2019_03_01.models.AsymmetricEncryptedSecret + :ivar connection_string: Connection string for the storage account. Use this string if username + and account key are not specified. + :vartype connection_string: str + :ivar ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible values include: "Enabled", "Disabled". - :type ssl_status: str or ~azure.mgmt.databoxedge.v2019_03_01.models.SSLStatus - :param blob_domain_name: Blob end point for private clouds. - :type blob_domain_name: str - :param account_type: Required. Type of storage accessed on the storage account. Possible values + :vartype ssl_status: str or ~azure.mgmt.databoxedge.v2019_03_01.models.SSLStatus + :ivar blob_domain_name: Blob end point for private clouds. + :vartype blob_domain_name: str + :ivar account_type: Required. Type of storage accessed on the storage account. Possible values include: "GeneralPurposeStorage", "BlobStorage". - :type account_type: str or ~azure.mgmt.databoxedge.v2019_03_01.models.AccountType + :vartype account_type: str or ~azure.mgmt.databoxedge.v2019_03_01.models.AccountType """ _validation = { @@ -2390,6 +2779,25 @@ def __init__( blob_domain_name: Optional[str] = None, **kwargs ): + """ + :keyword alias: Required. Alias for the storage account. + :paramtype alias: str + :keyword user_name: Username for the storage account. + :paramtype user_name: str + :keyword account_key: Encrypted storage key. + :paramtype account_key: ~azure.mgmt.databoxedge.v2019_03_01.models.AsymmetricEncryptedSecret + :keyword connection_string: Connection string for the storage account. Use this string if + username and account key are not specified. + :paramtype connection_string: str + :keyword ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible + values include: "Enabled", "Disabled". + :paramtype ssl_status: str or ~azure.mgmt.databoxedge.v2019_03_01.models.SSLStatus + :keyword blob_domain_name: Blob end point for private clouds. + :paramtype blob_domain_name: str + :keyword account_type: Required. Type of storage accessed on the storage account. Possible + values include: "GeneralPurposeStorage", "BlobStorage". + :paramtype account_type: str or ~azure.mgmt.databoxedge.v2019_03_01.models.AccountType + """ super(StorageAccountCredential, self).__init__(**kwargs) self.alias = alias self.user_name = user_name @@ -2425,6 +2833,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountCredentialList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2433,8 +2843,9 @@ def __init__( class SymmetricKey(msrest.serialization.Model): """Symmetric key for authentication. - :param connection_string: Connection string based on the symmetric key. - :type connection_string: ~azure.mgmt.databoxedge.v2019_03_01.models.AsymmetricEncryptedSecret + :ivar connection_string: Connection string based on the symmetric key. + :vartype connection_string: + ~azure.mgmt.databoxedge.v2019_03_01.models.AsymmetricEncryptedSecret """ _attribute_map = { @@ -2447,6 +2858,11 @@ def __init__( connection_string: Optional["AsymmetricEncryptedSecret"] = None, **kwargs ): + """ + :keyword connection_string: Connection string based on the symmetric key. + :paramtype connection_string: + ~azure.mgmt.databoxedge.v2019_03_01.models.AsymmetricEncryptedSecret + """ super(SymmetricKey, self).__init__(**kwargs) self.connection_string = connection_string @@ -2454,14 +2870,14 @@ def __init__( class TrackingInfo(msrest.serialization.Model): """Tracking courier information. - :param serial_number: Serial number of the device being tracked. - :type serial_number: str - :param carrier_name: Name of the carrier used in the delivery. - :type carrier_name: str - :param tracking_id: Tracking ID of the shipment. - :type tracking_id: str - :param tracking_url: Tracking URL of the shipment. - :type tracking_url: str + :ivar serial_number: Serial number of the device being tracked. + :vartype serial_number: str + :ivar carrier_name: Name of the carrier used in the delivery. + :vartype carrier_name: str + :ivar tracking_id: Tracking ID of the shipment. + :vartype tracking_id: str + :ivar tracking_url: Tracking URL of the shipment. + :vartype tracking_url: str """ _attribute_map = { @@ -2480,6 +2896,16 @@ def __init__( tracking_url: Optional[str] = None, **kwargs ): + """ + :keyword serial_number: Serial number of the device being tracked. + :paramtype serial_number: str + :keyword carrier_name: Name of the carrier used in the delivery. + :paramtype carrier_name: str + :keyword tracking_id: Tracking ID of the shipment. + :paramtype tracking_id: str + :keyword tracking_url: Tracking URL of the shipment. + :paramtype tracking_url: str + """ super(TrackingInfo, self).__init__(**kwargs) self.serial_number = serial_number self.carrier_name = carrier_name @@ -2512,6 +2938,8 @@ def __init__( self, **kwargs ): + """ + """ super(TriggerList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2559,6 +2987,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateDownloadProgress, self).__init__(**kwargs) self.download_phase = None self.percent_complete = None @@ -2597,6 +3027,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateInstallProgress, self).__init__(**kwargs) self.percent_complete = None self.number_of_updates_to_install = None @@ -2614,15 +3046,15 @@ class UpdateSummary(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param device_version_number: The current version of the device in format: 1.2.17312.13.",. - :type device_version_number: str - :param friendly_device_version_name: The current version of the device in text format. - :type friendly_device_version_name: str - :param device_last_scanned_date_time: The last time when a scan was done on the device. - :type device_last_scanned_date_time: ~datetime.datetime - :param last_completed_scan_job_date_time: The time when the last scan job was completed + :ivar device_version_number: The current version of the device in format: 1.2.17312.13.",. + :vartype device_version_number: str + :ivar friendly_device_version_name: The current version of the device in text format. + :vartype friendly_device_version_name: str + :ivar device_last_scanned_date_time: The last time when a scan was done on the device. + :vartype device_last_scanned_date_time: ~datetime.datetime + :ivar last_completed_scan_job_date_time: The time when the last scan job was completed (success/cancelled/failed) on the appliance. - :type last_completed_scan_job_date_time: ~datetime.datetime + :vartype last_completed_scan_job_date_time: ~datetime.datetime :ivar last_completed_download_job_date_time: The time when the last Download job was completed (success/cancelled/failed) on the appliance. :vartype last_completed_download_job_date_time: ~datetime.datetime @@ -2711,6 +3143,17 @@ def __init__( last_completed_scan_job_date_time: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword device_version_number: The current version of the device in format: 1.2.17312.13.",. + :paramtype device_version_number: str + :keyword friendly_device_version_name: The current version of the device in text format. + :paramtype friendly_device_version_name: str + :keyword device_last_scanned_date_time: The last time when a scan was done on the device. + :paramtype device_last_scanned_date_time: ~datetime.datetime + :keyword last_completed_scan_job_date_time: The time when the last scan job was completed + (success/cancelled/failed) on the appliance. + :paramtype last_completed_scan_job_date_time: ~datetime.datetime + """ super(UpdateSummary, self).__init__(**kwargs) self.device_version_number = device_version_number self.friendly_device_version_name = friendly_device_version_name @@ -2736,11 +3179,12 @@ class UploadCertificateRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param authentication_type: The authentication type. Possible values include: "Invalid", + :ivar authentication_type: The authentication type. Possible values include: "Invalid", "AzureActiveDirectory". - :type authentication_type: str or ~azure.mgmt.databoxedge.v2019_03_01.models.AuthenticationType - :param certificate: Required. The base64 encoded certificate raw data. - :type certificate: str + :vartype authentication_type: str or + ~azure.mgmt.databoxedge.v2019_03_01.models.AuthenticationType + :ivar certificate: Required. The base64 encoded certificate raw data. + :vartype certificate: str """ _validation = { @@ -2759,6 +3203,14 @@ def __init__( authentication_type: Optional[Union[str, "AuthenticationType"]] = None, **kwargs ): + """ + :keyword authentication_type: The authentication type. Possible values include: "Invalid", + "AzureActiveDirectory". + :paramtype authentication_type: str or + ~azure.mgmt.databoxedge.v2019_03_01.models.AuthenticationType + :keyword certificate: Required. The base64 encoded certificate raw data. + :paramtype certificate: str + """ super(UploadCertificateRequest, self).__init__(**kwargs) self.authentication_type = authentication_type self.certificate = certificate @@ -2769,23 +3221,23 @@ class UploadCertificateResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param auth_type: Specifies authentication type. Possible values include: "Invalid", + :ivar auth_type: Specifies authentication type. Possible values include: "Invalid", "AzureActiveDirectory". - :type auth_type: str or ~azure.mgmt.databoxedge.v2019_03_01.models.AuthenticationType - :param resource_id: Required. The resource ID of the Data Box Edge/Gateway device. - :type resource_id: str - :param aad_authority: Required. Azure Active Directory tenant authority. - :type aad_authority: str - :param aad_tenant_id: Required. Azure Active Directory tenant ID. - :type aad_tenant_id: str - :param service_principal_client_id: Required. Azure Active Directory service principal client + :vartype auth_type: str or ~azure.mgmt.databoxedge.v2019_03_01.models.AuthenticationType + :ivar resource_id: Required. The resource ID of the Data Box Edge/Gateway device. + :vartype resource_id: str + :ivar aad_authority: Required. Azure Active Directory tenant authority. + :vartype aad_authority: str + :ivar aad_tenant_id: Required. Azure Active Directory tenant ID. + :vartype aad_tenant_id: str + :ivar service_principal_client_id: Required. Azure Active Directory service principal client ID. - :type service_principal_client_id: str - :param service_principal_object_id: Required. Azure Active Directory service principal object + :vartype service_principal_client_id: str + :ivar service_principal_object_id: Required. Azure Active Directory service principal object ID. - :type service_principal_object_id: str - :param azure_management_endpoint_audience: Required. The azure management endpoint audience. - :type azure_management_endpoint_audience: str + :vartype service_principal_object_id: str + :ivar azure_management_endpoint_audience: Required. The azure management endpoint audience. + :vartype azure_management_endpoint_audience: str """ _validation = { @@ -2819,6 +3271,25 @@ def __init__( auth_type: Optional[Union[str, "AuthenticationType"]] = None, **kwargs ): + """ + :keyword auth_type: Specifies authentication type. Possible values include: "Invalid", + "AzureActiveDirectory". + :paramtype auth_type: str or ~azure.mgmt.databoxedge.v2019_03_01.models.AuthenticationType + :keyword resource_id: Required. The resource ID of the Data Box Edge/Gateway device. + :paramtype resource_id: str + :keyword aad_authority: Required. Azure Active Directory tenant authority. + :paramtype aad_authority: str + :keyword aad_tenant_id: Required. Azure Active Directory tenant ID. + :paramtype aad_tenant_id: str + :keyword service_principal_client_id: Required. Azure Active Directory service principal client + ID. + :paramtype service_principal_client_id: str + :keyword service_principal_object_id: Required. Azure Active Directory service principal object + ID. + :paramtype service_principal_object_id: str + :keyword azure_management_endpoint_audience: Required. The azure management endpoint audience. + :paramtype azure_management_endpoint_audience: str + """ super(UploadCertificateResponse, self).__init__(**kwargs) self.auth_type = auth_type self.resource_id = resource_id @@ -2840,11 +3311,12 @@ class User(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param encrypted_password: The password details. - :type encrypted_password: ~azure.mgmt.databoxedge.v2019_03_01.models.AsymmetricEncryptedSecret - :param share_access_rights: List of shares that the user has rights on. This field should not - be specified during user creation. - :type share_access_rights: list[~azure.mgmt.databoxedge.v2019_03_01.models.ShareAccessRight] + :ivar encrypted_password: The password details. + :vartype encrypted_password: + ~azure.mgmt.databoxedge.v2019_03_01.models.AsymmetricEncryptedSecret + :ivar share_access_rights: List of shares that the user has rights on. This field should not be + specified during user creation. + :vartype share_access_rights: list[~azure.mgmt.databoxedge.v2019_03_01.models.ShareAccessRight] """ _validation = { @@ -2868,6 +3340,15 @@ def __init__( share_access_rights: Optional[List["ShareAccessRight"]] = None, **kwargs ): + """ + :keyword encrypted_password: The password details. + :paramtype encrypted_password: + ~azure.mgmt.databoxedge.v2019_03_01.models.AsymmetricEncryptedSecret + :keyword share_access_rights: List of shares that the user has rights on. This field should not + be specified during user creation. + :paramtype share_access_rights: + list[~azure.mgmt.databoxedge.v2019_03_01.models.ShareAccessRight] + """ super(User, self).__init__(**kwargs) self.encrypted_password = encrypted_password self.share_access_rights = share_access_rights @@ -2878,11 +3359,11 @@ class UserAccessRight(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param user_id: Required. User ID (already existing in the device). - :type user_id: str - :param access_type: Required. Type of access to be allowed for the user. Possible values + :ivar user_id: Required. User ID (already existing in the device). + :vartype user_id: str + :ivar access_type: Required. Type of access to be allowed for the user. Possible values include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2019_03_01.models.ShareAccessType + :vartype access_type: str or ~azure.mgmt.databoxedge.v2019_03_01.models.ShareAccessType """ _validation = { @@ -2902,6 +3383,13 @@ def __init__( access_type: Union[str, "ShareAccessType"], **kwargs ): + """ + :keyword user_id: Required. User ID (already existing in the device). + :paramtype user_id: str + :keyword access_type: Required. Type of access to be allowed for the user. Possible values + include: "Change", "Read", "Custom". + :paramtype access_type: str or ~azure.mgmt.databoxedge.v2019_03_01.models.ShareAccessType + """ super(UserAccessRight, self).__init__(**kwargs) self.user_id = user_id self.access_type = access_type @@ -2932,6 +3420,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserList, self).__init__(**kwargs) self.value = None self.next_link = None diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_alerts_operations.py index 23704e68521d..fc945f70fb5d 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_alerts_operations.py @@ -5,23 +5,97 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AlertsOperations(object): """AlertsOperations operations. @@ -45,13 +119,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AlertList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.AlertList"]: """Gets all the alerts for a data box edge/gateway device. :param device_name: The device name. @@ -68,36 +142,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AlertList', pipeline_response) + deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,19 +186,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Alert" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Alert": """Gets an alert by name. Gets an alert by name. @@ -148,28 +220,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,4 +245,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_bandwidth_schedules_operations.py index fb1ea0ce78d2..25ed2d5a90e6 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_bandwidth_schedules_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class BandwidthSchedulesOperations(object): """BandwidthSchedulesOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BandwidthSchedulesList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.BandwidthSchedulesList"]: """Gets all the bandwidth schedules for a data box edge/gateway device. :param device_name: The device name. @@ -61,8 +219,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BandwidthSchedulesList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2019_03_01.models.BandwidthSchedulesList] + :return: An iterator like instance of either BandwidthSchedulesList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2019_03_01.models.BandwidthSchedulesList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedulesList"] @@ -70,36 +230,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BandwidthSchedulesList', pipeline_response) + deserialized = self._deserialize("BandwidthSchedulesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,19 +274,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BandwidthSchedule" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.BandwidthSchedule": """Gets the properties of the specified bandwidth schedule. :param device_name: The device name. @@ -148,28 +306,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,49 +331,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.BandwidthSchedule" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.BandwidthSchedule"] + device_name: str, + name: str, + resource_group_name: str, + parameters: "_models.BandwidthSchedule", + **kwargs: Any + ) -> Optional["_models.BandwidthSchedule"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BandwidthSchedule"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BandwidthSchedule') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BandwidthSchedule') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -241,17 +380,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.BandwidthSchedule" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BandwidthSchedule"] + device_name: str, + name: str, + resource_group_name: str, + parameters: "_models.BandwidthSchedule", + **kwargs: Any + ) -> LROPoller["_models.BandwidthSchedule"]: """Creates or updates a bandwidth schedule. :param device_name: The device name. @@ -264,15 +405,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.databoxedge.v2019_03_01.models.BandwidthSchedule :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either BandwidthSchedule or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_03_01.models.BandwidthSchedule] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BandwidthSchedule or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_03_01.models.BandwidthSchedule] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedule"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +431,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BandwidthSchedule', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -318,43 +457,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -367,14 +496,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the specified bandwidth schedule. :param device_name: The device name. @@ -385,15 +515,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -408,22 +540,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -435,4 +559,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_devices_operations.py index eafcd638a8ef..8770117f6715 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_devices_operations.py @@ -5,25 +5,556 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_subscription_request( + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_download_updates_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_extended_information_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_install_updates_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_network_settings_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/networkSettings/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_scan_for_updates_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_security_settings_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_update_summary_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_upload_certificate_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/uploadCertificate') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class DevicesOperations(object): """DevicesOperations operations. @@ -47,20 +578,22 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DataBoxEdgeDeviceList"] + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.DataBoxEdgeDeviceList"]: """Gets all the data box edge/gateway devices in a subscription. :param expand: Specify $expand=details to populate additional fields related to the resource or Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2019_03_01.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2019_03_01.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -68,36 +601,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,18 +643,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DataBoxEdgeDeviceList"] + resource_group_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.DataBoxEdgeDeviceList"]: """Gets all the data box edge/gateway devices in a resource group. :param resource_group_name: The resource group name. @@ -135,8 +664,10 @@ def list_by_resource_group( Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2019_03_01.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2019_03_01.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -144,37 +675,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -192,18 +719,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDevice" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DataBoxEdgeDevice": """Gets the properties of the data box edge/gateway device. :param device_name: The device name. @@ -220,27 +748,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -254,47 +772,38 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - resource_group_name, # type: str - data_box_edge_device, # type: "_models.DataBoxEdgeDevice" - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDevice" + device_name: str, + resource_group_name: str, + data_box_edge_device: "_models.DataBoxEdgeDevice", + **kwargs: Any + ) -> "_models.DataBoxEdgeDevice": cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -308,16 +817,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - resource_group_name, # type: str - data_box_edge_device, # type: "_models.DataBoxEdgeDevice" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DataBoxEdgeDevice"] + device_name: str, + resource_group_name: str, + data_box_edge_device: "_models.DataBoxEdgeDevice", + **kwargs: Any + ) -> LROPoller["_models.DataBoxEdgeDevice"]: """Creates or updates a Data Box Edge/Gateway resource. :param device_name: The device name. @@ -328,15 +839,20 @@ def begin_create_or_update( :type data_box_edge_device: ~azure.mgmt.databoxedge.v2019_03_01.models.DataBoxEdgeDevice :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DataBoxEdgeDevice or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_03_01.models.DataBoxEdgeDevice] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DataBoxEdgeDevice or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_03_01.models.DataBoxEdgeDevice] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] lro_delay = kwargs.pop( 'polling_interval', @@ -348,27 +864,21 @@ def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, data_box_edge_device=data_box_edge_device, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DataBoxEdgeDevice', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -380,41 +890,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore def _delete_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -427,13 +927,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the data box edge/gateway device. :param device_name: The device name. @@ -442,15 +943,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -464,21 +967,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -490,16 +986,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + @distributed_trace def update( self, - device_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.DataBoxEdgeDevicePatch" - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDevice" + device_name: str, + resource_group_name: str, + parameters: "_models.DataBoxEdgeDevicePatch", + **kwargs: Any + ) -> "_models.DataBoxEdgeDevice": """Modifies a Data Box Edge/Gateway resource. :param device_name: The device name. @@ -518,32 +1015,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') + + request = build_update_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -557,41 +1044,32 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + def _download_updates_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._download_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_download_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._download_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -604,13 +1082,14 @@ def _download_updates_initial( _download_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + + @distributed_trace def begin_download_updates( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Downloads the updates on a data box edge/gateway device. Downloads the updates on a data box edge/gateway device. @@ -621,15 +1100,17 @@ def begin_download_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -643,21 +1124,14 @@ def begin_download_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -669,15 +1143,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_download_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + @distributed_trace def get_extended_information( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDeviceExtendedInfo" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DataBoxEdgeDeviceExtendedInfo": """Gets additional information for the specified data box edge/gateway device. :param device_name: The device name. @@ -694,27 +1169,17 @@ def get_extended_information( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get_extended_information.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_extended_information_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_extended_information.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -728,41 +1193,32 @@ def get_extended_information( return cls(pipeline_response, deserialized, {}) return deserialized + get_extended_information.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation'} # type: ignore + def _install_updates_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._install_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_install_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._install_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -775,13 +1231,14 @@ def _install_updates_initial( _install_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + + @distributed_trace def begin_install_updates( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Installs the updates on the data box edge/gateway device. Installs the updates on the data box edge/gateway device. @@ -792,15 +1249,17 @@ def begin_install_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -814,21 +1273,14 @@ def begin_install_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -840,15 +1292,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_install_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + @distributed_trace def get_network_settings( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.NetworkSettings" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.NetworkSettings": """Gets the network settings of the specified data box edge/gateway device. :param device_name: The device name. @@ -865,27 +1318,17 @@ def get_network_settings( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get_network_settings.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_network_settings_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_network_settings.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -899,41 +1342,32 @@ def get_network_settings( return cls(pipeline_response, deserialized, {}) return deserialized + get_network_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/networkSettings/default'} # type: ignore + def _scan_for_updates_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._scan_for_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_scan_for_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._scan_for_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -946,13 +1380,14 @@ def _scan_for_updates_initial( _scan_for_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore + + @distributed_trace def begin_scan_for_updates( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Scans for updates on a data box edge/gateway device. Scans for updates on a data box edge/gateway device. @@ -963,15 +1398,17 @@ def begin_scan_for_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -985,21 +1422,14 @@ def begin_scan_for_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1011,47 +1441,37 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_scan_for_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore def _create_or_update_security_settings_initial( self, - device_name, # type: str - resource_group_name, # type: str - security_settings, # type: "_models.SecuritySettings" - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + security_settings: "_models.SecuritySettings", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_security_settings_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(security_settings, 'SecuritySettings') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_security_settings_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_security_settings_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(security_settings, 'SecuritySettings') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1064,14 +1484,15 @@ def _create_or_update_security_settings_initial( _create_or_update_security_settings_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + + @distributed_trace def begin_create_or_update_security_settings( self, - device_name, # type: str - resource_group_name, # type: str - security_settings, # type: "_models.SecuritySettings" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + security_settings: "_models.SecuritySettings", + **kwargs: Any + ) -> LROPoller[None]: """Updates the security settings on a data box edge/gateway device. :param device_name: The device name. @@ -1082,15 +1503,18 @@ def begin_create_or_update_security_settings( :type security_settings: ~azure.mgmt.databoxedge.v2019_03_01.models.SecuritySettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1102,24 +1526,18 @@ def begin_create_or_update_security_settings( device_name=device_name, resource_group_name=resource_group_name, security_settings=security_settings, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1131,16 +1549,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_security_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + @distributed_trace def get_update_summary( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.UpdateSummary" - """Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.UpdateSummary": + """Gets information about the availability of updates based on the last scan of the device. It + also gets information about any ongoing download or install jobs on the device. Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. @@ -1159,27 +1579,17 @@ def get_update_summary( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get_update_summary.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_update_summary_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_update_summary.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1193,16 +1603,18 @@ def get_update_summary( return cls(pipeline_response, deserialized, {}) return deserialized + get_update_summary.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default'} # type: ignore + + @distributed_trace def upload_certificate( self, - device_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.UploadCertificateRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.UploadCertificateResponse" + device_name: str, + resource_group_name: str, + parameters: "_models.UploadCertificateRequest", + **kwargs: Any + ) -> "_models.UploadCertificateResponse": """Uploads registration certificate for the device. :param device_name: The device name. @@ -1221,32 +1633,22 @@ def upload_certificate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.upload_certificate.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'UploadCertificateRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_upload_certificate_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.upload_certificate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'UploadCertificateRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1260,4 +1662,6 @@ def upload_certificate( return cls(pipeline_response, deserialized, {}) return deserialized + upload_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/uploadCertificate'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_jobs_operations.py index 425a366cf4bd..5214c1b87293 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_jobs_operations.py @@ -5,22 +5,61 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class JobsOperations(object): """JobsOperations operations. @@ -44,14 +83,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Job" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Job": """Gets the details of a specified job on a data box edge/gateway device. Gets the details of a specified job on a data box edge/gateway device. @@ -72,28 +111,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -107,4 +136,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_operations.py index a12f6aa1e7c9..1aceb4294107 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.DataBoxEdge/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,11 +72,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationsList"] + **kwargs: Any + ) -> Iterable["_models.OperationsList"]: """List all the supported operations. List all the supported operations. @@ -64,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationsList', pipeline_response) + deserialized = self._deserialize("OperationsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -105,6 +129,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_operations_status_operations.py index 57e5cb8d66d0..058fe2f35d93 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_operations_status_operations.py @@ -5,22 +5,61 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/operationsStatus/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class OperationsStatusOperations(object): """OperationsStatusOperations operations. @@ -44,14 +83,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Job" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Job": """Gets the details of a specified job on a data box edge/gateway device. Gets the details of a specified job on a data box edge/gateway device. @@ -72,28 +111,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -107,4 +136,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/operationsStatus/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_orders_operations.py index 6227f5ccf7f1..58df29880e86 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_orders_operations.py @@ -5,25 +5,177 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class OrdersOperations(object): """OrdersOperations operations. @@ -47,13 +199,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OrderList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.OrderList"]: """Lists all the orders related to a data box edge/gateway device. Lists all the orders related to a data box edge/gateway device. @@ -72,36 +224,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OrderList', pipeline_response) + deserialized = self._deserialize("OrderList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,18 +268,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Order" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Order": """Gets a specific order by name. Gets a specific order by name. @@ -149,27 +299,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,47 +323,38 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - resource_group_name, # type: str - order, # type: "_models.Order" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Order"] + device_name: str, + resource_group_name: str, + order: "_models.Order", + **kwargs: Any + ) -> Optional["_models.Order"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Order"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(order, 'Order') + + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(order, 'Order') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,16 +370,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - resource_group_name, # type: str - order, # type: "_models.Order" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Order"] + device_name: str, + resource_group_name: str, + order: "_models.Order", + **kwargs: Any + ) -> LROPoller["_models.Order"]: """Creates or updates an order. Creates or updates an order. @@ -261,15 +394,18 @@ def begin_create_or_update( :type order: ~azure.mgmt.databoxedge.v2019_03_01.models.Order :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Order or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_03_01.models.Order] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Order"] lro_delay = kwargs.pop( 'polling_interval', @@ -281,27 +417,21 @@ def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, order=order, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Order', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -313,41 +443,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore def _delete_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -360,13 +480,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the order related to the device. Deletes the order related to the device. @@ -377,15 +498,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -399,21 +522,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -425,4 +541,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_roles_operations.py index afb182c9818e..345a64a1d8a9 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_roles_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class RolesOperations(object): """RolesOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RoleList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.RoleList"]: """Lists all the roles configured in a data box edge/gateway device. :param device_name: The device name. @@ -70,36 +228,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RoleList', pipeline_response) + deserialized = self._deserialize("RoleList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,19 +272,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Role" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Role": """Gets a specific role by name. :param device_name: The device name. @@ -148,28 +304,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,49 +329,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - role, # type: "_models.Role" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Role"] + device_name: str, + name: str, + resource_group_name: str, + role: "_models.Role", + **kwargs: Any + ) -> Optional["_models.Role"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Role"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(role, 'Role') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(role, 'Role') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -241,17 +378,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - role, # type: "_models.Role" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Role"] + device_name: str, + name: str, + resource_group_name: str, + role: "_models.Role", + **kwargs: Any + ) -> LROPoller["_models.Role"]: """Create or update a role. :param device_name: The device name. @@ -264,15 +403,18 @@ def begin_create_or_update( :type role: ~azure.mgmt.databoxedge.v2019_03_01.models.Role :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Role or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_03_01.models.Role] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Role"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +427,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, role=role, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Role', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -318,43 +453,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -367,14 +492,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the role on the data box edge device. :param device_name: The device name. @@ -385,15 +511,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -408,22 +536,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -435,4 +555,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_shares_operations.py index 294c68068676..c4fd76542e3e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_shares_operations.py @@ -5,25 +5,220 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_refresh_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SharesOperations(object): """SharesOperations operations. @@ -47,13 +242,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ShareList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ShareList"]: """Lists all the shares in a data box edge/gateway device. Lists all the shares in a data box edge/gateway device. @@ -72,36 +267,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ShareList', pipeline_response) + deserialized = self._deserialize("ShareList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +311,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Share" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Share": """Gets a share by name. Gets a share by name. @@ -152,28 +345,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -187,49 +370,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - share, # type: "_models.Share" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Share"] + device_name: str, + name: str, + resource_group_name: str, + share: "_models.Share", + **kwargs: Any + ) -> Optional["_models.Share"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Share"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(share, 'Share') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(share, 'Share') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,17 +419,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - share, # type: "_models.Share" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Share"] + device_name: str, + name: str, + resource_group_name: str, + share: "_models.Share", + **kwargs: Any + ) -> LROPoller["_models.Share"]: """Creates a new share or updates an existing share on the device. Creates a new share or updates an existing share on the device. @@ -270,15 +446,18 @@ def begin_create_or_update( :type share: ~azure.mgmt.databoxedge.v2019_03_01.models.Share :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Share or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_03_01.models.Share] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Share"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +470,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, share=share, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Share', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -324,43 +496,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,14 +535,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the share on the data box edge/gateway device. :param device_name: The device name. @@ -391,15 +554,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -414,22 +579,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -441,43 +598,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore def _refresh_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -490,14 +637,15 @@ def _refresh_initial( _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore + + @distributed_trace def begin_refresh( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Refreshes the share metadata with the data from the cloud. Refreshes the share metadata with the data from the cloud. @@ -510,15 +658,17 @@ def begin_refresh( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -533,22 +683,14 @@ def begin_refresh( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -560,4 +702,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_storage_account_credentials_operations.py index 869e22514f35..af29990f2cba 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_storage_account_credentials_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class StorageAccountCredentialsOperations(object): """StorageAccountCredentialsOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountCredentialList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountCredentialList"]: """Gets all the storage account credentials in a data box edge/gateway device. Gets all the storage account credentials in a data box edge/gateway device. @@ -63,8 +221,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountCredentialList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2019_03_01.models.StorageAccountCredentialList] + :return: An iterator like instance of either StorageAccountCredentialList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2019_03_01.models.StorageAccountCredentialList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredentialList"] @@ -72,36 +232,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('StorageAccountCredentialList', pipeline_response) + deserialized = self._deserialize("StorageAccountCredentialList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +276,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountCredential" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.StorageAccountCredential": """Gets the properties of the specified storage account credential. :param device_name: The device name. @@ -150,28 +308,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,49 +333,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - storage_account_credential, # type: "_models.StorageAccountCredential" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageAccountCredential"] + device_name: str, + name: str, + resource_group_name: str, + storage_account_credential: "_models.StorageAccountCredential", + **kwargs: Any + ) -> Optional["_models.StorageAccountCredential"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccountCredential"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(storage_account_credential, 'StorageAccountCredential') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_account_credential, 'StorageAccountCredential') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -243,17 +382,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - storage_account_credential, # type: "_models.StorageAccountCredential" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageAccountCredential"] + device_name: str, + name: str, + resource_group_name: str, + storage_account_credential: "_models.StorageAccountCredential", + **kwargs: Any + ) -> LROPoller["_models.StorageAccountCredential"]: """Creates or updates the storage account credential. :param device_name: The device name. @@ -263,18 +404,24 @@ def begin_create_or_update( :param resource_group_name: The resource group name. :type resource_group_name: str :param storage_account_credential: The storage account credential. - :type storage_account_credential: ~azure.mgmt.databoxedge.v2019_03_01.models.StorageAccountCredential + :type storage_account_credential: + ~azure.mgmt.databoxedge.v2019_03_01.models.StorageAccountCredential :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either StorageAccountCredential or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_03_01.models.StorageAccountCredential] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either StorageAccountCredential or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_03_01.models.StorageAccountCredential] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredential"] lro_delay = kwargs.pop( 'polling_interval', @@ -287,28 +434,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, storage_account_credential=storage_account_credential, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccountCredential', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -320,43 +460,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -369,14 +499,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the storage account credential. :param device_name: The device name. @@ -387,15 +518,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -410,22 +543,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -437,4 +562,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_triggers_operations.py index 269bedf97869..c2222ecdd598 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_triggers_operations.py @@ -5,25 +5,187 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class TriggersOperations(object): """TriggersOperations operations. @@ -47,14 +209,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.TriggerList"] + device_name: str, + resource_group_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.TriggerList"]: """Lists all the triggers configured in the device. :param device_name: The device name. @@ -74,38 +236,35 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TriggerList', pipeline_response) + deserialized = self._deserialize("TriggerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -123,19 +282,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Trigger" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Trigger": """Get a specific trigger by name. :param device_name: The device name. @@ -154,28 +314,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -189,49 +339,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - trigger, # type: "_models.Trigger" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Trigger"] + device_name: str, + name: str, + resource_group_name: str, + trigger: "_models.Trigger", + **kwargs: Any + ) -> Optional["_models.Trigger"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Trigger"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(trigger, 'Trigger') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(trigger, 'Trigger') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,17 +388,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - trigger, # type: "_models.Trigger" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Trigger"] + device_name: str, + name: str, + resource_group_name: str, + trigger: "_models.Trigger", + **kwargs: Any + ) -> LROPoller["_models.Trigger"]: """Creates or updates a trigger. :param device_name: Creates or updates a trigger. @@ -270,15 +413,18 @@ def begin_create_or_update( :type trigger: ~azure.mgmt.databoxedge.v2019_03_01.models.Trigger :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Trigger or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_03_01.models.Trigger] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Trigger"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +437,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, trigger=trigger, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Trigger', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -324,43 +463,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,14 +502,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the trigger on the gateway device. :param device_name: The device name. @@ -391,15 +521,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -414,22 +546,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -441,4 +565,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_users_operations.py index e990e85a43cd..92b04ae29703 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_users_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class UsersOperations(object): """UsersOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UserList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.UserList"]: """Gets all the users registered on a data box edge/gateway device. :param device_name: The device name. @@ -70,36 +228,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('UserList', pipeline_response) + deserialized = self._deserialize("UserList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,19 +272,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.User" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.User": """Gets the properties of the specified user. :param device_name: The device name. @@ -148,28 +304,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,49 +329,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - user, # type: "_models.User" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.User"] + device_name: str, + name: str, + resource_group_name: str, + user: "_models.User", + **kwargs: Any + ) -> Optional["_models.User"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.User"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(user, 'User') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(user, 'User') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -241,17 +378,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - user, # type: "_models.User" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.User"] + device_name: str, + name: str, + resource_group_name: str, + user: "_models.User", + **kwargs: Any + ) -> LROPoller["_models.User"]: """Creates a new user or updates an existing user's information on a data box edge/gateway device. :param device_name: The device name. @@ -264,15 +403,18 @@ def begin_create_or_update( :type user: ~azure.mgmt.databoxedge.v2019_03_01.models.User :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either User or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_03_01.models.User] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.User"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +427,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, user=user, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('User', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -318,43 +453,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-03-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -367,14 +492,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the user on a databox edge/gateway device. :param device_name: The device name. @@ -385,15 +511,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -408,22 +536,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -435,4 +555,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/__init__.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/__init__.py index e63196b6b98f..577ebf317c02 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/__init__.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/__init__.py @@ -7,10 +7,12 @@ # -------------------------------------------------------------------------- from ._data_box_edge_management_client import DataBoxEdgeManagementClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['DataBoxEdgeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_configuration.py index e224a4c88390..15157d08dfda 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_configuration.py @@ -6,19 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential -VERSION = "unknown" class DataBoxEdgeManagementClientConfiguration(Configuration): """Configuration for DataBoxEdgeManagementClient. @@ -34,16 +33,15 @@ class DataBoxEdgeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -67,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_data_box_edge_management_client.py index b6bdb6e27a72..8872732bc803 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_data_box_edge_management_client.py @@ -6,36 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import DataBoxEdgeManagementClientConfiguration +from .operations import AlertsOperations, BandwidthSchedulesOperations, DevicesOperations, JobsOperations, NodesOperations, Operations, OperationsStatusOperations, OrdersOperations, RolesOperations, SharesOperations, StorageAccountCredentialsOperations, TriggersOperations, UsersOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import DataBoxEdgeManagementClientConfiguration -from .operations import Operations -from .operations import DevicesOperations -from .operations import AlertsOperations -from .operations import BandwidthSchedulesOperations -from .operations import JobsOperations -from .operations import NodesOperations -from .operations import OperationsStatusOperations -from .operations import OrdersOperations -from .operations import RolesOperations -from .operations import SharesOperations -from .operations import StorageAccountCredentialsOperations -from .operations import TriggersOperations -from .operations import UsersOperations -from . import models - -class DataBoxEdgeManagementClient(object): +class DataBoxEdgeManagementClient: """The DataBoxEdge Client. :ivar operations: Operations operations @@ -45,13 +31,15 @@ class DataBoxEdgeManagementClient(object): :ivar alerts: AlertsOperations operations :vartype alerts: azure.mgmt.databoxedge.v2019_07_01.operations.AlertsOperations :ivar bandwidth_schedules: BandwidthSchedulesOperations operations - :vartype bandwidth_schedules: azure.mgmt.databoxedge.v2019_07_01.operations.BandwidthSchedulesOperations + :vartype bandwidth_schedules: + azure.mgmt.databoxedge.v2019_07_01.operations.BandwidthSchedulesOperations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.databoxedge.v2019_07_01.operations.JobsOperations :ivar nodes: NodesOperations operations :vartype nodes: azure.mgmt.databoxedge.v2019_07_01.operations.NodesOperations :ivar operations_status: OperationsStatusOperations operations - :vartype operations_status: azure.mgmt.databoxedge.v2019_07_01.operations.OperationsStatusOperations + :vartype operations_status: + azure.mgmt.databoxedge.v2019_07_01.operations.OperationsStatusOperations :ivar orders: OrdersOperations operations :vartype orders: azure.mgmt.databoxedge.v2019_07_01.operations.OrdersOperations :ivar roles: RolesOperations operations @@ -59,7 +47,8 @@ class DataBoxEdgeManagementClient(object): :ivar shares: SharesOperations operations :vartype shares: azure.mgmt.databoxedge.v2019_07_01.operations.SharesOperations :ivar storage_account_credentials: StorageAccountCredentialsOperations operations - :vartype storage_account_credentials: azure.mgmt.databoxedge.v2019_07_01.operations.StorageAccountCredentialsOperations + :vartype storage_account_credentials: + azure.mgmt.databoxedge.v2019_07_01.operations.StorageAccountCredentialsOperations :ivar triggers: TriggersOperations operations :vartype triggers: azure.mgmt.databoxedge.v2019_07_01.operations.TriggersOperations :ivar users: UsersOperations operations @@ -68,72 +57,66 @@ class DataBoxEdgeManagementClient(object): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = DataBoxEdgeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = DataBoxEdgeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.orders = OrdersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.shares = SharesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bandwidth_schedules = BandwidthSchedulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations_status = OperationsStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_account_credentials = StorageAccountCredentialsOperations(self._client, self._config, self._serialize, self._deserialize) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_metadata.json b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_metadata.json index 8880d13820a0..fc572dc8b14a 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_metadata.json +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_metadata.json @@ -5,13 +5,13 @@ "name": "DataBoxEdgeManagementClient", "filename": "_data_box_edge_management_client", "description": "The DataBoxEdge Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "operations": "Operations", diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_patch.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_vendor.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_version.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/__init__.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/__init__.py index c33d46ee91d8..f33cac1fd9b0 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/__init__.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._data_box_edge_management_client import DataBoxEdgeManagementClient __all__ = ['DataBoxEdgeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/_configuration.py index a741729c4134..be5fd9d3c4ae 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/_configuration.py @@ -10,13 +10,14 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class DataBoxEdgeManagementClientConfiguration(Configuration): """Configuration for DataBoxEdgeManagementClient. @@ -36,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -63,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/_data_box_edge_management_client.py index 646214481c40..d0300ee265a0 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/_data_box_edge_management_client.py @@ -6,34 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import DataBoxEdgeManagementClientConfiguration +from .operations import AlertsOperations, BandwidthSchedulesOperations, DevicesOperations, JobsOperations, NodesOperations, Operations, OperationsStatusOperations, OrdersOperations, RolesOperations, SharesOperations, StorageAccountCredentialsOperations, TriggersOperations, UsersOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import DataBoxEdgeManagementClientConfiguration -from .operations import Operations -from .operations import DevicesOperations -from .operations import AlertsOperations -from .operations import BandwidthSchedulesOperations -from .operations import JobsOperations -from .operations import NodesOperations -from .operations import OperationsStatusOperations -from .operations import OrdersOperations -from .operations import RolesOperations -from .operations import SharesOperations -from .operations import StorageAccountCredentialsOperations -from .operations import TriggersOperations -from .operations import UsersOperations -from .. import models - - -class DataBoxEdgeManagementClient(object): +class DataBoxEdgeManagementClient: """The DataBoxEdge Client. :ivar operations: Operations operations @@ -43,13 +31,15 @@ class DataBoxEdgeManagementClient(object): :ivar alerts: AlertsOperations operations :vartype alerts: azure.mgmt.databoxedge.v2019_07_01.aio.operations.AlertsOperations :ivar bandwidth_schedules: BandwidthSchedulesOperations operations - :vartype bandwidth_schedules: azure.mgmt.databoxedge.v2019_07_01.aio.operations.BandwidthSchedulesOperations + :vartype bandwidth_schedules: + azure.mgmt.databoxedge.v2019_07_01.aio.operations.BandwidthSchedulesOperations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.databoxedge.v2019_07_01.aio.operations.JobsOperations :ivar nodes: NodesOperations operations :vartype nodes: azure.mgmt.databoxedge.v2019_07_01.aio.operations.NodesOperations :ivar operations_status: OperationsStatusOperations operations - :vartype operations_status: azure.mgmt.databoxedge.v2019_07_01.aio.operations.OperationsStatusOperations + :vartype operations_status: + azure.mgmt.databoxedge.v2019_07_01.aio.operations.OperationsStatusOperations :ivar orders: OrdersOperations operations :vartype orders: azure.mgmt.databoxedge.v2019_07_01.aio.operations.OrdersOperations :ivar roles: RolesOperations operations @@ -57,7 +47,8 @@ class DataBoxEdgeManagementClient(object): :ivar shares: SharesOperations operations :vartype shares: azure.mgmt.databoxedge.v2019_07_01.aio.operations.SharesOperations :ivar storage_account_credentials: StorageAccountCredentialsOperations operations - :vartype storage_account_credentials: azure.mgmt.databoxedge.v2019_07_01.aio.operations.StorageAccountCredentialsOperations + :vartype storage_account_credentials: + azure.mgmt.databoxedge.v2019_07_01.aio.operations.StorageAccountCredentialsOperations :ivar triggers: TriggersOperations operations :vartype triggers: azure.mgmt.databoxedge.v2019_07_01.aio.operations.TriggersOperations :ivar users: UsersOperations operations @@ -66,70 +57,66 @@ class DataBoxEdgeManagementClient(object): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = DataBoxEdgeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = DataBoxEdgeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bandwidth_schedules = BandwidthSchedulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations_status = OperationsStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_account_credentials = StorageAccountCredentialsOperations(self._client, self._config, self._serialize, self._deserialize) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) + - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.orders = OrdersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.shares = SharesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/_patch.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_alerts_operations.py index 63b2fd3d1975..e0eb6c2ec7a5 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_alerts_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._alerts_operations import build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,11 +46,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.AlertList"]: """Gets all the alerts for a Data Box Edge/Data Box Gateway device. @@ -55,7 +61,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AlertList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.AlertList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.AlertList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertList"] @@ -63,36 +70,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AlertList', pipeline_response) + deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,17 +114,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Alert": """Gets an alert by name. @@ -142,28 +148,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,4 +173,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_bandwidth_schedules_operations.py index 4206112163f5..a081b0789d0e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_bandwidth_schedules_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._bandwidth_schedules_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.BandwidthSchedulesList"]: """Gets all the bandwidth schedules for a Data Box Edge/Data Box Gateway device. @@ -56,8 +62,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BandwidthSchedulesList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.BandwidthSchedulesList] + :return: An iterator like instance of either BandwidthSchedulesList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.BandwidthSchedulesList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedulesList"] @@ -65,36 +73,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BandwidthSchedulesList', pipeline_response) + deserialized = self._deserialize("BandwidthSchedulesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,17 +117,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.BandwidthSchedule": """Gets the properties of the specified bandwidth schedule. @@ -142,28 +149,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,48 +174,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, parameters: "_models.BandwidthSchedule", - **kwargs + **kwargs: Any ) -> Optional["_models.BandwidthSchedule"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BandwidthSchedule"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BandwidthSchedule') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BandwidthSchedule') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -234,15 +223,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, parameters: "_models.BandwidthSchedule", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.BandwidthSchedule"]: """Creates or updates a bandwidth schedule. @@ -256,15 +248,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.databoxedge.v2019_07_01.models.BandwidthSchedule :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BandwidthSchedule or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_07_01.models.BandwidthSchedule] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BandwidthSchedule or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_07_01.models.BandwidthSchedule] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedule"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,28 +274,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BandwidthSchedule', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -310,6 +300,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore async def _delete_initial( @@ -317,35 +308,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -358,12 +339,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the specified bandwidth schedule. @@ -375,15 +358,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -398,22 +383,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -425,4 +402,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_devices_operations.py index 3c9dbd934fa3..3e9d6b36c05f 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_devices_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._devices_operations import build_create_or_update_request_initial, build_create_or_update_security_settings_request_initial, build_delete_request_initial, build_download_updates_request_initial, build_get_extended_information_request, build_get_network_settings_request, build_get_request, build_get_update_summary_request, build_install_updates_request_initial, build_list_by_resource_group_request, build_list_by_subscription_request, build_scan_for_updates_request_initial, build_update_request, build_upload_certificate_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,10 +48,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, expand: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.DataBoxEdgeDeviceList"]: """Gets all the Data Box Edge/Data Box Gateway devices in a subscription. @@ -54,8 +60,10 @@ def list_by_subscription( Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -63,36 +71,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,16 +113,18 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, expand: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.DataBoxEdgeDeviceList"]: """Gets all the Data Box Edge/Data Box Gateway devices in a resource group. @@ -129,8 +134,10 @@ def list_by_resource_group( Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -138,37 +145,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -186,16 +189,18 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDevice": """Gets the properties of the Data Box Edge/Data Box Gateway device. @@ -213,27 +218,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,46 +242,38 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, resource_group_name: str, data_box_edge_device: "_models.DataBoxEdgeDevice", - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDevice": cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') + + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -300,14 +287,17 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, resource_group_name: str, data_box_edge_device: "_models.DataBoxEdgeDevice", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.DataBoxEdgeDevice"]: """Creates or updates a Data Box Edge/Data Box Gateway resource. @@ -319,15 +309,20 @@ async def begin_create_or_update( :type data_box_edge_device: ~azure.mgmt.databoxedge.v2019_07_01.models.DataBoxEdgeDevice :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DataBoxEdgeDevice or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_07_01.models.DataBoxEdgeDevice] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DataBoxEdgeDevice or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_07_01.models.DataBoxEdgeDevice] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] lro_delay = kwargs.pop( 'polling_interval', @@ -339,27 +334,21 @@ async def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, data_box_edge_device=data_box_edge_device, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DataBoxEdgeDevice', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -371,40 +360,31 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore async def _delete_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -417,11 +397,13 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the Data Box Edge/Data Box Gateway device. @@ -431,15 +413,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -453,21 +437,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -479,14 +456,16 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + @distributed_trace_async async def update( self, device_name: str, resource_group_name: str, parameters: "_models.DataBoxEdgeDevicePatch", - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDevice": """Modifies a Data Box Edge/Data Box Gateway resource. @@ -506,32 +485,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') + + request = build_update_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -545,40 +514,32 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + async def _download_updates_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._download_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_download_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._download_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -591,11 +552,13 @@ async def _download_updates_initial( _download_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + + @distributed_trace_async async def begin_download_updates( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Downloads the updates on a Data Box Edge/Data Box Gateway device. @@ -607,15 +570,17 @@ async def begin_download_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -629,21 +594,14 @@ async def begin_download_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -655,13 +613,15 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_download_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + @distributed_trace_async async def get_extended_information( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDeviceExtendedInfo": """Gets additional information for the specified Data Box Edge/Data Box Gateway device. @@ -679,27 +639,17 @@ async def get_extended_information( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get_extended_information.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_extended_information_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_extended_information.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -713,40 +663,32 @@ async def get_extended_information( return cls(pipeline_response, deserialized, {}) return deserialized + get_extended_information.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation'} # type: ignore + async def _install_updates_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._install_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_install_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._install_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -759,11 +701,13 @@ async def _install_updates_initial( _install_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + + @distributed_trace_async async def begin_install_updates( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Installs the updates on the Data Box Edge/Data Box Gateway device. @@ -775,15 +719,17 @@ async def begin_install_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -797,21 +743,14 @@ async def begin_install_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -823,13 +762,15 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_install_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + @distributed_trace_async async def get_network_settings( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.NetworkSettings": """Gets the network settings of the specified Data Box Edge/Data Box Gateway device. @@ -847,27 +788,17 @@ async def get_network_settings( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get_network_settings.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_network_settings_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_network_settings.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -881,40 +812,32 @@ async def get_network_settings( return cls(pipeline_response, deserialized, {}) return deserialized + get_network_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/networkSettings/default'} # type: ignore + async def _scan_for_updates_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._scan_for_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_scan_for_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._scan_for_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -927,11 +850,13 @@ async def _scan_for_updates_initial( _scan_for_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore + + @distributed_trace_async async def begin_scan_for_updates( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Scans for updates on a Data Box Edge/Data Box Gateway device. @@ -943,15 +868,17 @@ async def begin_scan_for_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -965,21 +892,14 @@ async def begin_scan_for_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -991,6 +911,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_scan_for_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore async def _create_or_update_security_settings_initial( @@ -998,39 +919,29 @@ async def _create_or_update_security_settings_initial( device_name: str, resource_group_name: str, security_settings: "_models.SecuritySettings", - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_security_settings_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(security_settings, 'SecuritySettings') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_security_settings_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_security_settings_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(security_settings, 'SecuritySettings') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1043,12 +954,14 @@ async def _create_or_update_security_settings_initial( _create_or_update_security_settings_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + + @distributed_trace_async async def begin_create_or_update_security_settings( self, device_name: str, resource_group_name: str, security_settings: "_models.SecuritySettings", - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Updates the security settings on a Data Box Edge/Data Box Gateway device. @@ -1060,15 +973,18 @@ async def begin_create_or_update_security_settings( :type security_settings: ~azure.mgmt.databoxedge.v2019_07_01.models.SecuritySettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1080,24 +996,18 @@ async def begin_create_or_update_security_settings( device_name=device_name, resource_group_name=resource_group_name, security_settings=security_settings, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1109,15 +1019,18 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_security_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + @distributed_trace_async async def get_update_summary( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.UpdateSummary": - """Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. + """Gets information about the availability of updates based on the last scan of the device. It + also gets information about any ongoing download or install jobs on the device. Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. @@ -1136,27 +1049,17 @@ async def get_update_summary( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get_update_summary.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_update_summary_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_update_summary.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1170,14 +1073,17 @@ async def get_update_summary( return cls(pipeline_response, deserialized, {}) return deserialized + get_update_summary.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default'} # type: ignore + + @distributed_trace_async async def upload_certificate( self, device_name: str, resource_group_name: str, parameters: "_models.UploadCertificateRequest", - **kwargs + **kwargs: Any ) -> "_models.UploadCertificateResponse": """Uploads registration certificate for the device. @@ -1197,32 +1103,22 @@ async def upload_certificate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.upload_certificate.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'UploadCertificateRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_upload_certificate_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.upload_certificate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'UploadCertificateRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1236,4 +1132,6 @@ async def upload_certificate( return cls(pipeline_response, deserialized, {}) return deserialized + upload_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/uploadCertificate'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_jobs_operations.py index d37c2211462b..e2ed8a720f16 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_jobs_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._jobs_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,12 +44,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Job": """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. @@ -67,28 +72,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -102,4 +97,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_nodes_operations.py index aa31f8eb7856..29c34d146d8d 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_nodes_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._nodes_operations import build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,11 +46,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.NodeList"]: """Gets all the nodes currently configured under this Data Box Edge device. @@ -55,7 +61,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either NodeList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.NodeList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.NodeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeList"] @@ -63,36 +70,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('NodeList', pipeline_response) + deserialized = self._deserialize("NodeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,6 +114,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_operations.py index 54c30b0a7257..f20928e2bc9e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,9 +46,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OperationsList"]: """List all the supported operations. @@ -51,7 +57,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.OperationsList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.OperationsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationsList"] @@ -59,30 +66,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationsList', pipeline_response) + deserialized = self._deserialize("OperationsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -100,6 +104,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_operations_status_operations.py index 63dd79b27a4f..8d27e9396568 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_operations_status_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations_status_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,12 +44,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Job": """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. @@ -67,28 +72,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -102,4 +97,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/operationsStatus/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_orders_operations.py index 96b8846d7b09..065345d2fbfc 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_orders_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._orders_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OrderList"]: """Lists all the orders related to a Data Box Edge/Data Box Gateway device. @@ -59,7 +65,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OrderList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.OrderList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.OrderList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OrderList"] @@ -67,36 +74,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OrderList', pipeline_response) + deserialized = self._deserialize("OrderList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,16 +118,18 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Order": """Gets a specific order by name. @@ -143,27 +149,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,46 +173,38 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + async def _create_or_update_initial( self, device_name: str, resource_group_name: str, order: "_models.Order", - **kwargs + **kwargs: Any ) -> Optional["_models.Order"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Order"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(order, 'Order') + + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(order, 'Order') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -232,14 +220,17 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, resource_group_name: str, order: "_models.Order", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Order"]: """Creates or updates an order. @@ -253,15 +244,18 @@ async def begin_create_or_update( :type order: ~azure.mgmt.databoxedge.v2019_07_01.models.Order :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Order or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_07_01.models.Order] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Order"] lro_delay = kwargs.pop( 'polling_interval', @@ -273,27 +267,21 @@ async def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, order=order, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Order', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -305,40 +293,31 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore async def _delete_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -351,11 +330,13 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the order related to the device. @@ -367,15 +348,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -389,21 +372,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -415,4 +391,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_roles_operations.py index a14931080c68..e612a9bb7aa5 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_roles_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._roles_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.RoleList"]: """Lists all the roles configured in a Data Box Edge/Data Box Gateway device. @@ -57,7 +63,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RoleList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.RoleList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.RoleList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleList"] @@ -65,36 +72,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RoleList', pipeline_response) + deserialized = self._deserialize("RoleList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,17 +116,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Role": """Gets a specific role by name. @@ -142,28 +148,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,48 +173,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, role: "_models.Role", - **kwargs + **kwargs: Any ) -> Optional["_models.Role"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Role"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(role, 'Role') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(role, 'Role') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -234,15 +222,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, role: "_models.Role", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Role"]: """Create or update a role. @@ -256,15 +247,18 @@ async def begin_create_or_update( :type role: ~azure.mgmt.databoxedge.v2019_07_01.models.Role :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Role or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_07_01.models.Role] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Role"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,28 +271,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, role=role, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Role', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -310,6 +297,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore async def _delete_initial( @@ -317,35 +305,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -358,12 +336,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the role on the device. @@ -375,15 +355,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -398,22 +380,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -425,4 +399,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_shares_operations.py index 6954c5453482..1b541880621c 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_shares_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._shares_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request, build_refresh_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ShareList"]: """Lists all the shares in a Data Box Edge/Data Box Gateway device. @@ -59,7 +65,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ShareList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.ShareList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.ShareList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ShareList"] @@ -67,36 +74,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ShareList', pipeline_response) + deserialized = self._deserialize("ShareList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,17 +118,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Share": """Gets a share by name. @@ -146,28 +152,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -181,48 +177,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, share: "_models.Share", - **kwargs + **kwargs: Any ) -> Optional["_models.Share"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Share"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(share, 'Share') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(share, 'Share') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -238,15 +226,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, share: "_models.Share", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Share"]: """Creates a new share or updates an existing share on the device. @@ -262,15 +253,18 @@ async def begin_create_or_update( :type share: ~azure.mgmt.databoxedge.v2019_07_01.models.Share :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Share or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_07_01.models.Share] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Share"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,28 +277,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, share=share, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Share', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -316,6 +303,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore async def _delete_initial( @@ -323,35 +311,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,12 +342,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the share on the Data Box Edge/Data Box Gateway device. @@ -381,15 +361,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -404,22 +386,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -431,6 +405,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore async def _refresh_initial( @@ -438,35 +413,25 @@ async def _refresh_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -479,12 +444,14 @@ async def _refresh_initial( _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore + + @distributed_trace_async async def begin_refresh( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Refreshes the share metadata with the data from the cloud. @@ -498,15 +465,17 @@ async def begin_refresh( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -521,22 +490,14 @@ async def begin_refresh( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -548,4 +509,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_storage_account_credentials_operations.py index 3b07e3ef0727..4f61922e5e4b 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_storage_account_credentials_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._storage_account_credentials_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.StorageAccountCredentialList"]: """Gets all the storage account credentials in a Data Box Edge/Data Box Gateway device. @@ -58,8 +64,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountCredentialList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.StorageAccountCredentialList] + :return: An iterator like instance of either StorageAccountCredentialList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.StorageAccountCredentialList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredentialList"] @@ -67,36 +75,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('StorageAccountCredentialList', pipeline_response) + deserialized = self._deserialize("StorageAccountCredentialList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,17 +119,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.StorageAccountCredential": """Gets the properties of the specified storage account credential. @@ -144,28 +151,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -179,48 +176,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, storage_account_credential: "_models.StorageAccountCredential", - **kwargs + **kwargs: Any ) -> Optional["_models.StorageAccountCredential"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccountCredential"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(storage_account_credential, 'StorageAccountCredential') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_account_credential, 'StorageAccountCredential') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -236,15 +225,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, storage_account_credential: "_models.StorageAccountCredential", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.StorageAccountCredential"]: """Creates or updates the storage account credential. @@ -255,18 +247,24 @@ async def begin_create_or_update( :param resource_group_name: The resource group name. :type resource_group_name: str :param storage_account_credential: The storage account credential. - :type storage_account_credential: ~azure.mgmt.databoxedge.v2019_07_01.models.StorageAccountCredential + :type storage_account_credential: + ~azure.mgmt.databoxedge.v2019_07_01.models.StorageAccountCredential :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either StorageAccountCredential or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_07_01.models.StorageAccountCredential] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageAccountCredential or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_07_01.models.StorageAccountCredential] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredential"] lro_delay = kwargs.pop( 'polling_interval', @@ -279,28 +277,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, storage_account_credential=storage_account_credential, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccountCredential', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -312,6 +303,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore async def _delete_initial( @@ -319,35 +311,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -360,12 +342,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the storage account credential. @@ -377,15 +361,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -400,22 +386,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -427,4 +405,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_triggers_operations.py index f6e6ef43282e..f3b9b019cb0e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_triggers_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._triggers_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, expand: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.TriggerList"]: """Lists all the triggers configured in the device. @@ -61,7 +67,8 @@ def list_by_data_box_edge_device( :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TriggerList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.TriggerList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.TriggerList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TriggerList"] @@ -69,38 +76,35 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TriggerList', pipeline_response) + deserialized = self._deserialize("TriggerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,17 +122,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Trigger": """Get a specific trigger by name. @@ -148,28 +154,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,48 +179,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, trigger: "_models.Trigger", - **kwargs + **kwargs: Any ) -> Optional["_models.Trigger"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Trigger"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(trigger, 'Trigger') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(trigger, 'Trigger') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,15 +228,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, trigger: "_models.Trigger", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Trigger"]: """Creates or updates a trigger. @@ -262,15 +253,19 @@ async def begin_create_or_update( :type trigger: ~azure.mgmt.databoxedge.v2019_07_01.models.Trigger :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Trigger or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Trigger or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_07_01.models.Trigger] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Trigger"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,28 +278,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, trigger=trigger, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Trigger', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -316,6 +304,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore async def _delete_initial( @@ -323,35 +312,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,12 +343,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the trigger on the gateway device. @@ -381,15 +362,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -404,22 +387,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -431,4 +406,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_users_operations.py index e1ee77cc8705..a12fdc27edd0 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_users_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._users_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.UserList"]: """Gets all the users registered on a Data Box Edge/Data Box Gateway device. @@ -57,7 +63,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.UserList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.UserList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UserList"] @@ -65,36 +72,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('UserList', pipeline_response) + deserialized = self._deserialize("UserList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,17 +116,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.User": """Gets the properties of the specified user. @@ -142,28 +148,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,48 +173,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, user: "_models.User", - **kwargs + **kwargs: Any ) -> Optional["_models.User"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.User"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(user, 'User') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(user, 'User') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -234,15 +222,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, user: "_models.User", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.User"]: """Creates a new user or updates an existing user's information on a Data Box Edge/Data Box Gateway device. @@ -257,15 +248,18 @@ async def begin_create_or_update( :type user: ~azure.mgmt.databoxedge.v2019_07_01.models.User :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either User or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_07_01.models.User] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.User"] lro_delay = kwargs.pop( 'polling_interval', @@ -278,28 +272,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, user=user, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('User', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -311,6 +298,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore async def _delete_initial( @@ -318,35 +306,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -359,12 +337,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the user on a databox edge/gateway device. @@ -376,15 +356,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -399,22 +381,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -426,4 +400,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/models/__init__.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/models/__init__.py index 737f7eda04f1..75365d9dd78a 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/models/__init__.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/models/__init__.py @@ -6,140 +6,73 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ARMBaseModel - from ._models_py3 import Address - from ._models_py3 import Alert - from ._models_py3 import AlertErrorDetails - from ._models_py3 import AlertList - from ._models_py3 import AsymmetricEncryptedSecret - from ._models_py3 import Authentication - from ._models_py3 import AzureContainerInfo - from ._models_py3 import BandwidthSchedule - from ._models_py3 import BandwidthSchedulesList - from ._models_py3 import ClientAccessRight - from ._models_py3 import CloudErrorBody - from ._models_py3 import ContactDetails - from ._models_py3 import DataBoxEdgeDevice - from ._models_py3 import DataBoxEdgeDeviceExtendedInfo - from ._models_py3 import DataBoxEdgeDeviceList - from ._models_py3 import DataBoxEdgeDevicePatch - from ._models_py3 import FileEventTrigger - from ._models_py3 import FileSourceInfo - from ._models_py3 import IoTDeviceInfo - from ._models_py3 import IoTRole - from ._models_py3 import Ipv4Config - from ._models_py3 import Ipv6Config - from ._models_py3 import Job - from ._models_py3 import JobErrorDetails - from ._models_py3 import JobErrorItem - from ._models_py3 import MetricDimensionV1 - from ._models_py3 import MetricSpecificationV1 - from ._models_py3 import MountPointMap - from ._models_py3 import NetworkAdapter - from ._models_py3 import NetworkAdapterPosition - from ._models_py3 import NetworkSettings - from ._models_py3 import Node - from ._models_py3 import NodeList - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationsList - from ._models_py3 import Order - from ._models_py3 import OrderList - from ._models_py3 import OrderStatus - from ._models_py3 import PeriodicTimerEventTrigger - from ._models_py3 import PeriodicTimerSourceInfo - from ._models_py3 import RefreshDetails - from ._models_py3 import Role - from ._models_py3 import RoleList - from ._models_py3 import RoleSinkInfo - from ._models_py3 import SecuritySettings - from ._models_py3 import ServiceSpecification - from ._models_py3 import Share - from ._models_py3 import ShareAccessRight - from ._models_py3 import ShareList - from ._models_py3 import Sku - from ._models_py3 import StorageAccountCredential - from ._models_py3 import StorageAccountCredentialList - from ._models_py3 import SymmetricKey - from ._models_py3 import TrackingInfo - from ._models_py3 import Trigger - from ._models_py3 import TriggerList - from ._models_py3 import UpdateDownloadProgress - from ._models_py3 import UpdateInstallProgress - from ._models_py3 import UpdateSummary - from ._models_py3 import UploadCertificateRequest - from ._models_py3 import UploadCertificateResponse - from ._models_py3 import User - from ._models_py3 import UserAccessRight - from ._models_py3 import UserList -except (SyntaxError, ImportError): - from ._models import ARMBaseModel # type: ignore - from ._models import Address # type: ignore - from ._models import Alert # type: ignore - from ._models import AlertErrorDetails # type: ignore - from ._models import AlertList # type: ignore - from ._models import AsymmetricEncryptedSecret # type: ignore - from ._models import Authentication # type: ignore - from ._models import AzureContainerInfo # type: ignore - from ._models import BandwidthSchedule # type: ignore - from ._models import BandwidthSchedulesList # type: ignore - from ._models import ClientAccessRight # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import ContactDetails # type: ignore - from ._models import DataBoxEdgeDevice # type: ignore - from ._models import DataBoxEdgeDeviceExtendedInfo # type: ignore - from ._models import DataBoxEdgeDeviceList # type: ignore - from ._models import DataBoxEdgeDevicePatch # type: ignore - from ._models import FileEventTrigger # type: ignore - from ._models import FileSourceInfo # type: ignore - from ._models import IoTDeviceInfo # type: ignore - from ._models import IoTRole # type: ignore - from ._models import Ipv4Config # type: ignore - from ._models import Ipv6Config # type: ignore - from ._models import Job # type: ignore - from ._models import JobErrorDetails # type: ignore - from ._models import JobErrorItem # type: ignore - from ._models import MetricDimensionV1 # type: ignore - from ._models import MetricSpecificationV1 # type: ignore - from ._models import MountPointMap # type: ignore - from ._models import NetworkAdapter # type: ignore - from ._models import NetworkAdapterPosition # type: ignore - from ._models import NetworkSettings # type: ignore - from ._models import Node # type: ignore - from ._models import NodeList # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationsList # type: ignore - from ._models import Order # type: ignore - from ._models import OrderList # type: ignore - from ._models import OrderStatus # type: ignore - from ._models import PeriodicTimerEventTrigger # type: ignore - from ._models import PeriodicTimerSourceInfo # type: ignore - from ._models import RefreshDetails # type: ignore - from ._models import Role # type: ignore - from ._models import RoleList # type: ignore - from ._models import RoleSinkInfo # type: ignore - from ._models import SecuritySettings # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Share # type: ignore - from ._models import ShareAccessRight # type: ignore - from ._models import ShareList # type: ignore - from ._models import Sku # type: ignore - from ._models import StorageAccountCredential # type: ignore - from ._models import StorageAccountCredentialList # type: ignore - from ._models import SymmetricKey # type: ignore - from ._models import TrackingInfo # type: ignore - from ._models import Trigger # type: ignore - from ._models import TriggerList # type: ignore - from ._models import UpdateDownloadProgress # type: ignore - from ._models import UpdateInstallProgress # type: ignore - from ._models import UpdateSummary # type: ignore - from ._models import UploadCertificateRequest # type: ignore - from ._models import UploadCertificateResponse # type: ignore - from ._models import User # type: ignore - from ._models import UserAccessRight # type: ignore - from ._models import UserList # type: ignore +from ._models_py3 import ARMBaseModel +from ._models_py3 import Address +from ._models_py3 import Alert +from ._models_py3 import AlertErrorDetails +from ._models_py3 import AlertList +from ._models_py3 import AsymmetricEncryptedSecret +from ._models_py3 import Authentication +from ._models_py3 import AzureContainerInfo +from ._models_py3 import BandwidthSchedule +from ._models_py3 import BandwidthSchedulesList +from ._models_py3 import ClientAccessRight +from ._models_py3 import CloudErrorBody +from ._models_py3 import ContactDetails +from ._models_py3 import DataBoxEdgeDevice +from ._models_py3 import DataBoxEdgeDeviceExtendedInfo +from ._models_py3 import DataBoxEdgeDeviceList +from ._models_py3 import DataBoxEdgeDevicePatch +from ._models_py3 import FileEventTrigger +from ._models_py3 import FileSourceInfo +from ._models_py3 import IoTDeviceInfo +from ._models_py3 import IoTRole +from ._models_py3 import Ipv4Config +from ._models_py3 import Ipv6Config +from ._models_py3 import Job +from ._models_py3 import JobErrorDetails +from ._models_py3 import JobErrorItem +from ._models_py3 import MetricDimensionV1 +from ._models_py3 import MetricSpecificationV1 +from ._models_py3 import MountPointMap +from ._models_py3 import NetworkAdapter +from ._models_py3 import NetworkAdapterPosition +from ._models_py3 import NetworkSettings +from ._models_py3 import Node +from ._models_py3 import NodeList +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationsList +from ._models_py3 import Order +from ._models_py3 import OrderList +from ._models_py3 import OrderStatus +from ._models_py3 import PeriodicTimerEventTrigger +from ._models_py3 import PeriodicTimerSourceInfo +from ._models_py3 import RefreshDetails +from ._models_py3 import Role +from ._models_py3 import RoleList +from ._models_py3 import RoleSinkInfo +from ._models_py3 import SecuritySettings +from ._models_py3 import ServiceSpecification +from ._models_py3 import Share +from ._models_py3 import ShareAccessRight +from ._models_py3 import ShareList +from ._models_py3 import Sku +from ._models_py3 import StorageAccountCredential +from ._models_py3 import StorageAccountCredentialList +from ._models_py3 import SymmetricKey +from ._models_py3 import TrackingInfo +from ._models_py3 import Trigger +from ._models_py3 import TriggerList +from ._models_py3 import UpdateDownloadProgress +from ._models_py3 import UpdateInstallProgress +from ._models_py3 import UpdateSummary +from ._models_py3 import UploadCertificateRequest +from ._models_py3 import UploadCertificateResponse +from ._models_py3 import User +from ._models_py3 import UserAccessRight +from ._models_py3 import UserList + from ._data_box_edge_management_client_enums import ( AccountType, diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/models/_data_box_edge_management_client_enums.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/models/_data_box_edge_management_client_enums.py index 6093033a5f34..ec9c84e7f470 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/models/_data_box_edge_management_client_enums.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/models/_data_box_edge_management_client_enums.py @@ -6,34 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccountType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of storage accessed on the storage account. """ GENERAL_PURPOSE_STORAGE = "GeneralPurposeStorage" BLOB_STORAGE = "BlobStorage" -class AlertSeverity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AlertSeverity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Severity of the alert. """ @@ -41,14 +26,14 @@ class AlertSeverity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" CRITICAL = "Critical" -class AuthenticationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AuthenticationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The authentication type. """ INVALID = "Invalid" AZURE_ACTIVE_DIRECTORY = "AzureActiveDirectory" -class AzureContainerDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AzureContainerDataFormat(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Storage format used for the file represented by the share. """ @@ -56,7 +41,7 @@ class AzureContainerDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu PAGE_BLOB = "PageBlob" AZURE_FILE = "AzureFile" -class ClientPermissionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ClientPermissionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of access to be allowed for the client. """ @@ -64,7 +49,7 @@ class ClientPermissionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ_ONLY = "ReadOnly" READ_WRITE = "ReadWrite" -class DataBoxEdgeDeviceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DataBoxEdgeDeviceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the Data Box Edge/Gateway device. """ @@ -76,14 +61,14 @@ class DataBoxEdgeDeviceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum PARTIALLY_DISCONNECTED = "PartiallyDisconnected" MAINTENANCE = "Maintenance" -class DataPolicy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DataPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Data policy of the share. """ CLOUD = "Cloud" LOCAL = "Local" -class DayOfWeek(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DayOfWeek(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SUNDAY = "Sunday" MONDAY = "Monday" @@ -93,13 +78,13 @@ class DayOfWeek(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FRIDAY = "Friday" SATURDAY = "Saturday" -class DeviceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeviceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the Data Box Edge/Gateway device. """ DATA_BOX_EDGE_DEVICE = "DataBoxEdgeDevice" -class DownloadPhase(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DownloadPhase(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The download phase. """ @@ -108,7 +93,7 @@ class DownloadPhase(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DOWNLOADING = "Downloading" VERIFYING = "Verifying" -class EncryptionAlgorithm(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The algorithm used to encrypt "Value". """ @@ -116,7 +101,7 @@ class EncryptionAlgorithm(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AES256 = "AES256" RSAES_PKCS1_V1_5 = "RSAES_PKCS1_v_1_5" -class InstallRebootBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InstallRebootBehavior(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates if updates are available and at least one of the updates needs a reboot. """ @@ -124,7 +109,7 @@ class InstallRebootBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) REQUIRES_REBOOT = "RequiresReboot" REQUEST_REBOOT = "RequestReboot" -class JobStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JobStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current status of the job. """ @@ -136,7 +121,7 @@ class JobStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PAUSED = "Paused" SCHEDULED = "Scheduled" -class JobType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JobType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the job. """ @@ -146,7 +131,7 @@ class JobType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): INSTALL_UPDATES = "InstallUpdates" REFRESH_SHARE = "RefreshShare" -class MetricAggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricAggregationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Metric aggregation type. """ @@ -158,14 +143,14 @@ class MetricAggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) TOTAL = "Total" COUNT = "Count" -class MetricCategory(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricCategory(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Metric category. """ CAPACITY = "Capacity" TRANSACTION = "Transaction" -class MetricUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Metric units. """ @@ -178,35 +163,35 @@ class MetricUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BYTES_PER_SECOND = "BytesPerSecond" COUNT_PER_SECOND = "CountPerSecond" -class MonitoringStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MonitoringStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current monitoring status of the share. """ ENABLED = "Enabled" DISABLED = "Disabled" -class NetworkAdapterDHCPStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkAdapterDHCPStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Value indicating whether this adapter has DHCP enabled. """ DISABLED = "Disabled" ENABLED = "Enabled" -class NetworkAdapterRDMAStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkAdapterRDMAStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Value indicating whether this adapter is RDMA capable. """ INCAPABLE = "Incapable" CAPABLE = "Capable" -class NetworkAdapterStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkAdapterStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Value indicating whether this adapter is valid. """ INACTIVE = "Inactive" ACTIVE = "Active" -class NetworkGroup(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkGroup(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The network group. """ @@ -214,7 +199,7 @@ class NetworkGroup(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): NON_RDMA = "NonRDMA" RDMA = "RDMA" -class NodeStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NodeStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current status of the individual node """ @@ -224,7 +209,7 @@ class NodeStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): REBOOTING = "Rebooting" SHUTTING_DOWN = "ShuttingDown" -class OrderState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OrderState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the order as per the allowed status types. """ @@ -243,35 +228,35 @@ class OrderState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SHIPPED_BACK = "ShippedBack" COLLECTED_AT_MICROSOFT = "CollectedAtMicrosoft" -class PlatformType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PlatformType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Host OS supported by the IoT role. """ WINDOWS = "Windows" LINUX = "Linux" -class RoleStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RoleStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Role status. """ ENABLED = "Enabled" DISABLED = "Disabled" -class RoleTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RoleTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): IOT = "IOT" ASA = "ASA" FUNCTIONS = "Functions" COGNITIVE = "Cognitive" -class ShareAccessProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareAccessProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Access protocol to be used by the share. """ SMB = "SMB" NFS = "NFS" -class ShareAccessType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareAccessType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of access to be allowed on the share for this user. """ @@ -279,7 +264,7 @@ class ShareAccessType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ = "Read" CUSTOM = "Custom" -class ShareStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current status of the share. """ @@ -289,27 +274,27 @@ class ShareStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UPDATING = "Updating" NEEDS_ATTENTION = "NeedsAttention" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """SKU name. """ GATEWAY = "Gateway" EDGE = "Edge" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SKU tier. This is based on the SKU name. """ STANDARD = "Standard" -class SSLStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SSLStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Signifies whether SSL needs to be enabled or not. """ ENABLED = "Enabled" DISABLED = "Disabled" -class TimeGrain(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TimeGrain(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PT1_M = "PT1M" PT5_M = "PT5M" @@ -320,14 +305,14 @@ class TimeGrain(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PT12_H = "PT12H" PT1_D = "PT1D" -class TriggerEventType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TriggerEventType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Trigger Kind. """ FILE_EVENT = "FileEvent" PERIODIC_TIMER_EVENT = "PeriodicTimerEvent" -class UpdateOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpdateOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current update operation. """ @@ -336,7 +321,7 @@ class UpdateOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DOWNLOAD = "Download" INSTALL = "Install" -class UpdateOperationStage(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpdateOperationStage(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current stage of the update operation. """ diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/models/_models.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/models/_models.py deleted file mode 100644 index 9a3963db001b..000000000000 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/models/_models.py +++ /dev/null @@ -1,2861 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class Address(msrest.serialization.Model): - """The shipping address of the customer. - - All required parameters must be populated in order to send to Azure. - - :param address_line1: Required. The address line1. - :type address_line1: str - :param address_line2: The address line2. - :type address_line2: str - :param address_line3: The address line3. - :type address_line3: str - :param postal_code: Required. The postal code. - :type postal_code: str - :param city: Required. The city name. - :type city: str - :param state: Required. The state name. - :type state: str - :param country: Required. The country name. - :type country: str - """ - - _validation = { - 'address_line1': {'required': True}, - 'postal_code': {'required': True}, - 'city': {'required': True}, - 'state': {'required': True}, - 'country': {'required': True}, - } - - _attribute_map = { - 'address_line1': {'key': 'addressLine1', 'type': 'str'}, - 'address_line2': {'key': 'addressLine2', 'type': 'str'}, - 'address_line3': {'key': 'addressLine3', 'type': 'str'}, - 'postal_code': {'key': 'postalCode', 'type': 'str'}, - 'city': {'key': 'city', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'country': {'key': 'country', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Address, self).__init__(**kwargs) - self.address_line1 = kwargs['address_line1'] - self.address_line2 = kwargs.get('address_line2', None) - self.address_line3 = kwargs.get('address_line3', None) - self.postal_code = kwargs['postal_code'] - self.city = kwargs['city'] - self.state = kwargs['state'] - self.country = kwargs['country'] - - -class ARMBaseModel(msrest.serialization.Model): - """Represents the base class for all object models. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ARMBaseModel, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class Alert(ARMBaseModel): - """Alert on the data box edge/gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar title: Alert title. - :vartype title: str - :ivar alert_type: Alert type. - :vartype alert_type: str - :ivar appeared_at_date_time: UTC time when the alert appeared. - :vartype appeared_at_date_time: ~datetime.datetime - :ivar recommendation: Alert recommendation. - :vartype recommendation: str - :ivar severity: Severity of the alert. Possible values include: "Informational", "Warning", - "Critical". - :vartype severity: str or ~azure.mgmt.databoxedge.v2019_07_01.models.AlertSeverity - :ivar error_details: Error details of the alert. - :vartype error_details: ~azure.mgmt.databoxedge.v2019_07_01.models.AlertErrorDetails - :ivar detailed_information: Alert details. - :vartype detailed_information: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'title': {'readonly': True}, - 'alert_type': {'readonly': True}, - 'appeared_at_date_time': {'readonly': True}, - 'recommendation': {'readonly': True}, - 'severity': {'readonly': True}, - 'error_details': {'readonly': True}, - 'detailed_information': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'title': {'key': 'properties.title', 'type': 'str'}, - 'alert_type': {'key': 'properties.alertType', 'type': 'str'}, - 'appeared_at_date_time': {'key': 'properties.appearedAtDateTime', 'type': 'iso-8601'}, - 'recommendation': {'key': 'properties.recommendation', 'type': 'str'}, - 'severity': {'key': 'properties.severity', 'type': 'str'}, - 'error_details': {'key': 'properties.errorDetails', 'type': 'AlertErrorDetails'}, - 'detailed_information': {'key': 'properties.detailedInformation', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(Alert, self).__init__(**kwargs) - self.title = None - self.alert_type = None - self.appeared_at_date_time = None - self.recommendation = None - self.severity = None - self.error_details = None - self.detailed_information = None - - -class AlertErrorDetails(msrest.serialization.Model): - """Error details for the alert. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error_code: Error code. - :vartype error_code: str - :ivar error_message: Error Message. - :vartype error_message: str - :ivar occurrences: Number of occurrences. - :vartype occurrences: int - """ - - _validation = { - 'error_code': {'readonly': True}, - 'error_message': {'readonly': True}, - 'occurrences': {'readonly': True}, - } - - _attribute_map = { - 'error_code': {'key': 'errorCode', 'type': 'str'}, - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - 'occurrences': {'key': 'occurrences', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(AlertErrorDetails, self).__init__(**kwargs) - self.error_code = None - self.error_message = None - self.occurrences = None - - -class AlertList(msrest.serialization.Model): - """Collection of alerts. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The value. - :vartype value: list[~azure.mgmt.databoxedge.v2019_07_01.models.Alert] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Alert]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AlertList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class AsymmetricEncryptedSecret(msrest.serialization.Model): - """Represent the secrets intended for encryption with asymmetric key pair. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The value of the secret. - :type value: str - :param encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the - value is unencrypted, it will be null. - :type encryption_cert_thumbprint: str - :param encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values - include: "None", "AES256", "RSAES_PKCS1_v_1_5". - :type encryption_algorithm: str or - ~azure.mgmt.databoxedge.v2019_07_01.models.EncryptionAlgorithm - """ - - _validation = { - 'value': {'required': True}, - 'encryption_algorithm': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'encryption_cert_thumbprint': {'key': 'encryptionCertThumbprint', 'type': 'str'}, - 'encryption_algorithm': {'key': 'encryptionAlgorithm', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AsymmetricEncryptedSecret, self).__init__(**kwargs) - self.value = kwargs['value'] - self.encryption_cert_thumbprint = kwargs.get('encryption_cert_thumbprint', None) - self.encryption_algorithm = kwargs['encryption_algorithm'] - - -class Authentication(msrest.serialization.Model): - """Authentication mechanism for IoT devices. - - :param symmetric_key: Symmetric key for authentication. - :type symmetric_key: ~azure.mgmt.databoxedge.v2019_07_01.models.SymmetricKey - """ - - _attribute_map = { - 'symmetric_key': {'key': 'symmetricKey', 'type': 'SymmetricKey'}, - } - - def __init__( - self, - **kwargs - ): - super(Authentication, self).__init__(**kwargs) - self.symmetric_key = kwargs.get('symmetric_key', None) - - -class AzureContainerInfo(msrest.serialization.Model): - """Azure container mapping of the endpoint. - - All required parameters must be populated in order to send to Azure. - - :param storage_account_credential_id: Required. ID of the storage account credential used to - access storage. - :type storage_account_credential_id: str - :param container_name: Required. Container name (Based on the data format specified, this - represents the name of Azure Files/Page blob/Block blob). - :type container_name: str - :param data_format: Required. Storage format used for the file represented by the share. - Possible values include: "BlockBlob", "PageBlob", "AzureFile". - :type data_format: str or ~azure.mgmt.databoxedge.v2019_07_01.models.AzureContainerDataFormat - """ - - _validation = { - 'storage_account_credential_id': {'required': True}, - 'container_name': {'required': True}, - 'data_format': {'required': True}, - } - - _attribute_map = { - 'storage_account_credential_id': {'key': 'storageAccountCredentialId', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'data_format': {'key': 'dataFormat', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureContainerInfo, self).__init__(**kwargs) - self.storage_account_credential_id = kwargs['storage_account_credential_id'] - self.container_name = kwargs['container_name'] - self.data_format = kwargs['data_format'] - - -class BandwidthSchedule(ARMBaseModel): - """The bandwidth schedule details. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param start: Required. The start time of the schedule in UTC. - :type start: str - :param stop: Required. The stop time of the schedule in UTC. - :type stop: str - :param rate_in_mbps: Required. The bandwidth rate in Mbps. - :type rate_in_mbps: int - :param days: Required. The days of the week when this schedule is applicable. - :type days: list[str or ~azure.mgmt.databoxedge.v2019_07_01.models.DayOfWeek] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'start': {'required': True}, - 'stop': {'required': True}, - 'rate_in_mbps': {'required': True}, - 'days': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'start': {'key': 'properties.start', 'type': 'str'}, - 'stop': {'key': 'properties.stop', 'type': 'str'}, - 'rate_in_mbps': {'key': 'properties.rateInMbps', 'type': 'int'}, - 'days': {'key': 'properties.days', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(BandwidthSchedule, self).__init__(**kwargs) - self.start = kwargs['start'] - self.stop = kwargs['stop'] - self.rate_in_mbps = kwargs['rate_in_mbps'] - self.days = kwargs['days'] - - -class BandwidthSchedulesList(msrest.serialization.Model): - """The collection of bandwidth schedules. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of bandwidth schedules. - :vartype value: list[~azure.mgmt.databoxedge.v2019_07_01.models.BandwidthSchedule] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BandwidthSchedule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BandwidthSchedulesList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ClientAccessRight(msrest.serialization.Model): - """The mapping between a particular client IP and the type of access client has on the NFS share. - - All required parameters must be populated in order to send to Azure. - - :param client: Required. IP of the client. - :type client: str - :param access_permission: Required. Type of access to be allowed for the client. Possible - values include: "NoAccess", "ReadOnly", "ReadWrite". - :type access_permission: str or ~azure.mgmt.databoxedge.v2019_07_01.models.ClientPermissionType - """ - - _validation = { - 'client': {'required': True}, - 'access_permission': {'required': True}, - } - - _attribute_map = { - 'client': {'key': 'client', 'type': 'str'}, - 'access_permission': {'key': 'accessPermission', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClientAccessRight, self).__init__(**kwargs) - self.client = kwargs['client'] - self.access_permission = kwargs['access_permission'] - - -class CloudErrorBody(msrest.serialization.Model): - """An error response from the service. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.databoxedge.v2019_07_01.models.CloudErrorBody] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudErrorBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.details = kwargs.get('details', None) - - -class ContactDetails(msrest.serialization.Model): - """Contains all the contact details of the customer. - - All required parameters must be populated in order to send to Azure. - - :param contact_person: Required. The contact person name. - :type contact_person: str - :param company_name: Required. The name of the company. - :type company_name: str - :param phone: Required. The phone number. - :type phone: str - :param email_list: Required. The email list. - :type email_list: list[str] - """ - - _validation = { - 'contact_person': {'required': True}, - 'company_name': {'required': True}, - 'phone': {'required': True}, - 'email_list': {'required': True}, - } - - _attribute_map = { - 'contact_person': {'key': 'contactPerson', 'type': 'str'}, - 'company_name': {'key': 'companyName', 'type': 'str'}, - 'phone': {'key': 'phone', 'type': 'str'}, - 'email_list': {'key': 'emailList', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ContactDetails, self).__init__(**kwargs) - self.contact_person = kwargs['contact_person'] - self.company_name = kwargs['company_name'] - self.phone = kwargs['phone'] - self.email_list = kwargs['email_list'] - - -class DataBoxEdgeDevice(ARMBaseModel): - """The Data Box Edge/Gateway device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param location: Required. The location of the device. This is a supported and registered Azure - geographical region (for example, West US, East US, or Southeast Asia). The geographical region - of a device cannot be changed once it is created, but if an identical geographical region is - specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. The list of tags that describe the device. These tags can be used - to view and group this device (across resource groups). - :type tags: dict[str, str] - :param sku: The SKU type. - :type sku: ~azure.mgmt.databoxedge.v2019_07_01.models.Sku - :param etag: The etag for the devices. - :type etag: str - :param data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible - values include: "ReadyToSetup", "Online", "Offline", "NeedsAttention", "Disconnected", - "PartiallyDisconnected", "Maintenance". - :type data_box_edge_device_status: str or - ~azure.mgmt.databoxedge.v2019_07_01.models.DataBoxEdgeDeviceStatus - :ivar serial_number: The Serial Number of Data Box Edge/Gateway device. - :vartype serial_number: str - :param description: The Description of the Data Box Edge/Gateway device. - :type description: str - :param model_description: The description of the Data Box Edge/Gateway device model. - :type model_description: str - :ivar device_type: The type of the Data Box Edge/Gateway device. Possible values include: - "DataBoxEdgeDevice". - :vartype device_type: str or ~azure.mgmt.databoxedge.v2019_07_01.models.DeviceType - :param friendly_name: The Data Box Edge/Gateway device name. - :type friendly_name: str - :ivar culture: The Data Box Edge/Gateway device culture. - :vartype culture: str - :ivar device_model: The Data Box Edge/Gateway device model. - :vartype device_model: str - :ivar device_software_version: The Data Box Edge/Gateway device software version. - :vartype device_software_version: str - :ivar device_local_capacity: The Data Box Edge/Gateway device local capacity in MB. - :vartype device_local_capacity: long - :ivar time_zone: The Data Box Edge/Gateway device timezone. - :vartype time_zone: str - :ivar device_hcs_version: The device software version number of the device (eg: 1.2.18105.6). - :vartype device_hcs_version: str - :ivar configured_role_types: Type of compute roles configured. - :vartype configured_role_types: list[str or - ~azure.mgmt.databoxedge.v2019_07_01.models.RoleTypes] - :ivar node_count: The number of nodes in the cluster. - :vartype node_count: int - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'serial_number': {'readonly': True}, - 'device_type': {'readonly': True}, - 'culture': {'readonly': True}, - 'device_model': {'readonly': True}, - 'device_software_version': {'readonly': True}, - 'device_local_capacity': {'readonly': True}, - 'time_zone': {'readonly': True}, - 'device_hcs_version': {'readonly': True}, - 'configured_role_types': {'readonly': True}, - 'node_count': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'data_box_edge_device_status': {'key': 'properties.dataBoxEdgeDeviceStatus', 'type': 'str'}, - 'serial_number': {'key': 'properties.serialNumber', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'model_description': {'key': 'properties.modelDescription', 'type': 'str'}, - 'device_type': {'key': 'properties.deviceType', 'type': 'str'}, - 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, - 'culture': {'key': 'properties.culture', 'type': 'str'}, - 'device_model': {'key': 'properties.deviceModel', 'type': 'str'}, - 'device_software_version': {'key': 'properties.deviceSoftwareVersion', 'type': 'str'}, - 'device_local_capacity': {'key': 'properties.deviceLocalCapacity', 'type': 'long'}, - 'time_zone': {'key': 'properties.timeZone', 'type': 'str'}, - 'device_hcs_version': {'key': 'properties.deviceHcsVersion', 'type': 'str'}, - 'configured_role_types': {'key': 'properties.configuredRoleTypes', 'type': '[str]'}, - 'node_count': {'key': 'properties.nodeCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeDevice, self).__init__(**kwargs) - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.etag = kwargs.get('etag', None) - self.data_box_edge_device_status = kwargs.get('data_box_edge_device_status', None) - self.serial_number = None - self.description = kwargs.get('description', None) - self.model_description = kwargs.get('model_description', None) - self.device_type = None - self.friendly_name = kwargs.get('friendly_name', None) - self.culture = None - self.device_model = None - self.device_software_version = None - self.device_local_capacity = None - self.time_zone = None - self.device_hcs_version = None - self.configured_role_types = None - self.node_count = None - - -class DataBoxEdgeDeviceExtendedInfo(ARMBaseModel): - """The extended Info of the Data Box Edge/Gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param encryption_key_thumbprint: The digital signature of encrypted certificate. - :type encryption_key_thumbprint: str - :param encryption_key: The public part of the encryption certificate. Client uses this to - encrypt any secret. - :type encryption_key: str - :ivar resource_key: The Resource ID of the Resource. - :vartype resource_key: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'resource_key': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'encryption_key_thumbprint': {'key': 'properties.encryptionKeyThumbprint', 'type': 'str'}, - 'encryption_key': {'key': 'properties.encryptionKey', 'type': 'str'}, - 'resource_key': {'key': 'properties.resourceKey', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeDeviceExtendedInfo, self).__init__(**kwargs) - self.encryption_key_thumbprint = kwargs.get('encryption_key_thumbprint', None) - self.encryption_key = kwargs.get('encryption_key', None) - self.resource_key = None - - -class DataBoxEdgeDeviceList(msrest.serialization.Model): - """The collection of Data Box Edge/Gateway devices. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of Data Box Edge/Gateway devices. - :vartype value: list[~azure.mgmt.databoxedge.v2019_07_01.models.DataBoxEdgeDevice] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DataBoxEdgeDevice]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeDeviceList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class DataBoxEdgeDevicePatch(msrest.serialization.Model): - """The Data Box Edge/Gateway device patch. - - :param tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeDevicePatch, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class Trigger(ARMBaseModel): - """Trigger details. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: FileEventTrigger, PeriodicTimerEventTrigger. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: - "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2019_07_01.models.TriggerEventType - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - } - - _subtype_map = { - 'kind': {'FileEvent': 'FileEventTrigger', 'PeriodicTimerEvent': 'PeriodicTimerEventTrigger'} - } - - def __init__( - self, - **kwargs - ): - super(Trigger, self).__init__(**kwargs) - self.kind = 'Trigger' # type: str - - -class FileEventTrigger(Trigger): - """Trigger details. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: - "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2019_07_01.models.TriggerEventType - :param source_info: Required. File event source details. - :type source_info: ~azure.mgmt.databoxedge.v2019_07_01.models.FileSourceInfo - :param sink_info: Required. Role sink info. - :type sink_info: ~azure.mgmt.databoxedge.v2019_07_01.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against - its usage. For example, if a periodic timer trigger is intended for certain specific IoT - modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'source_info': {'required': True}, - 'sink_info': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'source_info': {'key': 'properties.sourceInfo', 'type': 'FileSourceInfo'}, - 'sink_info': {'key': 'properties.sinkInfo', 'type': 'RoleSinkInfo'}, - 'custom_context_tag': {'key': 'properties.customContextTag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FileEventTrigger, self).__init__(**kwargs) - self.kind = 'FileEvent' # type: str - self.source_info = kwargs['source_info'] - self.sink_info = kwargs['sink_info'] - self.custom_context_tag = kwargs.get('custom_context_tag', None) - - -class FileSourceInfo(msrest.serialization.Model): - """File source details. - - All required parameters must be populated in order to send to Azure. - - :param share_id: Required. File share ID. - :type share_id: str - """ - - _validation = { - 'share_id': {'required': True}, - } - - _attribute_map = { - 'share_id': {'key': 'shareId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FileSourceInfo, self).__init__(**kwargs) - self.share_id = kwargs['share_id'] - - -class IoTDeviceInfo(msrest.serialization.Model): - """Metadata of IoT device/IoT Edge device to be configured. - - All required parameters must be populated in order to send to Azure. - - :param device_id: Required. ID of the IoT device/edge device. - :type device_id: str - :param io_t_host_hub: Required. Host name for the IoT hub associated to the device. - :type io_t_host_hub: str - :param io_t_host_hub_id: Id of the IoT hub associated to the device. - :type io_t_host_hub_id: str - :param authentication: IoT device authentication info. - :type authentication: ~azure.mgmt.databoxedge.v2019_07_01.models.Authentication - """ - - _validation = { - 'device_id': {'required': True}, - 'io_t_host_hub': {'required': True}, - } - - _attribute_map = { - 'device_id': {'key': 'deviceId', 'type': 'str'}, - 'io_t_host_hub': {'key': 'ioTHostHub', 'type': 'str'}, - 'io_t_host_hub_id': {'key': 'ioTHostHubId', 'type': 'str'}, - 'authentication': {'key': 'authentication', 'type': 'Authentication'}, - } - - def __init__( - self, - **kwargs - ): - super(IoTDeviceInfo, self).__init__(**kwargs) - self.device_id = kwargs['device_id'] - self.io_t_host_hub = kwargs['io_t_host_hub'] - self.io_t_host_hub_id = kwargs.get('io_t_host_hub_id', None) - self.authentication = kwargs.get('authentication', None) - - -class Role(ARMBaseModel): - """Compute role. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: IoTRole. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", - "ASA", "Functions", "Cognitive". - :type kind: str or ~azure.mgmt.databoxedge.v2019_07_01.models.RoleTypes - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - } - - _subtype_map = { - 'kind': {'IOT': 'IoTRole'} - } - - def __init__( - self, - **kwargs - ): - super(Role, self).__init__(**kwargs) - self.kind = 'Role' # type: str - - -class IoTRole(Role): - """Compute role. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", - "ASA", "Functions", "Cognitive". - :type kind: str or ~azure.mgmt.databoxedge.v2019_07_01.models.RoleTypes - :param host_platform: Host OS supported by the IoT role. Possible values include: "Windows", - "Linux". - :type host_platform: str or ~azure.mgmt.databoxedge.v2019_07_01.models.PlatformType - :param io_t_device_details: IoT device metadata to which data box edge device needs to be - connected. - :type io_t_device_details: ~azure.mgmt.databoxedge.v2019_07_01.models.IoTDeviceInfo - :param io_t_edge_device_details: IoT edge device to which the IoT role needs to be configured. - :type io_t_edge_device_details: ~azure.mgmt.databoxedge.v2019_07_01.models.IoTDeviceInfo - :param share_mappings: Mount points of shares in role(s). - :type share_mappings: list[~azure.mgmt.databoxedge.v2019_07_01.models.MountPointMap] - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2019_07_01.models.RoleStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'host_platform': {'key': 'properties.hostPlatform', 'type': 'str'}, - 'io_t_device_details': {'key': 'properties.ioTDeviceDetails', 'type': 'IoTDeviceInfo'}, - 'io_t_edge_device_details': {'key': 'properties.ioTEdgeDeviceDetails', 'type': 'IoTDeviceInfo'}, - 'share_mappings': {'key': 'properties.shareMappings', 'type': '[MountPointMap]'}, - 'role_status': {'key': 'properties.roleStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IoTRole, self).__init__(**kwargs) - self.kind = 'IOT' # type: str - self.host_platform = kwargs.get('host_platform', None) - self.io_t_device_details = kwargs.get('io_t_device_details', None) - self.io_t_edge_device_details = kwargs.get('io_t_edge_device_details', None) - self.share_mappings = kwargs.get('share_mappings', None) - self.role_status = kwargs.get('role_status', None) - - -class Ipv4Config(msrest.serialization.Model): - """Details related to the IPv4 address configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar ip_address: The IPv4 address of the network adapter. - :vartype ip_address: str - :ivar subnet: The IPv4 subnet of the network adapter. - :vartype subnet: str - :ivar gateway: The IPv4 gateway of the network adapter. - :vartype gateway: str - """ - - _validation = { - 'ip_address': {'readonly': True}, - 'subnet': {'readonly': True}, - 'gateway': {'readonly': True}, - } - - _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'subnet': {'key': 'subnet', 'type': 'str'}, - 'gateway': {'key': 'gateway', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Ipv4Config, self).__init__(**kwargs) - self.ip_address = None - self.subnet = None - self.gateway = None - - -class Ipv6Config(msrest.serialization.Model): - """Details related to the IPv6 address configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar ip_address: The IPv6 address of the network adapter. - :vartype ip_address: str - :ivar prefix_length: The IPv6 prefix of the network adapter. - :vartype prefix_length: int - :ivar gateway: The IPv6 gateway of the network adapter. - :vartype gateway: str - """ - - _validation = { - 'ip_address': {'readonly': True}, - 'prefix_length': {'readonly': True}, - 'gateway': {'readonly': True}, - } - - _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'prefix_length': {'key': 'prefixLength', 'type': 'int'}, - 'gateway': {'key': 'gateway', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Ipv6Config, self).__init__(**kwargs) - self.ip_address = None - self.prefix_length = None - self.gateway = None - - -class Job(msrest.serialization.Model): - """A device job. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The name of the object. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar status: The current status of the job. Possible values include: "Invalid", "Running", - "Succeeded", "Failed", "Canceled", "Paused", "Scheduled". - :vartype status: str or ~azure.mgmt.databoxedge.v2019_07_01.models.JobStatus - :ivar start_time: The UTC date and time at which the job started. - :vartype start_time: ~datetime.datetime - :ivar end_time: The UTC date and time at which the job completed. - :vartype end_time: ~datetime.datetime - :ivar percent_complete: The percentage of the job that is complete. - :vartype percent_complete: int - :ivar error: The error details. - :vartype error: ~azure.mgmt.databoxedge.v2019_07_01.models.JobErrorDetails - :ivar job_type: The type of the job. Possible values include: "Invalid", "ScanForUpdates", - "DownloadUpdates", "InstallUpdates", "RefreshShare". - :vartype job_type: str or ~azure.mgmt.databoxedge.v2019_07_01.models.JobType - :ivar current_stage: Current stage of the update operation. Possible values include: "Unknown", - "Initial", "ScanStarted", "ScanComplete", "ScanFailed", "DownloadStarted", "DownloadComplete", - "DownloadFailed", "InstallStarted", "InstallComplete", "InstallFailed", "RebootInitiated", - "Success", "Failure", "RescanStarted", "RescanComplete", "RescanFailed". - :vartype current_stage: str or ~azure.mgmt.databoxedge.v2019_07_01.models.UpdateOperationStage - :ivar download_progress: The download progress. - :vartype download_progress: ~azure.mgmt.databoxedge.v2019_07_01.models.UpdateDownloadProgress - :ivar install_progress: The install progress. - :vartype install_progress: ~azure.mgmt.databoxedge.v2019_07_01.models.UpdateInstallProgress - :ivar total_refresh_errors: Total number of errors encountered during the refresh process. - :vartype total_refresh_errors: int - :ivar error_manifest_file: Local share/remote container relative path to the error manifest - file of the refresh. - :vartype error_manifest_file: str - :ivar share_id: ARM ID of the share that was refreshed. - :vartype share_id: str - :param folder: If only subfolders need to be refreshed, then the subfolder path inside the - share. (The path is empty if there are no subfolders.). - :type folder: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'status': {'readonly': True}, - 'start_time': {'readonly': True}, - 'end_time': {'readonly': True}, - 'percent_complete': {'readonly': True}, - 'error': {'readonly': True}, - 'job_type': {'readonly': True}, - 'current_stage': {'readonly': True}, - 'download_progress': {'readonly': True}, - 'install_progress': {'readonly': True}, - 'total_refresh_errors': {'readonly': True}, - 'error_manifest_file': {'readonly': True}, - 'share_id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'percent_complete': {'key': 'percentComplete', 'type': 'int'}, - 'error': {'key': 'error', 'type': 'JobErrorDetails'}, - 'job_type': {'key': 'properties.jobType', 'type': 'str'}, - 'current_stage': {'key': 'properties.currentStage', 'type': 'str'}, - 'download_progress': {'key': 'properties.downloadProgress', 'type': 'UpdateDownloadProgress'}, - 'install_progress': {'key': 'properties.installProgress', 'type': 'UpdateInstallProgress'}, - 'total_refresh_errors': {'key': 'properties.totalRefreshErrors', 'type': 'int'}, - 'error_manifest_file': {'key': 'properties.errorManifestFile', 'type': 'str'}, - 'share_id': {'key': 'properties.shareId', 'type': 'str'}, - 'folder': {'key': 'properties.folder', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Job, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.status = None - self.start_time = None - self.end_time = None - self.percent_complete = None - self.error = None - self.job_type = None - self.current_stage = None - self.download_progress = None - self.install_progress = None - self.total_refresh_errors = None - self.error_manifest_file = None - self.share_id = None - self.folder = kwargs.get('folder', None) - - -class JobErrorDetails(msrest.serialization.Model): - """The job error information containing the list of job errors. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error_details: The error details. - :vartype error_details: list[~azure.mgmt.databoxedge.v2019_07_01.models.JobErrorItem] - :ivar code: The code intended for programmatic access. - :vartype code: str - :ivar message: The message that describes the error in detail. - :vartype message: str - """ - - _validation = { - 'error_details': {'readonly': True}, - 'code': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'error_details': {'key': 'errorDetails', 'type': '[JobErrorItem]'}, - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(JobErrorDetails, self).__init__(**kwargs) - self.error_details = None - self.code = None - self.message = None - - -class JobErrorItem(msrest.serialization.Model): - """The job error items. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar recommendations: The recommended actions. - :vartype recommendations: list[str] - :ivar code: The code intended for programmatic access. - :vartype code: str - :ivar message: The message that describes the error in detail. - :vartype message: str - """ - - _validation = { - 'recommendations': {'readonly': True}, - 'code': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'recommendations': {'key': 'recommendations', 'type': '[str]'}, - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(JobErrorItem, self).__init__(**kwargs) - self.recommendations = None - self.code = None - self.message = None - - -class MetricDimensionV1(msrest.serialization.Model): - """Metric Dimension v1. - - :param name: Name of the metrics dimension. - :type name: str - :param display_name: Display name of the metrics dimension. - :type display_name: str - :param to_be_exported_for_shoebox: To be exported to shoe box. - :type to_be_exported_for_shoebox: bool - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricDimensionV1, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) - - -class MetricSpecificationV1(msrest.serialization.Model): - """Metric specification version 1. - - :param name: Name of the metric. - :type name: str - :param display_name: Display name of the metric. - :type display_name: str - :param display_description: Description of the metric to be displayed. - :type display_description: str - :param unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", - "Seconds", "Milliseconds", "Bytes", "BytesPerSecond", "CountPerSecond". - :type unit: str or ~azure.mgmt.databoxedge.v2019_07_01.models.MetricUnit - :param aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", - "None", "Average", "Minimum", "Maximum", "Total", "Count". - :type aggregation_type: str or ~azure.mgmt.databoxedge.v2019_07_01.models.MetricAggregationType - :param dimensions: Metric dimensions, other than default dimension which is resource. - :type dimensions: list[~azure.mgmt.databoxedge.v2019_07_01.models.MetricDimensionV1] - :param fill_gap_with_zero: Set true to fill the gaps with zero. - :type fill_gap_with_zero: bool - :param category: Metric category. Possible values include: "Capacity", "Transaction". - :type category: str or ~azure.mgmt.databoxedge.v2019_07_01.models.MetricCategory - :param resource_id_dimension_name_override: Resource name override. - :type resource_id_dimension_name_override: str - :param supported_time_grain_types: Support granularity of metrics. - :type supported_time_grain_types: list[str or - ~azure.mgmt.databoxedge.v2019_07_01.models.TimeGrain] - :param supported_aggregation_types: Support metric aggregation type. - :type supported_aggregation_types: list[str or - ~azure.mgmt.databoxedge.v2019_07_01.models.MetricAggregationType] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[MetricDimensionV1]'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'category': {'key': 'category', 'type': 'str'}, - 'resource_id_dimension_name_override': {'key': 'resourceIdDimensionNameOverride', 'type': 'str'}, - 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, - 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricSpecificationV1, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.dimensions = kwargs.get('dimensions', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.category = kwargs.get('category', None) - self.resource_id_dimension_name_override = kwargs.get('resource_id_dimension_name_override', None) - self.supported_time_grain_types = kwargs.get('supported_time_grain_types', None) - self.supported_aggregation_types = kwargs.get('supported_aggregation_types', None) - - -class MountPointMap(msrest.serialization.Model): - """The share mount point. - - 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 share_id: Required. ID of the share mounted to the role VM. - :type share_id: str - :ivar role_id: ID of the role to which share is mounted. - :vartype role_id: str - :ivar mount_point: Mount point for the share. - :vartype mount_point: str - :ivar role_type: Role type. Possible values include: "IOT", "ASA", "Functions", "Cognitive". - :vartype role_type: str or ~azure.mgmt.databoxedge.v2019_07_01.models.RoleTypes - """ - - _validation = { - 'share_id': {'required': True}, - 'role_id': {'readonly': True}, - 'mount_point': {'readonly': True}, - 'role_type': {'readonly': True}, - } - - _attribute_map = { - 'share_id': {'key': 'shareId', 'type': 'str'}, - 'role_id': {'key': 'roleId', 'type': 'str'}, - 'mount_point': {'key': 'mountPoint', 'type': 'str'}, - 'role_type': {'key': 'roleType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MountPointMap, self).__init__(**kwargs) - self.share_id = kwargs['share_id'] - self.role_id = None - self.mount_point = None - self.role_type = None - - -class NetworkAdapter(msrest.serialization.Model): - """Represents the networkAdapter on a device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar adapter_id: Instance ID of network adapter. - :vartype adapter_id: str - :ivar adapter_position: Hardware position of network adapter. - :vartype adapter_position: ~azure.mgmt.databoxedge.v2019_07_01.models.NetworkAdapterPosition - :ivar index: Logical index of the adapter. - :vartype index: int - :ivar node_id: Node ID of the network adapter. - :vartype node_id: str - :ivar network_adapter_name: Network adapter name. - :vartype network_adapter_name: str - :ivar label: Hardware label for the adapter. - :vartype label: str - :ivar mac_address: MAC address. - :vartype mac_address: str - :ivar link_speed: Link speed. - :vartype link_speed: long - :ivar status: Value indicating whether this adapter is valid. Possible values include: - "Inactive", "Active". - :vartype status: str or ~azure.mgmt.databoxedge.v2019_07_01.models.NetworkAdapterStatus - :param rdma_status: Value indicating whether this adapter is RDMA capable. Possible values - include: "Incapable", "Capable". - :type rdma_status: str or ~azure.mgmt.databoxedge.v2019_07_01.models.NetworkAdapterRDMAStatus - :param dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values - include: "Disabled", "Enabled". - :type dhcp_status: str or ~azure.mgmt.databoxedge.v2019_07_01.models.NetworkAdapterDHCPStatus - :ivar ipv4_configuration: The IPv4 configuration of the network adapter. - :vartype ipv4_configuration: ~azure.mgmt.databoxedge.v2019_07_01.models.Ipv4Config - :ivar ipv6_configuration: The IPv6 configuration of the network adapter. - :vartype ipv6_configuration: ~azure.mgmt.databoxedge.v2019_07_01.models.Ipv6Config - :ivar ipv6_link_local_address: The IPv6 local address. - :vartype ipv6_link_local_address: str - :ivar dns_servers: The list of DNS Servers of the device. - :vartype dns_servers: list[str] - """ - - _validation = { - 'adapter_id': {'readonly': True}, - 'adapter_position': {'readonly': True}, - 'index': {'readonly': True}, - 'node_id': {'readonly': True}, - 'network_adapter_name': {'readonly': True}, - 'label': {'readonly': True}, - 'mac_address': {'readonly': True}, - 'link_speed': {'readonly': True}, - 'status': {'readonly': True}, - 'ipv4_configuration': {'readonly': True}, - 'ipv6_configuration': {'readonly': True}, - 'ipv6_link_local_address': {'readonly': True}, - 'dns_servers': {'readonly': True}, - } - - _attribute_map = { - 'adapter_id': {'key': 'adapterId', 'type': 'str'}, - 'adapter_position': {'key': 'adapterPosition', 'type': 'NetworkAdapterPosition'}, - 'index': {'key': 'index', 'type': 'int'}, - 'node_id': {'key': 'nodeId', 'type': 'str'}, - 'network_adapter_name': {'key': 'networkAdapterName', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'mac_address': {'key': 'macAddress', 'type': 'str'}, - 'link_speed': {'key': 'linkSpeed', 'type': 'long'}, - 'status': {'key': 'status', 'type': 'str'}, - 'rdma_status': {'key': 'rdmaStatus', 'type': 'str'}, - 'dhcp_status': {'key': 'dhcpStatus', 'type': 'str'}, - 'ipv4_configuration': {'key': 'ipv4Configuration', 'type': 'Ipv4Config'}, - 'ipv6_configuration': {'key': 'ipv6Configuration', 'type': 'Ipv6Config'}, - 'ipv6_link_local_address': {'key': 'ipv6LinkLocalAddress', 'type': 'str'}, - 'dns_servers': {'key': 'dnsServers', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkAdapter, self).__init__(**kwargs) - self.adapter_id = None - self.adapter_position = None - self.index = None - self.node_id = None - self.network_adapter_name = None - self.label = None - self.mac_address = None - self.link_speed = None - self.status = None - self.rdma_status = kwargs.get('rdma_status', None) - self.dhcp_status = kwargs.get('dhcp_status', None) - self.ipv4_configuration = None - self.ipv6_configuration = None - self.ipv6_link_local_address = None - self.dns_servers = None - - -class NetworkAdapterPosition(msrest.serialization.Model): - """The network adapter position. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar network_group: The network group. Possible values include: "None", "NonRDMA", "RDMA". - :vartype network_group: str or ~azure.mgmt.databoxedge.v2019_07_01.models.NetworkGroup - :ivar port: The port. - :vartype port: int - """ - - _validation = { - 'network_group': {'readonly': True}, - 'port': {'readonly': True}, - } - - _attribute_map = { - 'network_group': {'key': 'networkGroup', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkAdapterPosition, self).__init__(**kwargs) - self.network_group = None - self.port = None - - -class NetworkSettings(ARMBaseModel): - """The network settings of a device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar network_adapters: The network adapter list on the device. - :vartype network_adapters: list[~azure.mgmt.databoxedge.v2019_07_01.models.NetworkAdapter] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'network_adapters': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'network_adapters': {'key': 'properties.networkAdapters', 'type': '[NetworkAdapter]'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkSettings, self).__init__(**kwargs) - self.network_adapters = None - - -class Node(ARMBaseModel): - """Represents a single node in a Data box Edge/Gateway device -Gateway devices, standalone Edge devices and a single node cluster Edge device will all have 1 node -Multi-node Edge devices will have more than 1 nodes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar node_status: The current status of the individual node. Possible values include: - "Unknown", "Up", "Down", "Rebooting", "ShuttingDown". - :vartype node_status: str or ~azure.mgmt.databoxedge.v2019_07_01.models.NodeStatus - :ivar node_chassis_serial_number: Serial number of the Chassis. - :vartype node_chassis_serial_number: str - :ivar node_serial_number: Serial number of the individual node. - :vartype node_serial_number: str - :ivar node_display_name: Display Name of the individual node. - :vartype node_display_name: str - :ivar node_friendly_software_version: Friendly software version name that is currently - installed on the node. - :vartype node_friendly_software_version: str - :ivar node_hcs_version: HCS version that is currently installed on the node. - :vartype node_hcs_version: str - :ivar node_instance_id: Guid instance id of the node. - :vartype node_instance_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'node_status': {'readonly': True}, - 'node_chassis_serial_number': {'readonly': True}, - 'node_serial_number': {'readonly': True}, - 'node_display_name': {'readonly': True}, - 'node_friendly_software_version': {'readonly': True}, - 'node_hcs_version': {'readonly': True}, - 'node_instance_id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'node_status': {'key': 'properties.nodeStatus', 'type': 'str'}, - 'node_chassis_serial_number': {'key': 'properties.nodeChassisSerialNumber', 'type': 'str'}, - 'node_serial_number': {'key': 'properties.nodeSerialNumber', 'type': 'str'}, - 'node_display_name': {'key': 'properties.nodeDisplayName', 'type': 'str'}, - 'node_friendly_software_version': {'key': 'properties.nodeFriendlySoftwareVersion', 'type': 'str'}, - 'node_hcs_version': {'key': 'properties.nodeHcsVersion', 'type': 'str'}, - 'node_instance_id': {'key': 'properties.nodeInstanceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Node, self).__init__(**kwargs) - self.node_status = None - self.node_chassis_serial_number = None - self.node_serial_number = None - self.node_display_name = None - self.node_friendly_software_version = None - self.node_hcs_version = None - self.node_instance_id = None - - -class NodeList(msrest.serialization.Model): - """Collection of Nodes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of Nodes. - :vartype value: list[~azure.mgmt.databoxedge.v2019_07_01.models.Node] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Node]'}, - } - - def __init__( - self, - **kwargs - ): - super(NodeList, self).__init__(**kwargs) - self.value = None - - -class Operation(msrest.serialization.Model): - """Operations. - - :param name: Name of the operation. - :type name: str - :param display: Properties displayed for the operation. - :type display: ~azure.mgmt.databoxedge.v2019_07_01.models.OperationDisplay - :param origin: Origin of the operation. - :type origin: str - :param service_specification: Service specification. - :type service_specification: ~azure.mgmt.databoxedge.v2019_07_01.models.ServiceSpecification - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplay(msrest.serialization.Model): - """Operation display properties. - - :param provider: Provider name. - :type provider: str - :param resource: The type of resource in which the operation is performed. - :type resource: str - :param operation: Operation to be performed on the resource. - :type operation: str - :param description: Description of the operation to be performed. - :type description: str - """ - - _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 - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationsList(msrest.serialization.Model): - """The list of operations used for the discovery of available provider operations. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The value. - :type value: list[~azure.mgmt.databoxedge.v2019_07_01.models.Operation] - :param next_link: Link to the next set of results. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationsList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class Order(ARMBaseModel): - """The order details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param contact_information: The contact details. - :type contact_information: ~azure.mgmt.databoxedge.v2019_07_01.models.ContactDetails - :param shipping_address: The shipping address. - :type shipping_address: ~azure.mgmt.databoxedge.v2019_07_01.models.Address - :param current_status: Current status of the order. - :type current_status: ~azure.mgmt.databoxedge.v2019_07_01.models.OrderStatus - :ivar order_history: List of status changes in the order. - :vartype order_history: list[~azure.mgmt.databoxedge.v2019_07_01.models.OrderStatus] - :ivar serial_number: Serial number of the device. - :vartype serial_number: str - :ivar delivery_tracking_info: Tracking information for the package delivered to the customer - whether it has an original or a replacement device. - :vartype delivery_tracking_info: list[~azure.mgmt.databoxedge.v2019_07_01.models.TrackingInfo] - :ivar return_tracking_info: Tracking information for the package returned from the customer - whether it has an original or a replacement device. - :vartype return_tracking_info: list[~azure.mgmt.databoxedge.v2019_07_01.models.TrackingInfo] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'order_history': {'readonly': True}, - 'serial_number': {'readonly': True}, - 'delivery_tracking_info': {'readonly': True}, - 'return_tracking_info': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'contact_information': {'key': 'properties.contactInformation', 'type': 'ContactDetails'}, - 'shipping_address': {'key': 'properties.shippingAddress', 'type': 'Address'}, - 'current_status': {'key': 'properties.currentStatus', 'type': 'OrderStatus'}, - 'order_history': {'key': 'properties.orderHistory', 'type': '[OrderStatus]'}, - 'serial_number': {'key': 'properties.serialNumber', 'type': 'str'}, - 'delivery_tracking_info': {'key': 'properties.deliveryTrackingInfo', 'type': '[TrackingInfo]'}, - 'return_tracking_info': {'key': 'properties.returnTrackingInfo', 'type': '[TrackingInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(Order, self).__init__(**kwargs) - self.contact_information = kwargs.get('contact_information', None) - self.shipping_address = kwargs.get('shipping_address', None) - self.current_status = kwargs.get('current_status', None) - self.order_history = None - self.serial_number = None - self.delivery_tracking_info = None - self.return_tracking_info = None - - -class OrderList(msrest.serialization.Model): - """List of order entities. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of orders. - :vartype value: list[~azure.mgmt.databoxedge.v2019_07_01.models.Order] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Order]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OrderList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class OrderStatus(msrest.serialization.Model): - """Represents a single status change. - - 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 status: Required. Status of the order as per the allowed status types. Possible values - include: "Untracked", "AwaitingFulfilment", "AwaitingPreparation", "AwaitingShipment", - "Shipped", "Arriving", "Delivered", "ReplacementRequested", "LostDevice", "Declined", - "ReturnInitiated", "AwaitingReturnShipment", "ShippedBack", "CollectedAtMicrosoft". - :type status: str or ~azure.mgmt.databoxedge.v2019_07_01.models.OrderState - :ivar update_date_time: Time of status update. - :vartype update_date_time: ~datetime.datetime - :param comments: Comments related to this status change. - :type comments: str - """ - - _validation = { - 'status': {'required': True}, - 'update_date_time': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'update_date_time': {'key': 'updateDateTime', 'type': 'iso-8601'}, - 'comments': {'key': 'comments', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OrderStatus, self).__init__(**kwargs) - self.status = kwargs['status'] - self.update_date_time = None - self.comments = kwargs.get('comments', None) - - -class PeriodicTimerEventTrigger(Trigger): - """Trigger details. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: - "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2019_07_01.models.TriggerEventType - :param source_info: Required. Periodic timer details. - :type source_info: ~azure.mgmt.databoxedge.v2019_07_01.models.PeriodicTimerSourceInfo - :param sink_info: Required. Role Sink information. - :type sink_info: ~azure.mgmt.databoxedge.v2019_07_01.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against - its usage. For example, if a periodic timer trigger is intended for certain specific IoT - modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'source_info': {'required': True}, - 'sink_info': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'source_info': {'key': 'properties.sourceInfo', 'type': 'PeriodicTimerSourceInfo'}, - 'sink_info': {'key': 'properties.sinkInfo', 'type': 'RoleSinkInfo'}, - 'custom_context_tag': {'key': 'properties.customContextTag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PeriodicTimerEventTrigger, self).__init__(**kwargs) - self.kind = 'PeriodicTimerEvent' # type: str - self.source_info = kwargs['source_info'] - self.sink_info = kwargs['sink_info'] - self.custom_context_tag = kwargs.get('custom_context_tag', None) - - -class PeriodicTimerSourceInfo(msrest.serialization.Model): - """Periodic timer event source. - - All required parameters must be populated in order to send to Azure. - - :param start_time: Required. The time of the day that results in a valid trigger. Schedule is - computed with reference to the time specified upto seconds. If timezone is not specified the - time will considered to be in device timezone. The value will always be returned as UTC time. - :type start_time: ~datetime.datetime - :param schedule: Required. Periodic frequency at which timer event needs to be raised. Supports - daily, hourly, minutes, and seconds. - :type schedule: str - :param topic: Topic where periodic events are published to IoT device. - :type topic: str - """ - - _validation = { - 'start_time': {'required': True}, - 'schedule': {'required': True}, - } - - _attribute_map = { - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'schedule': {'key': 'schedule', 'type': 'str'}, - 'topic': {'key': 'topic', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PeriodicTimerSourceInfo, self).__init__(**kwargs) - self.start_time = kwargs['start_time'] - self.schedule = kwargs['schedule'] - self.topic = kwargs.get('topic', None) - - -class RefreshDetails(msrest.serialization.Model): - """Fields for tracking refresh job on the share. - - :param in_progress_refresh_job_id: If a refresh share job is currently in progress on this - share, this field indicates the ARM resource ID of that job. The field is empty if no job is in - progress. - :type in_progress_refresh_job_id: str - :param last_completed_refresh_job_time_in_utc: Indicates the completed time for the last - refresh job on this particular share, if any.This could be a failed job or a successful job. - :type last_completed_refresh_job_time_in_utc: ~datetime.datetime - :param error_manifest_file: Indicates the relative path of the error xml for the last refresh - job on this particular share, if any. This could be a failed job or a successful job. - :type error_manifest_file: str - :param last_job: Indicates the id of the last refresh job on this particular share,if any. This - could be a failed job or a successful job. - :type last_job: str - """ - - _attribute_map = { - 'in_progress_refresh_job_id': {'key': 'inProgressRefreshJobId', 'type': 'str'}, - 'last_completed_refresh_job_time_in_utc': {'key': 'lastCompletedRefreshJobTimeInUTC', 'type': 'iso-8601'}, - 'error_manifest_file': {'key': 'errorManifestFile', 'type': 'str'}, - 'last_job': {'key': 'lastJob', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RefreshDetails, self).__init__(**kwargs) - self.in_progress_refresh_job_id = kwargs.get('in_progress_refresh_job_id', None) - self.last_completed_refresh_job_time_in_utc = kwargs.get('last_completed_refresh_job_time_in_utc', None) - self.error_manifest_file = kwargs.get('error_manifest_file', None) - self.last_job = kwargs.get('last_job', None) - - -class RoleList(msrest.serialization.Model): - """Collection of all the roles on the Data Box Edge device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The Value. - :vartype value: list[~azure.mgmt.databoxedge.v2019_07_01.models.Role] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Role]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RoleList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class RoleSinkInfo(msrest.serialization.Model): - """Compute role against which events will be raised. - - All required parameters must be populated in order to send to Azure. - - :param role_id: Required. Compute role ID. - :type role_id: str - """ - - _validation = { - 'role_id': {'required': True}, - } - - _attribute_map = { - 'role_id': {'key': 'roleId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RoleSinkInfo, self).__init__(**kwargs) - self.role_id = kwargs['role_id'] - - -class SecuritySettings(ARMBaseModel): - """The security settings of a device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param device_admin_password: Required. Device administrator password as an encrypted string - (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual - password should have at least 8 characters that are a combination of uppercase, lowercase, - numeric, and special characters. - :type device_admin_password: - ~azure.mgmt.databoxedge.v2019_07_01.models.AsymmetricEncryptedSecret - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'device_admin_password': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'device_admin_password': {'key': 'properties.deviceAdminPassword', 'type': 'AsymmetricEncryptedSecret'}, - } - - def __init__( - self, - **kwargs - ): - super(SecuritySettings, self).__init__(**kwargs) - self.device_admin_password = kwargs['device_admin_password'] - - -class ServiceSpecification(msrest.serialization.Model): - """Service specification. - - :param metric_specifications: Metric specification as defined by shoebox. - :type metric_specifications: - list[~azure.mgmt.databoxedge.v2019_07_01.models.MetricSpecificationV1] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecificationV1]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class Share(ARMBaseModel): - """Represents a share on the Data Box Edge/Gateway device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param description: Description for the share. - :type description: str - :param share_status: Required. Current status of the share. Possible values include: "Offline", - "Unknown", "OK", "Updating", "NeedsAttention". - :type share_status: str or ~azure.mgmt.databoxedge.v2019_07_01.models.ShareStatus - :param monitoring_status: Required. Current monitoring status of the share. Possible values - include: "Enabled", "Disabled". - :type monitoring_status: str or ~azure.mgmt.databoxedge.v2019_07_01.models.MonitoringStatus - :param azure_container_info: Azure container mapping for the share. - :type azure_container_info: ~azure.mgmt.databoxedge.v2019_07_01.models.AzureContainerInfo - :param access_protocol: Required. Access protocol to be used by the share. Possible values - include: "SMB", "NFS". - :type access_protocol: str or ~azure.mgmt.databoxedge.v2019_07_01.models.ShareAccessProtocol - :param user_access_rights: Mapping of users and corresponding access rights on the share - (required for SMB protocol). - :type user_access_rights: list[~azure.mgmt.databoxedge.v2019_07_01.models.UserAccessRight] - :param client_access_rights: List of IP addresses and corresponding access rights on the - share(required for NFS protocol). - :type client_access_rights: list[~azure.mgmt.databoxedge.v2019_07_01.models.ClientAccessRight] - :param refresh_details: Details of the refresh job on this share. - :type refresh_details: ~azure.mgmt.databoxedge.v2019_07_01.models.RefreshDetails - :ivar share_mappings: Share mount point to the role. - :vartype share_mappings: list[~azure.mgmt.databoxedge.v2019_07_01.models.MountPointMap] - :param data_policy: Data policy of the share. Possible values include: "Cloud", "Local". - :type data_policy: str or ~azure.mgmt.databoxedge.v2019_07_01.models.DataPolicy - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'share_status': {'required': True}, - 'monitoring_status': {'required': True}, - 'access_protocol': {'required': True}, - 'share_mappings': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'share_status': {'key': 'properties.shareStatus', 'type': 'str'}, - 'monitoring_status': {'key': 'properties.monitoringStatus', 'type': 'str'}, - 'azure_container_info': {'key': 'properties.azureContainerInfo', 'type': 'AzureContainerInfo'}, - 'access_protocol': {'key': 'properties.accessProtocol', 'type': 'str'}, - 'user_access_rights': {'key': 'properties.userAccessRights', 'type': '[UserAccessRight]'}, - 'client_access_rights': {'key': 'properties.clientAccessRights', 'type': '[ClientAccessRight]'}, - 'refresh_details': {'key': 'properties.refreshDetails', 'type': 'RefreshDetails'}, - 'share_mappings': {'key': 'properties.shareMappings', 'type': '[MountPointMap]'}, - 'data_policy': {'key': 'properties.dataPolicy', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Share, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.share_status = kwargs['share_status'] - self.monitoring_status = kwargs['monitoring_status'] - self.azure_container_info = kwargs.get('azure_container_info', None) - self.access_protocol = kwargs['access_protocol'] - self.user_access_rights = kwargs.get('user_access_rights', None) - self.client_access_rights = kwargs.get('client_access_rights', None) - self.refresh_details = kwargs.get('refresh_details', None) - self.share_mappings = None - self.data_policy = kwargs.get('data_policy', None) - - -class ShareAccessRight(msrest.serialization.Model): - """Specifies the mapping between this particular user and the type of access he has on shares on this device. - - All required parameters must be populated in order to send to Azure. - - :param share_id: Required. The share ID. - :type share_id: str - :param access_type: Required. Type of access to be allowed on the share for this user. Possible - values include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2019_07_01.models.ShareAccessType - """ - - _validation = { - 'share_id': {'required': True}, - 'access_type': {'required': True}, - } - - _attribute_map = { - 'share_id': {'key': 'shareId', 'type': 'str'}, - 'access_type': {'key': 'accessType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ShareAccessRight, self).__init__(**kwargs) - self.share_id = kwargs['share_id'] - self.access_type = kwargs['access_type'] - - -class ShareList(msrest.serialization.Model): - """Collection of all the shares on the Data Box Edge/Gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of shares. - :vartype value: list[~azure.mgmt.databoxedge.v2019_07_01.models.Share] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Share]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ShareList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class Sku(msrest.serialization.Model): - """The SKU type. - - :param name: SKU name. Possible values include: "Gateway", "Edge". - :type name: str or ~azure.mgmt.databoxedge.v2019_07_01.models.SkuName - :param tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard". - :type tier: str or ~azure.mgmt.databoxedge.v2019_07_01.models.SkuTier - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = kwargs.get('tier', None) - - -class StorageAccountCredential(ARMBaseModel): - """The storage account credential. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param alias: Required. Alias for the storage account. - :type alias: str - :param user_name: Username for the storage account. - :type user_name: str - :param account_key: Encrypted storage key. - :type account_key: ~azure.mgmt.databoxedge.v2019_07_01.models.AsymmetricEncryptedSecret - :param connection_string: Connection string for the storage account. Use this string if - username and account key are not specified. - :type connection_string: str - :param ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible values - include: "Enabled", "Disabled". - :type ssl_status: str or ~azure.mgmt.databoxedge.v2019_07_01.models.SSLStatus - :param blob_domain_name: Blob end point for private clouds. - :type blob_domain_name: str - :param account_type: Required. Type of storage accessed on the storage account. Possible values - include: "GeneralPurposeStorage", "BlobStorage". - :type account_type: str or ~azure.mgmt.databoxedge.v2019_07_01.models.AccountType - :param storage_account_id: Id of the storage account. - :type storage_account_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'alias': {'required': True}, - 'ssl_status': {'required': True}, - 'account_type': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'alias': {'key': 'properties.alias', 'type': 'str'}, - 'user_name': {'key': 'properties.userName', 'type': 'str'}, - 'account_key': {'key': 'properties.accountKey', 'type': 'AsymmetricEncryptedSecret'}, - 'connection_string': {'key': 'properties.connectionString', 'type': 'str'}, - 'ssl_status': {'key': 'properties.sslStatus', 'type': 'str'}, - 'blob_domain_name': {'key': 'properties.blobDomainName', 'type': 'str'}, - 'account_type': {'key': 'properties.accountType', 'type': 'str'}, - 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCredential, self).__init__(**kwargs) - self.alias = kwargs['alias'] - self.user_name = kwargs.get('user_name', None) - self.account_key = kwargs.get('account_key', None) - self.connection_string = kwargs.get('connection_string', None) - self.ssl_status = kwargs['ssl_status'] - self.blob_domain_name = kwargs.get('blob_domain_name', None) - self.account_type = kwargs['account_type'] - self.storage_account_id = kwargs.get('storage_account_id', None) - - -class StorageAccountCredentialList(msrest.serialization.Model): - """The collection of storage account credentials. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The value. - :vartype value: list[~azure.mgmt.databoxedge.v2019_07_01.models.StorageAccountCredential] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccountCredential]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCredentialList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SymmetricKey(msrest.serialization.Model): - """Symmetric key for authentication. - - :param connection_string: Connection string based on the symmetric key. - :type connection_string: ~azure.mgmt.databoxedge.v2019_07_01.models.AsymmetricEncryptedSecret - """ - - _attribute_map = { - 'connection_string': {'key': 'connectionString', 'type': 'AsymmetricEncryptedSecret'}, - } - - def __init__( - self, - **kwargs - ): - super(SymmetricKey, self).__init__(**kwargs) - self.connection_string = kwargs.get('connection_string', None) - - -class TrackingInfo(msrest.serialization.Model): - """Tracking courier information. - - :param serial_number: Serial number of the device being tracked. - :type serial_number: str - :param carrier_name: Name of the carrier used in the delivery. - :type carrier_name: str - :param tracking_id: Tracking ID of the shipment. - :type tracking_id: str - :param tracking_url: Tracking URL of the shipment. - :type tracking_url: str - """ - - _attribute_map = { - 'serial_number': {'key': 'serialNumber', 'type': 'str'}, - 'carrier_name': {'key': 'carrierName', 'type': 'str'}, - 'tracking_id': {'key': 'trackingId', 'type': 'str'}, - 'tracking_url': {'key': 'trackingUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackingInfo, self).__init__(**kwargs) - self.serial_number = kwargs.get('serial_number', None) - self.carrier_name = kwargs.get('carrier_name', None) - self.tracking_id = kwargs.get('tracking_id', None) - self.tracking_url = kwargs.get('tracking_url', None) - - -class TriggerList(msrest.serialization.Model): - """Collection of all trigger on the data box edge device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of triggers. - :vartype value: list[~azure.mgmt.databoxedge.v2019_07_01.models.Trigger] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Trigger]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TriggerList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class UpdateDownloadProgress(msrest.serialization.Model): - """Details about the download progress of update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar download_phase: The download phase. Possible values include: "Unknown", "Initializing", - "Downloading", "Verifying". - :vartype download_phase: str or ~azure.mgmt.databoxedge.v2019_07_01.models.DownloadPhase - :ivar percent_complete: Percentage of completion. - :vartype percent_complete: int - :ivar total_bytes_to_download: Total bytes to download. - :vartype total_bytes_to_download: float - :ivar total_bytes_downloaded: Total bytes downloaded. - :vartype total_bytes_downloaded: float - :ivar number_of_updates_to_download: Number of updates to download. - :vartype number_of_updates_to_download: int - :ivar number_of_updates_downloaded: Number of updates downloaded. - :vartype number_of_updates_downloaded: int - """ - - _validation = { - 'download_phase': {'readonly': True}, - 'percent_complete': {'readonly': True}, - 'total_bytes_to_download': {'readonly': True}, - 'total_bytes_downloaded': {'readonly': True}, - 'number_of_updates_to_download': {'readonly': True}, - 'number_of_updates_downloaded': {'readonly': True}, - } - - _attribute_map = { - 'download_phase': {'key': 'downloadPhase', 'type': 'str'}, - 'percent_complete': {'key': 'percentComplete', 'type': 'int'}, - 'total_bytes_to_download': {'key': 'totalBytesToDownload', 'type': 'float'}, - 'total_bytes_downloaded': {'key': 'totalBytesDownloaded', 'type': 'float'}, - 'number_of_updates_to_download': {'key': 'numberOfUpdatesToDownload', 'type': 'int'}, - 'number_of_updates_downloaded': {'key': 'numberOfUpdatesDownloaded', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateDownloadProgress, self).__init__(**kwargs) - self.download_phase = None - self.percent_complete = None - self.total_bytes_to_download = None - self.total_bytes_downloaded = None - self.number_of_updates_to_download = None - self.number_of_updates_downloaded = None - - -class UpdateInstallProgress(msrest.serialization.Model): - """Progress details during installation of updates. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar percent_complete: Percentage completed. - :vartype percent_complete: int - :ivar number_of_updates_to_install: Number of updates to install. - :vartype number_of_updates_to_install: int - :ivar number_of_updates_installed: Number of updates installed. - :vartype number_of_updates_installed: int - """ - - _validation = { - 'percent_complete': {'readonly': True}, - 'number_of_updates_to_install': {'readonly': True}, - 'number_of_updates_installed': {'readonly': True}, - } - - _attribute_map = { - 'percent_complete': {'key': 'percentComplete', 'type': 'int'}, - 'number_of_updates_to_install': {'key': 'numberOfUpdatesToInstall', 'type': 'int'}, - 'number_of_updates_installed': {'key': 'numberOfUpdatesInstalled', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateInstallProgress, self).__init__(**kwargs) - self.percent_complete = None - self.number_of_updates_to_install = None - self.number_of_updates_installed = None - - -class UpdateSummary(ARMBaseModel): - """Details about ongoing updates and availability of updates on the device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param device_version_number: The current version of the device in format: 1.2.17312.13.",. - :type device_version_number: str - :param friendly_device_version_name: The current version of the device in text format. - :type friendly_device_version_name: str - :param device_last_scanned_date_time: The last time when a scan was done on the device. - :type device_last_scanned_date_time: ~datetime.datetime - :param last_completed_scan_job_date_time: The time when the last scan job was completed - (success/cancelled/failed) on the appliance. - :type last_completed_scan_job_date_time: ~datetime.datetime - :ivar last_completed_download_job_date_time: The time when the last Download job was completed - (success/cancelled/failed) on the appliance. - :vartype last_completed_download_job_date_time: ~datetime.datetime - :ivar last_completed_install_job_date_time: The time when the last Install job was completed - (success/cancelled/failed) on the appliance. - :vartype last_completed_install_job_date_time: ~datetime.datetime - :ivar total_number_of_updates_available: The number of updates available for the current device - version as per the last device scan. - :vartype total_number_of_updates_available: int - :ivar total_number_of_updates_pending_download: The total number of items pending download. - :vartype total_number_of_updates_pending_download: int - :ivar total_number_of_updates_pending_install: The total number of items pending install. - :vartype total_number_of_updates_pending_install: int - :ivar reboot_behavior: Indicates if updates are available and at least one of the updates needs - a reboot. Possible values include: "NeverReboots", "RequiresReboot", "RequestReboot". - :vartype reboot_behavior: str or - ~azure.mgmt.databoxedge.v2019_07_01.models.InstallRebootBehavior - :ivar ongoing_update_operation: The current update operation. Possible values include: "None", - "Scan", "Download", "Install". - :vartype ongoing_update_operation: str or - ~azure.mgmt.databoxedge.v2019_07_01.models.UpdateOperation - :ivar in_progress_download_job_id: The job ID of the download job in progress. - :vartype in_progress_download_job_id: str - :ivar in_progress_install_job_id: The job ID of the install job in progress. - :vartype in_progress_install_job_id: str - :ivar in_progress_download_job_started_date_time: The time when the currently running download - (if any) started. - :vartype in_progress_download_job_started_date_time: ~datetime.datetime - :ivar in_progress_install_job_started_date_time: The time when the currently running install - (if any) started. - :vartype in_progress_install_job_started_date_time: ~datetime.datetime - :ivar update_titles: The list of updates available for install. - :vartype update_titles: list[str] - :ivar total_update_size_in_bytes: The total size of updates available for download in bytes. - :vartype total_update_size_in_bytes: float - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'last_completed_download_job_date_time': {'readonly': True}, - 'last_completed_install_job_date_time': {'readonly': True}, - 'total_number_of_updates_available': {'readonly': True}, - 'total_number_of_updates_pending_download': {'readonly': True}, - 'total_number_of_updates_pending_install': {'readonly': True}, - 'reboot_behavior': {'readonly': True}, - 'ongoing_update_operation': {'readonly': True}, - 'in_progress_download_job_id': {'readonly': True}, - 'in_progress_install_job_id': {'readonly': True}, - 'in_progress_download_job_started_date_time': {'readonly': True}, - 'in_progress_install_job_started_date_time': {'readonly': True}, - 'update_titles': {'readonly': True}, - 'total_update_size_in_bytes': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'device_version_number': {'key': 'properties.deviceVersionNumber', 'type': 'str'}, - 'friendly_device_version_name': {'key': 'properties.friendlyDeviceVersionName', 'type': 'str'}, - 'device_last_scanned_date_time': {'key': 'properties.deviceLastScannedDateTime', 'type': 'iso-8601'}, - 'last_completed_scan_job_date_time': {'key': 'properties.lastCompletedScanJobDateTime', 'type': 'iso-8601'}, - 'last_completed_download_job_date_time': {'key': 'properties.lastCompletedDownloadJobDateTime', 'type': 'iso-8601'}, - 'last_completed_install_job_date_time': {'key': 'properties.lastCompletedInstallJobDateTime', 'type': 'iso-8601'}, - 'total_number_of_updates_available': {'key': 'properties.totalNumberOfUpdatesAvailable', 'type': 'int'}, - 'total_number_of_updates_pending_download': {'key': 'properties.totalNumberOfUpdatesPendingDownload', 'type': 'int'}, - 'total_number_of_updates_pending_install': {'key': 'properties.totalNumberOfUpdatesPendingInstall', 'type': 'int'}, - 'reboot_behavior': {'key': 'properties.rebootBehavior', 'type': 'str'}, - 'ongoing_update_operation': {'key': 'properties.ongoingUpdateOperation', 'type': 'str'}, - 'in_progress_download_job_id': {'key': 'properties.inProgressDownloadJobId', 'type': 'str'}, - 'in_progress_install_job_id': {'key': 'properties.inProgressInstallJobId', 'type': 'str'}, - 'in_progress_download_job_started_date_time': {'key': 'properties.inProgressDownloadJobStartedDateTime', 'type': 'iso-8601'}, - 'in_progress_install_job_started_date_time': {'key': 'properties.inProgressInstallJobStartedDateTime', 'type': 'iso-8601'}, - 'update_titles': {'key': 'properties.updateTitles', 'type': '[str]'}, - 'total_update_size_in_bytes': {'key': 'properties.totalUpdateSizeInBytes', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateSummary, self).__init__(**kwargs) - self.device_version_number = kwargs.get('device_version_number', None) - self.friendly_device_version_name = kwargs.get('friendly_device_version_name', None) - self.device_last_scanned_date_time = kwargs.get('device_last_scanned_date_time', None) - self.last_completed_scan_job_date_time = kwargs.get('last_completed_scan_job_date_time', None) - self.last_completed_download_job_date_time = None - self.last_completed_install_job_date_time = None - self.total_number_of_updates_available = None - self.total_number_of_updates_pending_download = None - self.total_number_of_updates_pending_install = None - self.reboot_behavior = None - self.ongoing_update_operation = None - self.in_progress_download_job_id = None - self.in_progress_install_job_id = None - self.in_progress_download_job_started_date_time = None - self.in_progress_install_job_started_date_time = None - self.update_titles = None - self.total_update_size_in_bytes = None - - -class UploadCertificateRequest(msrest.serialization.Model): - """The upload certificate request. - - All required parameters must be populated in order to send to Azure. - - :param authentication_type: The authentication type. Possible values include: "Invalid", - "AzureActiveDirectory". - :type authentication_type: str or ~azure.mgmt.databoxedge.v2019_07_01.models.AuthenticationType - :param certificate: Required. The base64 encoded certificate raw data. - :type certificate: str - """ - - _validation = { - 'certificate': {'required': True}, - } - - _attribute_map = { - 'authentication_type': {'key': 'properties.authenticationType', 'type': 'str'}, - 'certificate': {'key': 'properties.certificate', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UploadCertificateRequest, self).__init__(**kwargs) - self.authentication_type = kwargs.get('authentication_type', None) - self.certificate = kwargs['certificate'] - - -class UploadCertificateResponse(msrest.serialization.Model): - """The upload registration certificate response. - - All required parameters must be populated in order to send to Azure. - - :param auth_type: Specifies authentication type. Possible values include: "Invalid", - "AzureActiveDirectory". - :type auth_type: str or ~azure.mgmt.databoxedge.v2019_07_01.models.AuthenticationType - :param resource_id: Required. The resource ID of the Data Box Edge/Gateway device. - :type resource_id: str - :param aad_authority: Required. Azure Active Directory tenant authority. - :type aad_authority: str - :param aad_tenant_id: Required. Azure Active Directory tenant ID. - :type aad_tenant_id: str - :param service_principal_client_id: Required. Azure Active Directory service principal client - ID. - :type service_principal_client_id: str - :param service_principal_object_id: Required. Azure Active Directory service principal object - ID. - :type service_principal_object_id: str - :param azure_management_endpoint_audience: Required. The azure management endpoint audience. - :type azure_management_endpoint_audience: str - """ - - _validation = { - 'resource_id': {'required': True}, - 'aad_authority': {'required': True}, - 'aad_tenant_id': {'required': True}, - 'service_principal_client_id': {'required': True}, - 'service_principal_object_id': {'required': True}, - 'azure_management_endpoint_audience': {'required': True}, - } - - _attribute_map = { - 'auth_type': {'key': 'authType', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'aad_authority': {'key': 'aadAuthority', 'type': 'str'}, - 'aad_tenant_id': {'key': 'aadTenantId', 'type': 'str'}, - 'service_principal_client_id': {'key': 'servicePrincipalClientId', 'type': 'str'}, - 'service_principal_object_id': {'key': 'servicePrincipalObjectId', 'type': 'str'}, - 'azure_management_endpoint_audience': {'key': 'azureManagementEndpointAudience', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UploadCertificateResponse, self).__init__(**kwargs) - self.auth_type = kwargs.get('auth_type', None) - self.resource_id = kwargs['resource_id'] - self.aad_authority = kwargs['aad_authority'] - self.aad_tenant_id = kwargs['aad_tenant_id'] - self.service_principal_client_id = kwargs['service_principal_client_id'] - self.service_principal_object_id = kwargs['service_principal_object_id'] - self.azure_management_endpoint_audience = kwargs['azure_management_endpoint_audience'] - - -class User(ARMBaseModel): - """Represents a user who has access to one or more shares on the Data Box Edge/Gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param encrypted_password: The password details. - :type encrypted_password: ~azure.mgmt.databoxedge.v2019_07_01.models.AsymmetricEncryptedSecret - :param share_access_rights: List of shares that the user has rights on. This field should not - be specified during user creation. - :type share_access_rights: list[~azure.mgmt.databoxedge.v2019_07_01.models.ShareAccessRight] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'encrypted_password': {'key': 'properties.encryptedPassword', 'type': 'AsymmetricEncryptedSecret'}, - 'share_access_rights': {'key': 'properties.shareAccessRights', 'type': '[ShareAccessRight]'}, - } - - def __init__( - self, - **kwargs - ): - super(User, self).__init__(**kwargs) - self.encrypted_password = kwargs.get('encrypted_password', None) - self.share_access_rights = kwargs.get('share_access_rights', None) - - -class UserAccessRight(msrest.serialization.Model): - """The mapping between a particular user and the access type on the SMB share. - - All required parameters must be populated in order to send to Azure. - - :param user_id: Required. User ID (already existing in the device). - :type user_id: str - :param access_type: Required. Type of access to be allowed for the user. Possible values - include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2019_07_01.models.ShareAccessType - """ - - _validation = { - 'user_id': {'required': True}, - 'access_type': {'required': True}, - } - - _attribute_map = { - 'user_id': {'key': 'userId', 'type': 'str'}, - 'access_type': {'key': 'accessType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserAccessRight, self).__init__(**kwargs) - self.user_id = kwargs['user_id'] - self.access_type = kwargs['access_type'] - - -class UserList(msrest.serialization.Model): - """Collection of users. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of users. - :vartype value: list[~azure.mgmt.databoxedge.v2019_07_01.models.User] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[User]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserList, self).__init__(**kwargs) - self.value = None - self.next_link = None diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/models/_models_py3.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/models/_models_py3.py index 8ae27675c6ba..a9d7db5978ca 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/models/_models_py3.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/models/_models_py3.py @@ -19,20 +19,20 @@ class Address(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param address_line1: Required. The address line1. - :type address_line1: str - :param address_line2: The address line2. - :type address_line2: str - :param address_line3: The address line3. - :type address_line3: str - :param postal_code: Required. The postal code. - :type postal_code: str - :param city: Required. The city name. - :type city: str - :param state: Required. The state name. - :type state: str - :param country: Required. The country name. - :type country: str + :ivar address_line1: Required. The address line1. + :vartype address_line1: str + :ivar address_line2: The address line2. + :vartype address_line2: str + :ivar address_line3: The address line3. + :vartype address_line3: str + :ivar postal_code: Required. The postal code. + :vartype postal_code: str + :ivar city: Required. The city name. + :vartype city: str + :ivar state: Required. The state name. + :vartype state: str + :ivar country: Required. The country name. + :vartype country: str """ _validation = { @@ -65,6 +65,22 @@ def __init__( address_line3: Optional[str] = None, **kwargs ): + """ + :keyword address_line1: Required. The address line1. + :paramtype address_line1: str + :keyword address_line2: The address line2. + :paramtype address_line2: str + :keyword address_line3: The address line3. + :paramtype address_line3: str + :keyword postal_code: Required. The postal code. + :paramtype postal_code: str + :keyword city: Required. The city name. + :paramtype city: str + :keyword state: Required. The state name. + :paramtype state: str + :keyword country: Required. The country name. + :paramtype country: str + """ super(Address, self).__init__(**kwargs) self.address_line1 = address_line1 self.address_line2 = address_line2 @@ -104,6 +120,8 @@ def __init__( self, **kwargs ): + """ + """ super(ARMBaseModel, self).__init__(**kwargs) self.id = None self.name = None @@ -168,6 +186,8 @@ def __init__( self, **kwargs ): + """ + """ super(Alert, self).__init__(**kwargs) self.title = None self.alert_type = None @@ -207,6 +227,8 @@ def __init__( self, **kwargs ): + """ + """ super(AlertErrorDetails, self).__init__(**kwargs) self.error_code = None self.error_message = None @@ -238,6 +260,8 @@ def __init__( self, **kwargs ): + """ + """ super(AlertList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -248,14 +272,14 @@ class AsymmetricEncryptedSecret(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The value of the secret. - :type value: str - :param encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the + :ivar value: Required. The value of the secret. + :vartype value: str + :ivar encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the value is unencrypted, it will be null. - :type encryption_cert_thumbprint: str - :param encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values + :vartype encryption_cert_thumbprint: str + :ivar encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values include: "None", "AES256", "RSAES_PKCS1_v_1_5". - :type encryption_algorithm: str or + :vartype encryption_algorithm: str or ~azure.mgmt.databoxedge.v2019_07_01.models.EncryptionAlgorithm """ @@ -278,6 +302,17 @@ def __init__( encryption_cert_thumbprint: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The value of the secret. + :paramtype value: str + :keyword encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the + value is unencrypted, it will be null. + :paramtype encryption_cert_thumbprint: str + :keyword encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values + include: "None", "AES256", "RSAES_PKCS1_v_1_5". + :paramtype encryption_algorithm: str or + ~azure.mgmt.databoxedge.v2019_07_01.models.EncryptionAlgorithm + """ super(AsymmetricEncryptedSecret, self).__init__(**kwargs) self.value = value self.encryption_cert_thumbprint = encryption_cert_thumbprint @@ -287,8 +322,8 @@ def __init__( class Authentication(msrest.serialization.Model): """Authentication mechanism for IoT devices. - :param symmetric_key: Symmetric key for authentication. - :type symmetric_key: ~azure.mgmt.databoxedge.v2019_07_01.models.SymmetricKey + :ivar symmetric_key: Symmetric key for authentication. + :vartype symmetric_key: ~azure.mgmt.databoxedge.v2019_07_01.models.SymmetricKey """ _attribute_map = { @@ -301,6 +336,10 @@ def __init__( symmetric_key: Optional["SymmetricKey"] = None, **kwargs ): + """ + :keyword symmetric_key: Symmetric key for authentication. + :paramtype symmetric_key: ~azure.mgmt.databoxedge.v2019_07_01.models.SymmetricKey + """ super(Authentication, self).__init__(**kwargs) self.symmetric_key = symmetric_key @@ -310,15 +349,16 @@ class AzureContainerInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param storage_account_credential_id: Required. ID of the storage account credential used to + :ivar storage_account_credential_id: Required. ID of the storage account credential used to access storage. - :type storage_account_credential_id: str - :param container_name: Required. Container name (Based on the data format specified, this + :vartype storage_account_credential_id: str + :ivar container_name: Required. Container name (Based on the data format specified, this represents the name of Azure Files/Page blob/Block blob). - :type container_name: str - :param data_format: Required. Storage format used for the file represented by the share. + :vartype container_name: str + :ivar data_format: Required. Storage format used for the file represented by the share. Possible values include: "BlockBlob", "PageBlob", "AzureFile". - :type data_format: str or ~azure.mgmt.databoxedge.v2019_07_01.models.AzureContainerDataFormat + :vartype data_format: str or + ~azure.mgmt.databoxedge.v2019_07_01.models.AzureContainerDataFormat """ _validation = { @@ -341,6 +381,18 @@ def __init__( data_format: Union[str, "AzureContainerDataFormat"], **kwargs ): + """ + :keyword storage_account_credential_id: Required. ID of the storage account credential used to + access storage. + :paramtype storage_account_credential_id: str + :keyword container_name: Required. Container name (Based on the data format specified, this + represents the name of Azure Files/Page blob/Block blob). + :paramtype container_name: str + :keyword data_format: Required. Storage format used for the file represented by the share. + Possible values include: "BlockBlob", "PageBlob", "AzureFile". + :paramtype data_format: str or + ~azure.mgmt.databoxedge.v2019_07_01.models.AzureContainerDataFormat + """ super(AzureContainerInfo, self).__init__(**kwargs) self.storage_account_credential_id = storage_account_credential_id self.container_name = container_name @@ -360,14 +412,14 @@ class BandwidthSchedule(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param start: Required. The start time of the schedule in UTC. - :type start: str - :param stop: Required. The stop time of the schedule in UTC. - :type stop: str - :param rate_in_mbps: Required. The bandwidth rate in Mbps. - :type rate_in_mbps: int - :param days: Required. The days of the week when this schedule is applicable. - :type days: list[str or ~azure.mgmt.databoxedge.v2019_07_01.models.DayOfWeek] + :ivar start: Required. The start time of the schedule in UTC. + :vartype start: str + :ivar stop: Required. The stop time of the schedule in UTC. + :vartype stop: str + :ivar rate_in_mbps: Required. The bandwidth rate in Mbps. + :vartype rate_in_mbps: int + :ivar days: Required. The days of the week when this schedule is applicable. + :vartype days: list[str or ~azure.mgmt.databoxedge.v2019_07_01.models.DayOfWeek] """ _validation = { @@ -399,6 +451,16 @@ def __init__( days: List[Union[str, "DayOfWeek"]], **kwargs ): + """ + :keyword start: Required. The start time of the schedule in UTC. + :paramtype start: str + :keyword stop: Required. The stop time of the schedule in UTC. + :paramtype stop: str + :keyword rate_in_mbps: Required. The bandwidth rate in Mbps. + :paramtype rate_in_mbps: int + :keyword days: Required. The days of the week when this schedule is applicable. + :paramtype days: list[str or ~azure.mgmt.databoxedge.v2019_07_01.models.DayOfWeek] + """ super(BandwidthSchedule, self).__init__(**kwargs) self.start = start self.stop = stop @@ -431,6 +493,8 @@ def __init__( self, **kwargs ): + """ + """ super(BandwidthSchedulesList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -441,11 +505,12 @@ class ClientAccessRight(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param client: Required. IP of the client. - :type client: str - :param access_permission: Required. Type of access to be allowed for the client. Possible - values include: "NoAccess", "ReadOnly", "ReadWrite". - :type access_permission: str or ~azure.mgmt.databoxedge.v2019_07_01.models.ClientPermissionType + :ivar client: Required. IP of the client. + :vartype client: str + :ivar access_permission: Required. Type of access to be allowed for the client. Possible values + include: "NoAccess", "ReadOnly", "ReadWrite". + :vartype access_permission: str or + ~azure.mgmt.databoxedge.v2019_07_01.models.ClientPermissionType """ _validation = { @@ -465,6 +530,14 @@ def __init__( access_permission: Union[str, "ClientPermissionType"], **kwargs ): + """ + :keyword client: Required. IP of the client. + :paramtype client: str + :keyword access_permission: Required. Type of access to be allowed for the client. Possible + values include: "NoAccess", "ReadOnly", "ReadWrite". + :paramtype access_permission: str or + ~azure.mgmt.databoxedge.v2019_07_01.models.ClientPermissionType + """ super(ClientAccessRight, self).__init__(**kwargs) self.client = client self.access_permission = access_permission @@ -473,14 +546,14 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from the service. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.databoxedge.v2019_07_01.models.CloudErrorBody] + :vartype message: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.databoxedge.v2019_07_01.models.CloudErrorBody] """ _attribute_map = { @@ -497,6 +570,16 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.databoxedge.v2019_07_01.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -508,14 +591,14 @@ class ContactDetails(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param contact_person: Required. The contact person name. - :type contact_person: str - :param company_name: Required. The name of the company. - :type company_name: str - :param phone: Required. The phone number. - :type phone: str - :param email_list: Required. The email list. - :type email_list: list[str] + :ivar contact_person: Required. The contact person name. + :vartype contact_person: str + :ivar company_name: Required. The name of the company. + :vartype company_name: str + :ivar phone: Required. The phone number. + :vartype phone: str + :ivar email_list: Required. The email list. + :vartype email_list: list[str] """ _validation = { @@ -541,6 +624,16 @@ def __init__( email_list: List[str], **kwargs ): + """ + :keyword contact_person: Required. The contact person name. + :paramtype contact_person: str + :keyword company_name: Required. The name of the company. + :paramtype company_name: str + :keyword phone: Required. The phone number. + :paramtype phone: str + :keyword email_list: Required. The email list. + :paramtype email_list: list[str] + """ super(ContactDetails, self).__init__(**kwargs) self.contact_person = contact_person self.company_name = company_name @@ -561,34 +654,34 @@ class DataBoxEdgeDevice(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param location: Required. The location of the device. This is a supported and registered Azure + :ivar location: Required. The location of the device. This is a supported and registered Azure geographical region (for example, West US, East US, or Southeast Asia). The geographical region of a device cannot be changed once it is created, but if an identical geographical region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. The list of tags that describe the device. These tags can be used - to view and group this device (across resource groups). - :type tags: dict[str, str] - :param sku: The SKU type. - :type sku: ~azure.mgmt.databoxedge.v2019_07_01.models.Sku - :param etag: The etag for the devices. - :type etag: str - :param data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible + :vartype location: str + :ivar tags: A set of tags. The list of tags that describe the device. These tags can be used to + view and group this device (across resource groups). + :vartype tags: dict[str, str] + :ivar sku: The SKU type. + :vartype sku: ~azure.mgmt.databoxedge.v2019_07_01.models.Sku + :ivar etag: The etag for the devices. + :vartype etag: str + :ivar data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible values include: "ReadyToSetup", "Online", "Offline", "NeedsAttention", "Disconnected", "PartiallyDisconnected", "Maintenance". - :type data_box_edge_device_status: str or + :vartype data_box_edge_device_status: str or ~azure.mgmt.databoxedge.v2019_07_01.models.DataBoxEdgeDeviceStatus :ivar serial_number: The Serial Number of Data Box Edge/Gateway device. :vartype serial_number: str - :param description: The Description of the Data Box Edge/Gateway device. - :type description: str - :param model_description: The description of the Data Box Edge/Gateway device model. - :type model_description: str + :ivar description: The Description of the Data Box Edge/Gateway device. + :vartype description: str + :ivar model_description: The description of the Data Box Edge/Gateway device model. + :vartype model_description: str :ivar device_type: The type of the Data Box Edge/Gateway device. Possible values include: "DataBoxEdgeDevice". :vartype device_type: str or ~azure.mgmt.databoxedge.v2019_07_01.models.DeviceType - :param friendly_name: The Data Box Edge/Gateway device name. - :type friendly_name: str + :ivar friendly_name: The Data Box Edge/Gateway device name. + :vartype friendly_name: str :ivar culture: The Data Box Edge/Gateway device culture. :vartype culture: str :ivar device_model: The Data Box Edge/Gateway device model. @@ -662,6 +755,31 @@ def __init__( friendly_name: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. The location of the device. This is a supported and registered + Azure geographical region (for example, West US, East US, or Southeast Asia). The geographical + region of a device cannot be changed once it is created, but if an identical geographical + region is specified on update, the request will succeed. + :paramtype location: str + :keyword tags: A set of tags. The list of tags that describe the device. These tags can be used + to view and group this device (across resource groups). + :paramtype tags: dict[str, str] + :keyword sku: The SKU type. + :paramtype sku: ~azure.mgmt.databoxedge.v2019_07_01.models.Sku + :keyword etag: The etag for the devices. + :paramtype etag: str + :keyword data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible + values include: "ReadyToSetup", "Online", "Offline", "NeedsAttention", "Disconnected", + "PartiallyDisconnected", "Maintenance". + :paramtype data_box_edge_device_status: str or + ~azure.mgmt.databoxedge.v2019_07_01.models.DataBoxEdgeDeviceStatus + :keyword description: The Description of the Data Box Edge/Gateway device. + :paramtype description: str + :keyword model_description: The description of the Data Box Edge/Gateway device model. + :paramtype model_description: str + :keyword friendly_name: The Data Box Edge/Gateway device name. + :paramtype friendly_name: str + """ super(DataBoxEdgeDevice, self).__init__(**kwargs) self.location = location self.tags = tags @@ -694,11 +812,11 @@ class DataBoxEdgeDeviceExtendedInfo(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param encryption_key_thumbprint: The digital signature of encrypted certificate. - :type encryption_key_thumbprint: str - :param encryption_key: The public part of the encryption certificate. Client uses this to + :ivar encryption_key_thumbprint: The digital signature of encrypted certificate. + :vartype encryption_key_thumbprint: str + :ivar encryption_key: The public part of the encryption certificate. Client uses this to encrypt any secret. - :type encryption_key: str + :vartype encryption_key: str :ivar resource_key: The Resource ID of the Resource. :vartype resource_key: str """ @@ -726,6 +844,13 @@ def __init__( encryption_key: Optional[str] = None, **kwargs ): + """ + :keyword encryption_key_thumbprint: The digital signature of encrypted certificate. + :paramtype encryption_key_thumbprint: str + :keyword encryption_key: The public part of the encryption certificate. Client uses this to + encrypt any secret. + :paramtype encryption_key: str + """ super(DataBoxEdgeDeviceExtendedInfo, self).__init__(**kwargs) self.encryption_key_thumbprint = encryption_key_thumbprint self.encryption_key = encryption_key @@ -757,6 +882,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataBoxEdgeDeviceList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -765,8 +892,8 @@ def __init__( class DataBoxEdgeDevicePatch(msrest.serialization.Model): """The Data Box Edge/Gateway device patch. - :param tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. - :type tags: dict[str, str] + :ivar tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -779,6 +906,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. + :paramtype tags: dict[str, str] + """ super(DataBoxEdgeDevicePatch, self).__init__(**kwargs) self.tags = tags @@ -799,9 +930,9 @@ class Trigger(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: + :ivar kind: Required. Trigger Kind.Constant filled by server. Possible values include: "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2019_07_01.models.TriggerEventType + :vartype kind: str or ~azure.mgmt.databoxedge.v2019_07_01.models.TriggerEventType """ _validation = { @@ -826,6 +957,8 @@ def __init__( self, **kwargs ): + """ + """ super(Trigger, self).__init__(**kwargs) self.kind = 'Trigger' # type: str @@ -843,17 +976,17 @@ class FileEventTrigger(Trigger): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: + :ivar kind: Required. Trigger Kind.Constant filled by server. Possible values include: "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2019_07_01.models.TriggerEventType - :param source_info: Required. File event source details. - :type source_info: ~azure.mgmt.databoxedge.v2019_07_01.models.FileSourceInfo - :param sink_info: Required. Role sink info. - :type sink_info: ~azure.mgmt.databoxedge.v2019_07_01.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against + :vartype kind: str or ~azure.mgmt.databoxedge.v2019_07_01.models.TriggerEventType + :ivar source_info: Required. File event source details. + :vartype source_info: ~azure.mgmt.databoxedge.v2019_07_01.models.FileSourceInfo + :ivar sink_info: Required. Role sink info. + :vartype sink_info: ~azure.mgmt.databoxedge.v2019_07_01.models.RoleSinkInfo + :ivar custom_context_tag: A custom context tag typically used to correlate the trigger against its usage. For example, if a periodic timer trigger is intended for certain specific IoT modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str + :vartype custom_context_tag: str """ _validation = { @@ -883,6 +1016,16 @@ def __init__( custom_context_tag: Optional[str] = None, **kwargs ): + """ + :keyword source_info: Required. File event source details. + :paramtype source_info: ~azure.mgmt.databoxedge.v2019_07_01.models.FileSourceInfo + :keyword sink_info: Required. Role sink info. + :paramtype sink_info: ~azure.mgmt.databoxedge.v2019_07_01.models.RoleSinkInfo + :keyword custom_context_tag: A custom context tag typically used to correlate the trigger + against its usage. For example, if a periodic timer trigger is intended for certain specific + IoT modules in the device, the tag can be the name or the image URL of the module. + :paramtype custom_context_tag: str + """ super(FileEventTrigger, self).__init__(**kwargs) self.kind = 'FileEvent' # type: str self.source_info = source_info @@ -895,8 +1038,8 @@ class FileSourceInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param share_id: Required. File share ID. - :type share_id: str + :ivar share_id: Required. File share ID. + :vartype share_id: str """ _validation = { @@ -913,6 +1056,10 @@ def __init__( share_id: str, **kwargs ): + """ + :keyword share_id: Required. File share ID. + :paramtype share_id: str + """ super(FileSourceInfo, self).__init__(**kwargs) self.share_id = share_id @@ -922,14 +1069,14 @@ class IoTDeviceInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param device_id: Required. ID of the IoT device/edge device. - :type device_id: str - :param io_t_host_hub: Required. Host name for the IoT hub associated to the device. - :type io_t_host_hub: str - :param io_t_host_hub_id: Id of the IoT hub associated to the device. - :type io_t_host_hub_id: str - :param authentication: IoT device authentication info. - :type authentication: ~azure.mgmt.databoxedge.v2019_07_01.models.Authentication + :ivar device_id: Required. ID of the IoT device/edge device. + :vartype device_id: str + :ivar io_t_host_hub: Required. Host name for the IoT hub associated to the device. + :vartype io_t_host_hub: str + :ivar io_t_host_hub_id: Id of the IoT hub associated to the device. + :vartype io_t_host_hub_id: str + :ivar authentication: IoT device authentication info. + :vartype authentication: ~azure.mgmt.databoxedge.v2019_07_01.models.Authentication """ _validation = { @@ -953,6 +1100,16 @@ def __init__( authentication: Optional["Authentication"] = None, **kwargs ): + """ + :keyword device_id: Required. ID of the IoT device/edge device. + :paramtype device_id: str + :keyword io_t_host_hub: Required. Host name for the IoT hub associated to the device. + :paramtype io_t_host_hub: str + :keyword io_t_host_hub_id: Id of the IoT hub associated to the device. + :paramtype io_t_host_hub_id: str + :keyword authentication: IoT device authentication info. + :paramtype authentication: ~azure.mgmt.databoxedge.v2019_07_01.models.Authentication + """ super(IoTDeviceInfo, self).__init__(**kwargs) self.device_id = device_id self.io_t_host_hub = io_t_host_hub @@ -976,9 +1133,9 @@ class Role(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive". - :type kind: str or ~azure.mgmt.databoxedge.v2019_07_01.models.RoleTypes + :vartype kind: str or ~azure.mgmt.databoxedge.v2019_07_01.models.RoleTypes """ _validation = { @@ -1003,6 +1160,8 @@ def __init__( self, **kwargs ): + """ + """ super(Role, self).__init__(**kwargs) self.kind = 'Role' # type: str @@ -1020,21 +1179,21 @@ class IoTRole(Role): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive". - :type kind: str or ~azure.mgmt.databoxedge.v2019_07_01.models.RoleTypes - :param host_platform: Host OS supported by the IoT role. Possible values include: "Windows", + :vartype kind: str or ~azure.mgmt.databoxedge.v2019_07_01.models.RoleTypes + :ivar host_platform: Host OS supported by the IoT role. Possible values include: "Windows", "Linux". - :type host_platform: str or ~azure.mgmt.databoxedge.v2019_07_01.models.PlatformType - :param io_t_device_details: IoT device metadata to which data box edge device needs to be + :vartype host_platform: str or ~azure.mgmt.databoxedge.v2019_07_01.models.PlatformType + :ivar io_t_device_details: IoT device metadata to which data box edge device needs to be connected. - :type io_t_device_details: ~azure.mgmt.databoxedge.v2019_07_01.models.IoTDeviceInfo - :param io_t_edge_device_details: IoT edge device to which the IoT role needs to be configured. - :type io_t_edge_device_details: ~azure.mgmt.databoxedge.v2019_07_01.models.IoTDeviceInfo - :param share_mappings: Mount points of shares in role(s). - :type share_mappings: list[~azure.mgmt.databoxedge.v2019_07_01.models.MountPointMap] - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2019_07_01.models.RoleStatus + :vartype io_t_device_details: ~azure.mgmt.databoxedge.v2019_07_01.models.IoTDeviceInfo + :ivar io_t_edge_device_details: IoT edge device to which the IoT role needs to be configured. + :vartype io_t_edge_device_details: ~azure.mgmt.databoxedge.v2019_07_01.models.IoTDeviceInfo + :ivar share_mappings: Mount points of shares in role(s). + :vartype share_mappings: list[~azure.mgmt.databoxedge.v2019_07_01.models.MountPointMap] + :ivar role_status: Role status. Possible values include: "Enabled", "Disabled". + :vartype role_status: str or ~azure.mgmt.databoxedge.v2019_07_01.models.RoleStatus """ _validation = { @@ -1066,6 +1225,21 @@ def __init__( role_status: Optional[Union[str, "RoleStatus"]] = None, **kwargs ): + """ + :keyword host_platform: Host OS supported by the IoT role. Possible values include: "Windows", + "Linux". + :paramtype host_platform: str or ~azure.mgmt.databoxedge.v2019_07_01.models.PlatformType + :keyword io_t_device_details: IoT device metadata to which data box edge device needs to be + connected. + :paramtype io_t_device_details: ~azure.mgmt.databoxedge.v2019_07_01.models.IoTDeviceInfo + :keyword io_t_edge_device_details: IoT edge device to which the IoT role needs to be + configured. + :paramtype io_t_edge_device_details: ~azure.mgmt.databoxedge.v2019_07_01.models.IoTDeviceInfo + :keyword share_mappings: Mount points of shares in role(s). + :paramtype share_mappings: list[~azure.mgmt.databoxedge.v2019_07_01.models.MountPointMap] + :keyword role_status: Role status. Possible values include: "Enabled", "Disabled". + :paramtype role_status: str or ~azure.mgmt.databoxedge.v2019_07_01.models.RoleStatus + """ super(IoTRole, self).__init__(**kwargs) self.kind = 'IOT' # type: str self.host_platform = host_platform @@ -1104,6 +1278,8 @@ def __init__( self, **kwargs ): + """ + """ super(Ipv4Config, self).__init__(**kwargs) self.ip_address = None self.subnet = None @@ -1139,6 +1315,8 @@ def __init__( self, **kwargs ): + """ + """ super(Ipv6Config, self).__init__(**kwargs) self.ip_address = None self.prefix_length = None @@ -1186,9 +1364,9 @@ class Job(msrest.serialization.Model): :vartype error_manifest_file: str :ivar share_id: ARM ID of the share that was refreshed. :vartype share_id: str - :param folder: If only subfolders need to be refreshed, then the subfolder path inside the + :ivar folder: If only subfolders need to be refreshed, then the subfolder path inside the share. (The path is empty if there are no subfolders.). - :type folder: str + :vartype folder: str """ _validation = { @@ -1234,6 +1412,11 @@ def __init__( folder: Optional[str] = None, **kwargs ): + """ + :keyword folder: If only subfolders need to be refreshed, then the subfolder path inside the + share. (The path is empty if there are no subfolders.). + :paramtype folder: str + """ super(Job, self).__init__(**kwargs) self.id = None self.name = None @@ -1282,6 +1465,8 @@ def __init__( self, **kwargs ): + """ + """ super(JobErrorDetails, self).__init__(**kwargs) self.error_details = None self.code = None @@ -1317,6 +1502,8 @@ def __init__( self, **kwargs ): + """ + """ super(JobErrorItem, self).__init__(**kwargs) self.recommendations = None self.code = None @@ -1326,12 +1513,12 @@ def __init__( class MetricDimensionV1(msrest.serialization.Model): """Metric Dimension v1. - :param name: Name of the metrics dimension. - :type name: str - :param display_name: Display name of the metrics dimension. - :type display_name: str - :param to_be_exported_for_shoebox: To be exported to shoe box. - :type to_be_exported_for_shoebox: bool + :ivar name: Name of the metrics dimension. + :vartype name: str + :ivar display_name: Display name of the metrics dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: To be exported to shoe box. + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -1348,6 +1535,14 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): + """ + :keyword name: Name of the metrics dimension. + :paramtype name: str + :keyword display_name: Display name of the metrics dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: To be exported to shoe box. + :paramtype to_be_exported_for_shoebox: bool + """ super(MetricDimensionV1, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1357,31 +1552,32 @@ def __init__( class MetricSpecificationV1(msrest.serialization.Model): """Metric specification version 1. - :param name: Name of the metric. - :type name: str - :param display_name: Display name of the metric. - :type display_name: str - :param display_description: Description of the metric to be displayed. - :type display_description: str - :param unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Display name of the metric. + :vartype display_name: str + :ivar display_description: Description of the metric to be displayed. + :vartype display_description: str + :ivar unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", "Seconds", "Milliseconds", "Bytes", "BytesPerSecond", "CountPerSecond". - :type unit: str or ~azure.mgmt.databoxedge.v2019_07_01.models.MetricUnit - :param aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", + :vartype unit: str or ~azure.mgmt.databoxedge.v2019_07_01.models.MetricUnit + :ivar aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", "None", "Average", "Minimum", "Maximum", "Total", "Count". - :type aggregation_type: str or ~azure.mgmt.databoxedge.v2019_07_01.models.MetricAggregationType - :param dimensions: Metric dimensions, other than default dimension which is resource. - :type dimensions: list[~azure.mgmt.databoxedge.v2019_07_01.models.MetricDimensionV1] - :param fill_gap_with_zero: Set true to fill the gaps with zero. - :type fill_gap_with_zero: bool - :param category: Metric category. Possible values include: "Capacity", "Transaction". - :type category: str or ~azure.mgmt.databoxedge.v2019_07_01.models.MetricCategory - :param resource_id_dimension_name_override: Resource name override. - :type resource_id_dimension_name_override: str - :param supported_time_grain_types: Support granularity of metrics. - :type supported_time_grain_types: list[str or + :vartype aggregation_type: str or + ~azure.mgmt.databoxedge.v2019_07_01.models.MetricAggregationType + :ivar dimensions: Metric dimensions, other than default dimension which is resource. + :vartype dimensions: list[~azure.mgmt.databoxedge.v2019_07_01.models.MetricDimensionV1] + :ivar fill_gap_with_zero: Set true to fill the gaps with zero. + :vartype fill_gap_with_zero: bool + :ivar category: Metric category. Possible values include: "Capacity", "Transaction". + :vartype category: str or ~azure.mgmt.databoxedge.v2019_07_01.models.MetricCategory + :ivar resource_id_dimension_name_override: Resource name override. + :vartype resource_id_dimension_name_override: str + :ivar supported_time_grain_types: Support granularity of metrics. + :vartype supported_time_grain_types: list[str or ~azure.mgmt.databoxedge.v2019_07_01.models.TimeGrain] - :param supported_aggregation_types: Support metric aggregation type. - :type supported_aggregation_types: list[str or + :ivar supported_aggregation_types: Support metric aggregation type. + :vartype supported_aggregation_types: list[str or ~azure.mgmt.databoxedge.v2019_07_01.models.MetricAggregationType] """ @@ -1415,6 +1611,35 @@ def __init__( supported_aggregation_types: Optional[List[Union[str, "MetricAggregationType"]]] = None, **kwargs ): + """ + :keyword name: Name of the metric. + :paramtype name: str + :keyword display_name: Display name of the metric. + :paramtype display_name: str + :keyword display_description: Description of the metric to be displayed. + :paramtype display_description: str + :keyword unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", + "Seconds", "Milliseconds", "Bytes", "BytesPerSecond", "CountPerSecond". + :paramtype unit: str or ~azure.mgmt.databoxedge.v2019_07_01.models.MetricUnit + :keyword aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", + "None", "Average", "Minimum", "Maximum", "Total", "Count". + :paramtype aggregation_type: str or + ~azure.mgmt.databoxedge.v2019_07_01.models.MetricAggregationType + :keyword dimensions: Metric dimensions, other than default dimension which is resource. + :paramtype dimensions: list[~azure.mgmt.databoxedge.v2019_07_01.models.MetricDimensionV1] + :keyword fill_gap_with_zero: Set true to fill the gaps with zero. + :paramtype fill_gap_with_zero: bool + :keyword category: Metric category. Possible values include: "Capacity", "Transaction". + :paramtype category: str or ~azure.mgmt.databoxedge.v2019_07_01.models.MetricCategory + :keyword resource_id_dimension_name_override: Resource name override. + :paramtype resource_id_dimension_name_override: str + :keyword supported_time_grain_types: Support granularity of metrics. + :paramtype supported_time_grain_types: list[str or + ~azure.mgmt.databoxedge.v2019_07_01.models.TimeGrain] + :keyword supported_aggregation_types: Support metric aggregation type. + :paramtype supported_aggregation_types: list[str or + ~azure.mgmt.databoxedge.v2019_07_01.models.MetricAggregationType] + """ super(MetricSpecificationV1, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1436,8 +1661,8 @@ class MountPointMap(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param share_id: Required. ID of the share mounted to the role VM. - :type share_id: str + :ivar share_id: Required. ID of the share mounted to the role VM. + :vartype share_id: str :ivar role_id: ID of the role to which share is mounted. :vartype role_id: str :ivar mount_point: Mount point for the share. @@ -1466,6 +1691,10 @@ def __init__( share_id: str, **kwargs ): + """ + :keyword share_id: Required. ID of the share mounted to the role VM. + :paramtype share_id: str + """ super(MountPointMap, self).__init__(**kwargs) self.share_id = share_id self.role_id = None @@ -1497,12 +1726,14 @@ class NetworkAdapter(msrest.serialization.Model): :ivar status: Value indicating whether this adapter is valid. Possible values include: "Inactive", "Active". :vartype status: str or ~azure.mgmt.databoxedge.v2019_07_01.models.NetworkAdapterStatus - :param rdma_status: Value indicating whether this adapter is RDMA capable. Possible values + :ivar rdma_status: Value indicating whether this adapter is RDMA capable. Possible values include: "Incapable", "Capable". - :type rdma_status: str or ~azure.mgmt.databoxedge.v2019_07_01.models.NetworkAdapterRDMAStatus - :param dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values + :vartype rdma_status: str or + ~azure.mgmt.databoxedge.v2019_07_01.models.NetworkAdapterRDMAStatus + :ivar dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values include: "Disabled", "Enabled". - :type dhcp_status: str or ~azure.mgmt.databoxedge.v2019_07_01.models.NetworkAdapterDHCPStatus + :vartype dhcp_status: str or + ~azure.mgmt.databoxedge.v2019_07_01.models.NetworkAdapterDHCPStatus :ivar ipv4_configuration: The IPv4 configuration of the network adapter. :vartype ipv4_configuration: ~azure.mgmt.databoxedge.v2019_07_01.models.Ipv4Config :ivar ipv6_configuration: The IPv6 configuration of the network adapter. @@ -1554,6 +1785,16 @@ def __init__( dhcp_status: Optional[Union[str, "NetworkAdapterDHCPStatus"]] = None, **kwargs ): + """ + :keyword rdma_status: Value indicating whether this adapter is RDMA capable. Possible values + include: "Incapable", "Capable". + :paramtype rdma_status: str or + ~azure.mgmt.databoxedge.v2019_07_01.models.NetworkAdapterRDMAStatus + :keyword dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values + include: "Disabled", "Enabled". + :paramtype dhcp_status: str or + ~azure.mgmt.databoxedge.v2019_07_01.models.NetworkAdapterDHCPStatus + """ super(NetworkAdapter, self).__init__(**kwargs) self.adapter_id = None self.adapter_position = None @@ -1597,6 +1838,8 @@ def __init__( self, **kwargs ): + """ + """ super(NetworkAdapterPosition, self).__init__(**kwargs) self.network_group = None self.port = None @@ -1635,6 +1878,8 @@ def __init__( self, **kwargs ): + """ + """ super(NetworkSettings, self).__init__(**kwargs) self.network_adapters = None @@ -1700,6 +1945,8 @@ def __init__( self, **kwargs ): + """ + """ super(Node, self).__init__(**kwargs) self.node_status = None self.node_chassis_serial_number = None @@ -1731,6 +1978,8 @@ def __init__( self, **kwargs ): + """ + """ super(NodeList, self).__init__(**kwargs) self.value = None @@ -1738,14 +1987,14 @@ def __init__( class Operation(msrest.serialization.Model): """Operations. - :param name: Name of the operation. - :type name: str - :param display: Properties displayed for the operation. - :type display: ~azure.mgmt.databoxedge.v2019_07_01.models.OperationDisplay - :param origin: Origin of the operation. - :type origin: str - :param service_specification: Service specification. - :type service_specification: ~azure.mgmt.databoxedge.v2019_07_01.models.ServiceSpecification + :ivar name: Name of the operation. + :vartype name: str + :ivar display: Properties displayed for the operation. + :vartype display: ~azure.mgmt.databoxedge.v2019_07_01.models.OperationDisplay + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar service_specification: Service specification. + :vartype service_specification: ~azure.mgmt.databoxedge.v2019_07_01.models.ServiceSpecification """ _attribute_map = { @@ -1764,6 +2013,17 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword name: Name of the operation. + :paramtype name: str + :keyword display: Properties displayed for the operation. + :paramtype display: ~azure.mgmt.databoxedge.v2019_07_01.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword service_specification: Service specification. + :paramtype service_specification: + ~azure.mgmt.databoxedge.v2019_07_01.models.ServiceSpecification + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -1774,14 +2034,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Operation display properties. - :param provider: Provider name. - :type provider: str - :param resource: The type of resource in which the operation is performed. - :type resource: str - :param operation: Operation to be performed on the resource. - :type operation: str - :param description: Description of the operation to be performed. - :type description: str + :ivar provider: Provider name. + :vartype provider: str + :ivar resource: The type of resource in which the operation is performed. + :vartype resource: str + :ivar operation: Operation to be performed on the resource. + :vartype operation: str + :ivar description: Description of the operation to be performed. + :vartype description: str """ _attribute_map = { @@ -1800,6 +2060,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Provider name. + :paramtype provider: str + :keyword resource: The type of resource in which the operation is performed. + :paramtype resource: str + :keyword operation: Operation to be performed on the resource. + :paramtype operation: str + :keyword description: Description of the operation to be performed. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1812,10 +2082,10 @@ class OperationsList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The value. - :type value: list[~azure.mgmt.databoxedge.v2019_07_01.models.Operation] - :param next_link: Link to the next set of results. - :type next_link: str + :ivar value: Required. The value. + :vartype value: list[~azure.mgmt.databoxedge.v2019_07_01.models.Operation] + :ivar next_link: Link to the next set of results. + :vartype next_link: str """ _validation = { @@ -1834,6 +2104,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The value. + :paramtype value: list[~azure.mgmt.databoxedge.v2019_07_01.models.Operation] + :keyword next_link: Link to the next set of results. + :paramtype next_link: str + """ super(OperationsList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1850,12 +2126,12 @@ class Order(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param contact_information: The contact details. - :type contact_information: ~azure.mgmt.databoxedge.v2019_07_01.models.ContactDetails - :param shipping_address: The shipping address. - :type shipping_address: ~azure.mgmt.databoxedge.v2019_07_01.models.Address - :param current_status: Current status of the order. - :type current_status: ~azure.mgmt.databoxedge.v2019_07_01.models.OrderStatus + :ivar contact_information: The contact details. + :vartype contact_information: ~azure.mgmt.databoxedge.v2019_07_01.models.ContactDetails + :ivar shipping_address: The shipping address. + :vartype shipping_address: ~azure.mgmt.databoxedge.v2019_07_01.models.Address + :ivar current_status: Current status of the order. + :vartype current_status: ~azure.mgmt.databoxedge.v2019_07_01.models.OrderStatus :ivar order_history: List of status changes in the order. :vartype order_history: list[~azure.mgmt.databoxedge.v2019_07_01.models.OrderStatus] :ivar serial_number: Serial number of the device. @@ -1899,6 +2175,14 @@ def __init__( current_status: Optional["OrderStatus"] = None, **kwargs ): + """ + :keyword contact_information: The contact details. + :paramtype contact_information: ~azure.mgmt.databoxedge.v2019_07_01.models.ContactDetails + :keyword shipping_address: The shipping address. + :paramtype shipping_address: ~azure.mgmt.databoxedge.v2019_07_01.models.Address + :keyword current_status: Current status of the order. + :paramtype current_status: ~azure.mgmt.databoxedge.v2019_07_01.models.OrderStatus + """ super(Order, self).__init__(**kwargs) self.contact_information = contact_information self.shipping_address = shipping_address @@ -1934,6 +2218,8 @@ def __init__( self, **kwargs ): + """ + """ super(OrderList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1946,15 +2232,15 @@ class OrderStatus(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param status: Required. Status of the order as per the allowed status types. Possible values + :ivar status: Required. Status of the order as per the allowed status types. Possible values include: "Untracked", "AwaitingFulfilment", "AwaitingPreparation", "AwaitingShipment", "Shipped", "Arriving", "Delivered", "ReplacementRequested", "LostDevice", "Declined", "ReturnInitiated", "AwaitingReturnShipment", "ShippedBack", "CollectedAtMicrosoft". - :type status: str or ~azure.mgmt.databoxedge.v2019_07_01.models.OrderState + :vartype status: str or ~azure.mgmt.databoxedge.v2019_07_01.models.OrderState :ivar update_date_time: Time of status update. :vartype update_date_time: ~datetime.datetime - :param comments: Comments related to this status change. - :type comments: str + :ivar comments: Comments related to this status change. + :vartype comments: str """ _validation = { @@ -1975,6 +2261,15 @@ def __init__( comments: Optional[str] = None, **kwargs ): + """ + :keyword status: Required. Status of the order as per the allowed status types. Possible values + include: "Untracked", "AwaitingFulfilment", "AwaitingPreparation", "AwaitingShipment", + "Shipped", "Arriving", "Delivered", "ReplacementRequested", "LostDevice", "Declined", + "ReturnInitiated", "AwaitingReturnShipment", "ShippedBack", "CollectedAtMicrosoft". + :paramtype status: str or ~azure.mgmt.databoxedge.v2019_07_01.models.OrderState + :keyword comments: Comments related to this status change. + :paramtype comments: str + """ super(OrderStatus, self).__init__(**kwargs) self.status = status self.update_date_time = None @@ -1994,17 +2289,17 @@ class PeriodicTimerEventTrigger(Trigger): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: + :ivar kind: Required. Trigger Kind.Constant filled by server. Possible values include: "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2019_07_01.models.TriggerEventType - :param source_info: Required. Periodic timer details. - :type source_info: ~azure.mgmt.databoxedge.v2019_07_01.models.PeriodicTimerSourceInfo - :param sink_info: Required. Role Sink information. - :type sink_info: ~azure.mgmt.databoxedge.v2019_07_01.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against + :vartype kind: str or ~azure.mgmt.databoxedge.v2019_07_01.models.TriggerEventType + :ivar source_info: Required. Periodic timer details. + :vartype source_info: ~azure.mgmt.databoxedge.v2019_07_01.models.PeriodicTimerSourceInfo + :ivar sink_info: Required. Role Sink information. + :vartype sink_info: ~azure.mgmt.databoxedge.v2019_07_01.models.RoleSinkInfo + :ivar custom_context_tag: A custom context tag typically used to correlate the trigger against its usage. For example, if a periodic timer trigger is intended for certain specific IoT modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str + :vartype custom_context_tag: str """ _validation = { @@ -2034,6 +2329,16 @@ def __init__( custom_context_tag: Optional[str] = None, **kwargs ): + """ + :keyword source_info: Required. Periodic timer details. + :paramtype source_info: ~azure.mgmt.databoxedge.v2019_07_01.models.PeriodicTimerSourceInfo + :keyword sink_info: Required. Role Sink information. + :paramtype sink_info: ~azure.mgmt.databoxedge.v2019_07_01.models.RoleSinkInfo + :keyword custom_context_tag: A custom context tag typically used to correlate the trigger + against its usage. For example, if a periodic timer trigger is intended for certain specific + IoT modules in the device, the tag can be the name or the image URL of the module. + :paramtype custom_context_tag: str + """ super(PeriodicTimerEventTrigger, self).__init__(**kwargs) self.kind = 'PeriodicTimerEvent' # type: str self.source_info = source_info @@ -2046,15 +2351,15 @@ class PeriodicTimerSourceInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param start_time: Required. The time of the day that results in a valid trigger. Schedule is + :ivar start_time: Required. The time of the day that results in a valid trigger. Schedule is computed with reference to the time specified upto seconds. If timezone is not specified the time will considered to be in device timezone. The value will always be returned as UTC time. - :type start_time: ~datetime.datetime - :param schedule: Required. Periodic frequency at which timer event needs to be raised. Supports + :vartype start_time: ~datetime.datetime + :ivar schedule: Required. Periodic frequency at which timer event needs to be raised. Supports daily, hourly, minutes, and seconds. - :type schedule: str - :param topic: Topic where periodic events are published to IoT device. - :type topic: str + :vartype schedule: str + :ivar topic: Topic where periodic events are published to IoT device. + :vartype topic: str """ _validation = { @@ -2076,6 +2381,17 @@ def __init__( topic: Optional[str] = None, **kwargs ): + """ + :keyword start_time: Required. The time of the day that results in a valid trigger. Schedule is + computed with reference to the time specified upto seconds. If timezone is not specified the + time will considered to be in device timezone. The value will always be returned as UTC time. + :paramtype start_time: ~datetime.datetime + :keyword schedule: Required. Periodic frequency at which timer event needs to be raised. + Supports daily, hourly, minutes, and seconds. + :paramtype schedule: str + :keyword topic: Topic where periodic events are published to IoT device. + :paramtype topic: str + """ super(PeriodicTimerSourceInfo, self).__init__(**kwargs) self.start_time = start_time self.schedule = schedule @@ -2085,19 +2401,19 @@ def __init__( class RefreshDetails(msrest.serialization.Model): """Fields for tracking refresh job on the share. - :param in_progress_refresh_job_id: If a refresh share job is currently in progress on this + :ivar in_progress_refresh_job_id: If a refresh share job is currently in progress on this share, this field indicates the ARM resource ID of that job. The field is empty if no job is in progress. - :type in_progress_refresh_job_id: str - :param last_completed_refresh_job_time_in_utc: Indicates the completed time for the last - refresh job on this particular share, if any.This could be a failed job or a successful job. - :type last_completed_refresh_job_time_in_utc: ~datetime.datetime - :param error_manifest_file: Indicates the relative path of the error xml for the last refresh + :vartype in_progress_refresh_job_id: str + :ivar last_completed_refresh_job_time_in_utc: Indicates the completed time for the last refresh + job on this particular share, if any.This could be a failed job or a successful job. + :vartype last_completed_refresh_job_time_in_utc: ~datetime.datetime + :ivar error_manifest_file: Indicates the relative path of the error xml for the last refresh job on this particular share, if any. This could be a failed job or a successful job. - :type error_manifest_file: str - :param last_job: Indicates the id of the last refresh job on this particular share,if any. This + :vartype error_manifest_file: str + :ivar last_job: Indicates the id of the last refresh job on this particular share,if any. This could be a failed job or a successful job. - :type last_job: str + :vartype last_job: str """ _attribute_map = { @@ -2116,6 +2432,21 @@ def __init__( last_job: Optional[str] = None, **kwargs ): + """ + :keyword in_progress_refresh_job_id: If a refresh share job is currently in progress on this + share, this field indicates the ARM resource ID of that job. The field is empty if no job is in + progress. + :paramtype in_progress_refresh_job_id: str + :keyword last_completed_refresh_job_time_in_utc: Indicates the completed time for the last + refresh job on this particular share, if any.This could be a failed job or a successful job. + :paramtype last_completed_refresh_job_time_in_utc: ~datetime.datetime + :keyword error_manifest_file: Indicates the relative path of the error xml for the last refresh + job on this particular share, if any. This could be a failed job or a successful job. + :paramtype error_manifest_file: str + :keyword last_job: Indicates the id of the last refresh job on this particular share,if any. + This could be a failed job or a successful job. + :paramtype last_job: str + """ super(RefreshDetails, self).__init__(**kwargs) self.in_progress_refresh_job_id = in_progress_refresh_job_id self.last_completed_refresh_job_time_in_utc = last_completed_refresh_job_time_in_utc @@ -2148,6 +2479,8 @@ def __init__( self, **kwargs ): + """ + """ super(RoleList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2158,8 +2491,8 @@ class RoleSinkInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param role_id: Required. Compute role ID. - :type role_id: str + :ivar role_id: Required. Compute role ID. + :vartype role_id: str """ _validation = { @@ -2176,6 +2509,10 @@ def __init__( role_id: str, **kwargs ): + """ + :keyword role_id: Required. Compute role ID. + :paramtype role_id: str + """ super(RoleSinkInfo, self).__init__(**kwargs) self.role_id = role_id @@ -2193,11 +2530,11 @@ class SecuritySettings(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param device_admin_password: Required. Device administrator password as an encrypted string + :ivar device_admin_password: Required. Device administrator password as an encrypted string (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual password should have at least 8 characters that are a combination of uppercase, lowercase, numeric, and special characters. - :type device_admin_password: + :vartype device_admin_password: ~azure.mgmt.databoxedge.v2019_07_01.models.AsymmetricEncryptedSecret """ @@ -2221,6 +2558,14 @@ def __init__( device_admin_password: "AsymmetricEncryptedSecret", **kwargs ): + """ + :keyword device_admin_password: Required. Device administrator password as an encrypted string + (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual + password should have at least 8 characters that are a combination of uppercase, lowercase, + numeric, and special characters. + :paramtype device_admin_password: + ~azure.mgmt.databoxedge.v2019_07_01.models.AsymmetricEncryptedSecret + """ super(SecuritySettings, self).__init__(**kwargs) self.device_admin_password = device_admin_password @@ -2228,8 +2573,8 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """Service specification. - :param metric_specifications: Metric specification as defined by shoebox. - :type metric_specifications: + :ivar metric_specifications: Metric specification as defined by shoebox. + :vartype metric_specifications: list[~azure.mgmt.databoxedge.v2019_07_01.models.MetricSpecificationV1] """ @@ -2243,6 +2588,11 @@ def __init__( metric_specifications: Optional[List["MetricSpecificationV1"]] = None, **kwargs ): + """ + :keyword metric_specifications: Metric specification as defined by shoebox. + :paramtype metric_specifications: + list[~azure.mgmt.databoxedge.v2019_07_01.models.MetricSpecificationV1] + """ super(ServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications @@ -2260,31 +2610,32 @@ class Share(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param description: Description for the share. - :type description: str - :param share_status: Required. Current status of the share. Possible values include: "Offline", + :ivar description: Description for the share. + :vartype description: str + :ivar share_status: Required. Current status of the share. Possible values include: "Offline", "Unknown", "OK", "Updating", "NeedsAttention". - :type share_status: str or ~azure.mgmt.databoxedge.v2019_07_01.models.ShareStatus - :param monitoring_status: Required. Current monitoring status of the share. Possible values + :vartype share_status: str or ~azure.mgmt.databoxedge.v2019_07_01.models.ShareStatus + :ivar monitoring_status: Required. Current monitoring status of the share. Possible values include: "Enabled", "Disabled". - :type monitoring_status: str or ~azure.mgmt.databoxedge.v2019_07_01.models.MonitoringStatus - :param azure_container_info: Azure container mapping for the share. - :type azure_container_info: ~azure.mgmt.databoxedge.v2019_07_01.models.AzureContainerInfo - :param access_protocol: Required. Access protocol to be used by the share. Possible values + :vartype monitoring_status: str or ~azure.mgmt.databoxedge.v2019_07_01.models.MonitoringStatus + :ivar azure_container_info: Azure container mapping for the share. + :vartype azure_container_info: ~azure.mgmt.databoxedge.v2019_07_01.models.AzureContainerInfo + :ivar access_protocol: Required. Access protocol to be used by the share. Possible values include: "SMB", "NFS". - :type access_protocol: str or ~azure.mgmt.databoxedge.v2019_07_01.models.ShareAccessProtocol - :param user_access_rights: Mapping of users and corresponding access rights on the share + :vartype access_protocol: str or ~azure.mgmt.databoxedge.v2019_07_01.models.ShareAccessProtocol + :ivar user_access_rights: Mapping of users and corresponding access rights on the share (required for SMB protocol). - :type user_access_rights: list[~azure.mgmt.databoxedge.v2019_07_01.models.UserAccessRight] - :param client_access_rights: List of IP addresses and corresponding access rights on the + :vartype user_access_rights: list[~azure.mgmt.databoxedge.v2019_07_01.models.UserAccessRight] + :ivar client_access_rights: List of IP addresses and corresponding access rights on the share(required for NFS protocol). - :type client_access_rights: list[~azure.mgmt.databoxedge.v2019_07_01.models.ClientAccessRight] - :param refresh_details: Details of the refresh job on this share. - :type refresh_details: ~azure.mgmt.databoxedge.v2019_07_01.models.RefreshDetails + :vartype client_access_rights: + list[~azure.mgmt.databoxedge.v2019_07_01.models.ClientAccessRight] + :ivar refresh_details: Details of the refresh job on this share. + :vartype refresh_details: ~azure.mgmt.databoxedge.v2019_07_01.models.RefreshDetails :ivar share_mappings: Share mount point to the role. :vartype share_mappings: list[~azure.mgmt.databoxedge.v2019_07_01.models.MountPointMap] - :param data_policy: Data policy of the share. Possible values include: "Cloud", "Local". - :type data_policy: str or ~azure.mgmt.databoxedge.v2019_07_01.models.DataPolicy + :ivar data_policy: Data policy of the share. Possible values include: "Cloud", "Local". + :vartype data_policy: str or ~azure.mgmt.databoxedge.v2019_07_01.models.DataPolicy """ _validation = { @@ -2327,6 +2678,34 @@ def __init__( data_policy: Optional[Union[str, "DataPolicy"]] = None, **kwargs ): + """ + :keyword description: Description for the share. + :paramtype description: str + :keyword share_status: Required. Current status of the share. Possible values include: + "Offline", "Unknown", "OK", "Updating", "NeedsAttention". + :paramtype share_status: str or ~azure.mgmt.databoxedge.v2019_07_01.models.ShareStatus + :keyword monitoring_status: Required. Current monitoring status of the share. Possible values + include: "Enabled", "Disabled". + :paramtype monitoring_status: str or + ~azure.mgmt.databoxedge.v2019_07_01.models.MonitoringStatus + :keyword azure_container_info: Azure container mapping for the share. + :paramtype azure_container_info: ~azure.mgmt.databoxedge.v2019_07_01.models.AzureContainerInfo + :keyword access_protocol: Required. Access protocol to be used by the share. Possible values + include: "SMB", "NFS". + :paramtype access_protocol: str or + ~azure.mgmt.databoxedge.v2019_07_01.models.ShareAccessProtocol + :keyword user_access_rights: Mapping of users and corresponding access rights on the share + (required for SMB protocol). + :paramtype user_access_rights: list[~azure.mgmt.databoxedge.v2019_07_01.models.UserAccessRight] + :keyword client_access_rights: List of IP addresses and corresponding access rights on the + share(required for NFS protocol). + :paramtype client_access_rights: + list[~azure.mgmt.databoxedge.v2019_07_01.models.ClientAccessRight] + :keyword refresh_details: Details of the refresh job on this share. + :paramtype refresh_details: ~azure.mgmt.databoxedge.v2019_07_01.models.RefreshDetails + :keyword data_policy: Data policy of the share. Possible values include: "Cloud", "Local". + :paramtype data_policy: str or ~azure.mgmt.databoxedge.v2019_07_01.models.DataPolicy + """ super(Share, self).__init__(**kwargs) self.description = description self.share_status = share_status @@ -2345,11 +2724,11 @@ class ShareAccessRight(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param share_id: Required. The share ID. - :type share_id: str - :param access_type: Required. Type of access to be allowed on the share for this user. Possible + :ivar share_id: Required. The share ID. + :vartype share_id: str + :ivar access_type: Required. Type of access to be allowed on the share for this user. Possible values include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2019_07_01.models.ShareAccessType + :vartype access_type: str or ~azure.mgmt.databoxedge.v2019_07_01.models.ShareAccessType """ _validation = { @@ -2369,6 +2748,13 @@ def __init__( access_type: Union[str, "ShareAccessType"], **kwargs ): + """ + :keyword share_id: Required. The share ID. + :paramtype share_id: str + :keyword access_type: Required. Type of access to be allowed on the share for this user. + Possible values include: "Change", "Read", "Custom". + :paramtype access_type: str or ~azure.mgmt.databoxedge.v2019_07_01.models.ShareAccessType + """ super(ShareAccessRight, self).__init__(**kwargs) self.share_id = share_id self.access_type = access_type @@ -2399,6 +2785,8 @@ def __init__( self, **kwargs ): + """ + """ super(ShareList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2407,10 +2795,10 @@ def __init__( class Sku(msrest.serialization.Model): """The SKU type. - :param name: SKU name. Possible values include: "Gateway", "Edge". - :type name: str or ~azure.mgmt.databoxedge.v2019_07_01.models.SkuName - :param tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard". - :type tier: str or ~azure.mgmt.databoxedge.v2019_07_01.models.SkuTier + :ivar name: SKU name. Possible values include: "Gateway", "Edge". + :vartype name: str or ~azure.mgmt.databoxedge.v2019_07_01.models.SkuName + :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard". + :vartype tier: str or ~azure.mgmt.databoxedge.v2019_07_01.models.SkuTier """ _attribute_map = { @@ -2425,6 +2813,13 @@ def __init__( tier: Optional[Union[str, "SkuTier"]] = None, **kwargs ): + """ + :keyword name: SKU name. Possible values include: "Gateway", "Edge". + :paramtype name: str or ~azure.mgmt.databoxedge.v2019_07_01.models.SkuName + :keyword tier: The SKU tier. This is based on the SKU name. Possible values include: + "Standard". + :paramtype tier: str or ~azure.mgmt.databoxedge.v2019_07_01.models.SkuTier + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -2443,25 +2838,25 @@ class StorageAccountCredential(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param alias: Required. Alias for the storage account. - :type alias: str - :param user_name: Username for the storage account. - :type user_name: str - :param account_key: Encrypted storage key. - :type account_key: ~azure.mgmt.databoxedge.v2019_07_01.models.AsymmetricEncryptedSecret - :param connection_string: Connection string for the storage account. Use this string if - username and account key are not specified. - :type connection_string: str - :param ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible values + :ivar alias: Required. Alias for the storage account. + :vartype alias: str + :ivar user_name: Username for the storage account. + :vartype user_name: str + :ivar account_key: Encrypted storage key. + :vartype account_key: ~azure.mgmt.databoxedge.v2019_07_01.models.AsymmetricEncryptedSecret + :ivar connection_string: Connection string for the storage account. Use this string if username + and account key are not specified. + :vartype connection_string: str + :ivar ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible values include: "Enabled", "Disabled". - :type ssl_status: str or ~azure.mgmt.databoxedge.v2019_07_01.models.SSLStatus - :param blob_domain_name: Blob end point for private clouds. - :type blob_domain_name: str - :param account_type: Required. Type of storage accessed on the storage account. Possible values + :vartype ssl_status: str or ~azure.mgmt.databoxedge.v2019_07_01.models.SSLStatus + :ivar blob_domain_name: Blob end point for private clouds. + :vartype blob_domain_name: str + :ivar account_type: Required. Type of storage accessed on the storage account. Possible values include: "GeneralPurposeStorage", "BlobStorage". - :type account_type: str or ~azure.mgmt.databoxedge.v2019_07_01.models.AccountType - :param storage_account_id: Id of the storage account. - :type storage_account_id: str + :vartype account_type: str or ~azure.mgmt.databoxedge.v2019_07_01.models.AccountType + :ivar storage_account_id: Id of the storage account. + :vartype storage_account_id: str """ _validation = { @@ -2500,6 +2895,27 @@ def __init__( storage_account_id: Optional[str] = None, **kwargs ): + """ + :keyword alias: Required. Alias for the storage account. + :paramtype alias: str + :keyword user_name: Username for the storage account. + :paramtype user_name: str + :keyword account_key: Encrypted storage key. + :paramtype account_key: ~azure.mgmt.databoxedge.v2019_07_01.models.AsymmetricEncryptedSecret + :keyword connection_string: Connection string for the storage account. Use this string if + username and account key are not specified. + :paramtype connection_string: str + :keyword ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible + values include: "Enabled", "Disabled". + :paramtype ssl_status: str or ~azure.mgmt.databoxedge.v2019_07_01.models.SSLStatus + :keyword blob_domain_name: Blob end point for private clouds. + :paramtype blob_domain_name: str + :keyword account_type: Required. Type of storage accessed on the storage account. Possible + values include: "GeneralPurposeStorage", "BlobStorage". + :paramtype account_type: str or ~azure.mgmt.databoxedge.v2019_07_01.models.AccountType + :keyword storage_account_id: Id of the storage account. + :paramtype storage_account_id: str + """ super(StorageAccountCredential, self).__init__(**kwargs) self.alias = alias self.user_name = user_name @@ -2536,6 +2952,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountCredentialList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2544,8 +2962,9 @@ def __init__( class SymmetricKey(msrest.serialization.Model): """Symmetric key for authentication. - :param connection_string: Connection string based on the symmetric key. - :type connection_string: ~azure.mgmt.databoxedge.v2019_07_01.models.AsymmetricEncryptedSecret + :ivar connection_string: Connection string based on the symmetric key. + :vartype connection_string: + ~azure.mgmt.databoxedge.v2019_07_01.models.AsymmetricEncryptedSecret """ _attribute_map = { @@ -2558,6 +2977,11 @@ def __init__( connection_string: Optional["AsymmetricEncryptedSecret"] = None, **kwargs ): + """ + :keyword connection_string: Connection string based on the symmetric key. + :paramtype connection_string: + ~azure.mgmt.databoxedge.v2019_07_01.models.AsymmetricEncryptedSecret + """ super(SymmetricKey, self).__init__(**kwargs) self.connection_string = connection_string @@ -2565,14 +2989,14 @@ def __init__( class TrackingInfo(msrest.serialization.Model): """Tracking courier information. - :param serial_number: Serial number of the device being tracked. - :type serial_number: str - :param carrier_name: Name of the carrier used in the delivery. - :type carrier_name: str - :param tracking_id: Tracking ID of the shipment. - :type tracking_id: str - :param tracking_url: Tracking URL of the shipment. - :type tracking_url: str + :ivar serial_number: Serial number of the device being tracked. + :vartype serial_number: str + :ivar carrier_name: Name of the carrier used in the delivery. + :vartype carrier_name: str + :ivar tracking_id: Tracking ID of the shipment. + :vartype tracking_id: str + :ivar tracking_url: Tracking URL of the shipment. + :vartype tracking_url: str """ _attribute_map = { @@ -2591,6 +3015,16 @@ def __init__( tracking_url: Optional[str] = None, **kwargs ): + """ + :keyword serial_number: Serial number of the device being tracked. + :paramtype serial_number: str + :keyword carrier_name: Name of the carrier used in the delivery. + :paramtype carrier_name: str + :keyword tracking_id: Tracking ID of the shipment. + :paramtype tracking_id: str + :keyword tracking_url: Tracking URL of the shipment. + :paramtype tracking_url: str + """ super(TrackingInfo, self).__init__(**kwargs) self.serial_number = serial_number self.carrier_name = carrier_name @@ -2623,6 +3057,8 @@ def __init__( self, **kwargs ): + """ + """ super(TriggerList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2670,6 +3106,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateDownloadProgress, self).__init__(**kwargs) self.download_phase = None self.percent_complete = None @@ -2708,6 +3146,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateInstallProgress, self).__init__(**kwargs) self.percent_complete = None self.number_of_updates_to_install = None @@ -2725,15 +3165,15 @@ class UpdateSummary(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param device_version_number: The current version of the device in format: 1.2.17312.13.",. - :type device_version_number: str - :param friendly_device_version_name: The current version of the device in text format. - :type friendly_device_version_name: str - :param device_last_scanned_date_time: The last time when a scan was done on the device. - :type device_last_scanned_date_time: ~datetime.datetime - :param last_completed_scan_job_date_time: The time when the last scan job was completed + :ivar device_version_number: The current version of the device in format: 1.2.17312.13.",. + :vartype device_version_number: str + :ivar friendly_device_version_name: The current version of the device in text format. + :vartype friendly_device_version_name: str + :ivar device_last_scanned_date_time: The last time when a scan was done on the device. + :vartype device_last_scanned_date_time: ~datetime.datetime + :ivar last_completed_scan_job_date_time: The time when the last scan job was completed (success/cancelled/failed) on the appliance. - :type last_completed_scan_job_date_time: ~datetime.datetime + :vartype last_completed_scan_job_date_time: ~datetime.datetime :ivar last_completed_download_job_date_time: The time when the last Download job was completed (success/cancelled/failed) on the appliance. :vartype last_completed_download_job_date_time: ~datetime.datetime @@ -2822,6 +3262,17 @@ def __init__( last_completed_scan_job_date_time: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword device_version_number: The current version of the device in format: 1.2.17312.13.",. + :paramtype device_version_number: str + :keyword friendly_device_version_name: The current version of the device in text format. + :paramtype friendly_device_version_name: str + :keyword device_last_scanned_date_time: The last time when a scan was done on the device. + :paramtype device_last_scanned_date_time: ~datetime.datetime + :keyword last_completed_scan_job_date_time: The time when the last scan job was completed + (success/cancelled/failed) on the appliance. + :paramtype last_completed_scan_job_date_time: ~datetime.datetime + """ super(UpdateSummary, self).__init__(**kwargs) self.device_version_number = device_version_number self.friendly_device_version_name = friendly_device_version_name @@ -2847,11 +3298,12 @@ class UploadCertificateRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param authentication_type: The authentication type. Possible values include: "Invalid", + :ivar authentication_type: The authentication type. Possible values include: "Invalid", "AzureActiveDirectory". - :type authentication_type: str or ~azure.mgmt.databoxedge.v2019_07_01.models.AuthenticationType - :param certificate: Required. The base64 encoded certificate raw data. - :type certificate: str + :vartype authentication_type: str or + ~azure.mgmt.databoxedge.v2019_07_01.models.AuthenticationType + :ivar certificate: Required. The base64 encoded certificate raw data. + :vartype certificate: str """ _validation = { @@ -2870,6 +3322,14 @@ def __init__( authentication_type: Optional[Union[str, "AuthenticationType"]] = None, **kwargs ): + """ + :keyword authentication_type: The authentication type. Possible values include: "Invalid", + "AzureActiveDirectory". + :paramtype authentication_type: str or + ~azure.mgmt.databoxedge.v2019_07_01.models.AuthenticationType + :keyword certificate: Required. The base64 encoded certificate raw data. + :paramtype certificate: str + """ super(UploadCertificateRequest, self).__init__(**kwargs) self.authentication_type = authentication_type self.certificate = certificate @@ -2880,23 +3340,23 @@ class UploadCertificateResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param auth_type: Specifies authentication type. Possible values include: "Invalid", + :ivar auth_type: Specifies authentication type. Possible values include: "Invalid", "AzureActiveDirectory". - :type auth_type: str or ~azure.mgmt.databoxedge.v2019_07_01.models.AuthenticationType - :param resource_id: Required. The resource ID of the Data Box Edge/Gateway device. - :type resource_id: str - :param aad_authority: Required. Azure Active Directory tenant authority. - :type aad_authority: str - :param aad_tenant_id: Required. Azure Active Directory tenant ID. - :type aad_tenant_id: str - :param service_principal_client_id: Required. Azure Active Directory service principal client + :vartype auth_type: str or ~azure.mgmt.databoxedge.v2019_07_01.models.AuthenticationType + :ivar resource_id: Required. The resource ID of the Data Box Edge/Gateway device. + :vartype resource_id: str + :ivar aad_authority: Required. Azure Active Directory tenant authority. + :vartype aad_authority: str + :ivar aad_tenant_id: Required. Azure Active Directory tenant ID. + :vartype aad_tenant_id: str + :ivar service_principal_client_id: Required. Azure Active Directory service principal client ID. - :type service_principal_client_id: str - :param service_principal_object_id: Required. Azure Active Directory service principal object + :vartype service_principal_client_id: str + :ivar service_principal_object_id: Required. Azure Active Directory service principal object ID. - :type service_principal_object_id: str - :param azure_management_endpoint_audience: Required. The azure management endpoint audience. - :type azure_management_endpoint_audience: str + :vartype service_principal_object_id: str + :ivar azure_management_endpoint_audience: Required. The azure management endpoint audience. + :vartype azure_management_endpoint_audience: str """ _validation = { @@ -2930,6 +3390,25 @@ def __init__( auth_type: Optional[Union[str, "AuthenticationType"]] = None, **kwargs ): + """ + :keyword auth_type: Specifies authentication type. Possible values include: "Invalid", + "AzureActiveDirectory". + :paramtype auth_type: str or ~azure.mgmt.databoxedge.v2019_07_01.models.AuthenticationType + :keyword resource_id: Required. The resource ID of the Data Box Edge/Gateway device. + :paramtype resource_id: str + :keyword aad_authority: Required. Azure Active Directory tenant authority. + :paramtype aad_authority: str + :keyword aad_tenant_id: Required. Azure Active Directory tenant ID. + :paramtype aad_tenant_id: str + :keyword service_principal_client_id: Required. Azure Active Directory service principal client + ID. + :paramtype service_principal_client_id: str + :keyword service_principal_object_id: Required. Azure Active Directory service principal object + ID. + :paramtype service_principal_object_id: str + :keyword azure_management_endpoint_audience: Required. The azure management endpoint audience. + :paramtype azure_management_endpoint_audience: str + """ super(UploadCertificateResponse, self).__init__(**kwargs) self.auth_type = auth_type self.resource_id = resource_id @@ -2951,11 +3430,12 @@ class User(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param encrypted_password: The password details. - :type encrypted_password: ~azure.mgmt.databoxedge.v2019_07_01.models.AsymmetricEncryptedSecret - :param share_access_rights: List of shares that the user has rights on. This field should not - be specified during user creation. - :type share_access_rights: list[~azure.mgmt.databoxedge.v2019_07_01.models.ShareAccessRight] + :ivar encrypted_password: The password details. + :vartype encrypted_password: + ~azure.mgmt.databoxedge.v2019_07_01.models.AsymmetricEncryptedSecret + :ivar share_access_rights: List of shares that the user has rights on. This field should not be + specified during user creation. + :vartype share_access_rights: list[~azure.mgmt.databoxedge.v2019_07_01.models.ShareAccessRight] """ _validation = { @@ -2979,6 +3459,15 @@ def __init__( share_access_rights: Optional[List["ShareAccessRight"]] = None, **kwargs ): + """ + :keyword encrypted_password: The password details. + :paramtype encrypted_password: + ~azure.mgmt.databoxedge.v2019_07_01.models.AsymmetricEncryptedSecret + :keyword share_access_rights: List of shares that the user has rights on. This field should not + be specified during user creation. + :paramtype share_access_rights: + list[~azure.mgmt.databoxedge.v2019_07_01.models.ShareAccessRight] + """ super(User, self).__init__(**kwargs) self.encrypted_password = encrypted_password self.share_access_rights = share_access_rights @@ -2989,11 +3478,11 @@ class UserAccessRight(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param user_id: Required. User ID (already existing in the device). - :type user_id: str - :param access_type: Required. Type of access to be allowed for the user. Possible values + :ivar user_id: Required. User ID (already existing in the device). + :vartype user_id: str + :ivar access_type: Required. Type of access to be allowed for the user. Possible values include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2019_07_01.models.ShareAccessType + :vartype access_type: str or ~azure.mgmt.databoxedge.v2019_07_01.models.ShareAccessType """ _validation = { @@ -3013,6 +3502,13 @@ def __init__( access_type: Union[str, "ShareAccessType"], **kwargs ): + """ + :keyword user_id: Required. User ID (already existing in the device). + :paramtype user_id: str + :keyword access_type: Required. Type of access to be allowed for the user. Possible values + include: "Change", "Read", "Custom". + :paramtype access_type: str or ~azure.mgmt.databoxedge.v2019_07_01.models.ShareAccessType + """ super(UserAccessRight, self).__init__(**kwargs) self.user_id = user_id self.access_type = access_type @@ -3043,6 +3539,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserList, self).__init__(**kwargs) self.value = None self.next_link = None diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_alerts_operations.py index a9186ae3352d..ebec70811da2 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_alerts_operations.py @@ -5,23 +5,97 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AlertsOperations(object): """AlertsOperations operations. @@ -45,13 +119,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AlertList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.AlertList"]: """Gets all the alerts for a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -68,36 +142,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AlertList', pipeline_response) + deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,19 +186,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Alert" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Alert": """Gets an alert by name. Gets an alert by name. @@ -148,28 +220,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,4 +245,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_bandwidth_schedules_operations.py index 2d59ed718fa0..e5098e8f1a4f 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_bandwidth_schedules_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class BandwidthSchedulesOperations(object): """BandwidthSchedulesOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BandwidthSchedulesList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.BandwidthSchedulesList"]: """Gets all the bandwidth schedules for a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -61,8 +219,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BandwidthSchedulesList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.BandwidthSchedulesList] + :return: An iterator like instance of either BandwidthSchedulesList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.BandwidthSchedulesList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedulesList"] @@ -70,36 +230,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BandwidthSchedulesList', pipeline_response) + deserialized = self._deserialize("BandwidthSchedulesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,19 +274,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BandwidthSchedule" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.BandwidthSchedule": """Gets the properties of the specified bandwidth schedule. :param device_name: The device name. @@ -148,28 +306,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,49 +331,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.BandwidthSchedule" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.BandwidthSchedule"] + device_name: str, + name: str, + resource_group_name: str, + parameters: "_models.BandwidthSchedule", + **kwargs: Any + ) -> Optional["_models.BandwidthSchedule"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BandwidthSchedule"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BandwidthSchedule') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BandwidthSchedule') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -241,17 +380,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.BandwidthSchedule" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BandwidthSchedule"] + device_name: str, + name: str, + resource_group_name: str, + parameters: "_models.BandwidthSchedule", + **kwargs: Any + ) -> LROPoller["_models.BandwidthSchedule"]: """Creates or updates a bandwidth schedule. :param device_name: The device name. @@ -264,15 +405,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.databoxedge.v2019_07_01.models.BandwidthSchedule :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either BandwidthSchedule or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_07_01.models.BandwidthSchedule] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BandwidthSchedule or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_07_01.models.BandwidthSchedule] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedule"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +431,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BandwidthSchedule', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -318,43 +457,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -367,14 +496,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the specified bandwidth schedule. :param device_name: The device name. @@ -385,15 +515,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -408,22 +540,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -435,4 +559,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_devices_operations.py index e1c98ec9a63f..a926c584b899 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_devices_operations.py @@ -5,25 +5,556 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_subscription_request( + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_download_updates_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_extended_information_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_install_updates_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_network_settings_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/networkSettings/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_scan_for_updates_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_security_settings_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_update_summary_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_upload_certificate_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/uploadCertificate') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class DevicesOperations(object): """DevicesOperations operations. @@ -47,20 +578,22 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DataBoxEdgeDeviceList"] + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.DataBoxEdgeDeviceList"]: """Gets all the Data Box Edge/Data Box Gateway devices in a subscription. :param expand: Specify $expand=details to populate additional fields related to the resource or Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -68,36 +601,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,18 +643,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DataBoxEdgeDeviceList"] + resource_group_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.DataBoxEdgeDeviceList"]: """Gets all the Data Box Edge/Data Box Gateway devices in a resource group. :param resource_group_name: The resource group name. @@ -135,8 +664,10 @@ def list_by_resource_group( Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -144,37 +675,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -192,18 +719,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDevice" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DataBoxEdgeDevice": """Gets the properties of the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -220,27 +748,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -254,47 +772,38 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - resource_group_name, # type: str - data_box_edge_device, # type: "_models.DataBoxEdgeDevice" - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDevice" + device_name: str, + resource_group_name: str, + data_box_edge_device: "_models.DataBoxEdgeDevice", + **kwargs: Any + ) -> "_models.DataBoxEdgeDevice": cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -308,16 +817,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - resource_group_name, # type: str - data_box_edge_device, # type: "_models.DataBoxEdgeDevice" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DataBoxEdgeDevice"] + device_name: str, + resource_group_name: str, + data_box_edge_device: "_models.DataBoxEdgeDevice", + **kwargs: Any + ) -> LROPoller["_models.DataBoxEdgeDevice"]: """Creates or updates a Data Box Edge/Data Box Gateway resource. :param device_name: The device name. @@ -328,15 +839,20 @@ def begin_create_or_update( :type data_box_edge_device: ~azure.mgmt.databoxedge.v2019_07_01.models.DataBoxEdgeDevice :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DataBoxEdgeDevice or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_07_01.models.DataBoxEdgeDevice] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DataBoxEdgeDevice or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_07_01.models.DataBoxEdgeDevice] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] lro_delay = kwargs.pop( 'polling_interval', @@ -348,27 +864,21 @@ def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, data_box_edge_device=data_box_edge_device, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DataBoxEdgeDevice', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -380,41 +890,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore def _delete_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -427,13 +927,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -442,15 +943,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -464,21 +967,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -490,16 +986,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + @distributed_trace def update( self, - device_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.DataBoxEdgeDevicePatch" - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDevice" + device_name: str, + resource_group_name: str, + parameters: "_models.DataBoxEdgeDevicePatch", + **kwargs: Any + ) -> "_models.DataBoxEdgeDevice": """Modifies a Data Box Edge/Data Box Gateway resource. :param device_name: The device name. @@ -518,32 +1015,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') + + request = build_update_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -557,41 +1044,32 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + def _download_updates_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._download_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_download_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._download_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -604,13 +1082,14 @@ def _download_updates_initial( _download_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + + @distributed_trace def begin_download_updates( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Downloads the updates on a Data Box Edge/Data Box Gateway device. Downloads the updates on a Data Box Edge/Data Box Gateway device. @@ -621,15 +1100,17 @@ def begin_download_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -643,21 +1124,14 @@ def begin_download_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -669,15 +1143,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_download_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + @distributed_trace def get_extended_information( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDeviceExtendedInfo" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DataBoxEdgeDeviceExtendedInfo": """Gets additional information for the specified Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -694,27 +1169,17 @@ def get_extended_information( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get_extended_information.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_extended_information_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_extended_information.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -728,41 +1193,32 @@ def get_extended_information( return cls(pipeline_response, deserialized, {}) return deserialized + get_extended_information.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation'} # type: ignore + def _install_updates_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._install_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_install_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._install_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -775,13 +1231,14 @@ def _install_updates_initial( _install_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + + @distributed_trace def begin_install_updates( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Installs the updates on the Data Box Edge/Data Box Gateway device. Installs the updates on the Data Box Edge/Data Box Gateway device. @@ -792,15 +1249,17 @@ def begin_install_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -814,21 +1273,14 @@ def begin_install_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -840,15 +1292,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_install_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + @distributed_trace def get_network_settings( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.NetworkSettings" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.NetworkSettings": """Gets the network settings of the specified Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -865,27 +1318,17 @@ def get_network_settings( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get_network_settings.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_network_settings_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_network_settings.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -899,41 +1342,32 @@ def get_network_settings( return cls(pipeline_response, deserialized, {}) return deserialized + get_network_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/networkSettings/default'} # type: ignore + def _scan_for_updates_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._scan_for_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_scan_for_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._scan_for_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -946,13 +1380,14 @@ def _scan_for_updates_initial( _scan_for_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore + + @distributed_trace def begin_scan_for_updates( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Scans for updates on a Data Box Edge/Data Box Gateway device. Scans for updates on a Data Box Edge/Data Box Gateway device. @@ -963,15 +1398,17 @@ def begin_scan_for_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -985,21 +1422,14 @@ def begin_scan_for_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1011,47 +1441,37 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_scan_for_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore def _create_or_update_security_settings_initial( self, - device_name, # type: str - resource_group_name, # type: str - security_settings, # type: "_models.SecuritySettings" - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + security_settings: "_models.SecuritySettings", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_security_settings_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(security_settings, 'SecuritySettings') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_security_settings_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_security_settings_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(security_settings, 'SecuritySettings') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1064,14 +1484,15 @@ def _create_or_update_security_settings_initial( _create_or_update_security_settings_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + + @distributed_trace def begin_create_or_update_security_settings( self, - device_name, # type: str - resource_group_name, # type: str - security_settings, # type: "_models.SecuritySettings" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + security_settings: "_models.SecuritySettings", + **kwargs: Any + ) -> LROPoller[None]: """Updates the security settings on a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -1082,15 +1503,18 @@ def begin_create_or_update_security_settings( :type security_settings: ~azure.mgmt.databoxedge.v2019_07_01.models.SecuritySettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1102,24 +1526,18 @@ def begin_create_or_update_security_settings( device_name=device_name, resource_group_name=resource_group_name, security_settings=security_settings, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1131,16 +1549,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_security_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + @distributed_trace def get_update_summary( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.UpdateSummary" - """Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.UpdateSummary": + """Gets information about the availability of updates based on the last scan of the device. It + also gets information about any ongoing download or install jobs on the device. Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. @@ -1159,27 +1579,17 @@ def get_update_summary( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get_update_summary.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_update_summary_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_update_summary.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1193,16 +1603,18 @@ def get_update_summary( return cls(pipeline_response, deserialized, {}) return deserialized + get_update_summary.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default'} # type: ignore + + @distributed_trace def upload_certificate( self, - device_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.UploadCertificateRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.UploadCertificateResponse" + device_name: str, + resource_group_name: str, + parameters: "_models.UploadCertificateRequest", + **kwargs: Any + ) -> "_models.UploadCertificateResponse": """Uploads registration certificate for the device. :param device_name: The device name. @@ -1221,32 +1633,22 @@ def upload_certificate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.upload_certificate.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'UploadCertificateRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_upload_certificate_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.upload_certificate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'UploadCertificateRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1260,4 +1662,6 @@ def upload_certificate( return cls(pipeline_response, deserialized, {}) return deserialized + upload_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/uploadCertificate'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_jobs_operations.py index 561dd867f1e6..d683cf5d049c 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_jobs_operations.py @@ -5,22 +5,61 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class JobsOperations(object): """JobsOperations operations. @@ -44,14 +83,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Job" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Job": """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. @@ -72,28 +111,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -107,4 +136,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_nodes_operations.py index d27783f71dc1..07223ea97f99 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_nodes_operations.py @@ -5,23 +5,60 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/nodes') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class NodesOperations(object): """NodesOperations operations. @@ -45,13 +82,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.NodeList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.NodeList"]: """Gets all the nodes currently configured under this Data Box Edge device. :param device_name: The device name. @@ -68,36 +105,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('NodeList', pipeline_response) + deserialized = self._deserialize("NodeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,6 +149,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_operations.py index 175e9a141ede..f5fe6f04e271 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.DataBoxEdge/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,11 +72,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationsList"] + **kwargs: Any + ) -> Iterable["_models.OperationsList"]: """List all the supported operations. List all the supported operations. @@ -64,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationsList', pipeline_response) + deserialized = self._deserialize("OperationsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -105,6 +129,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_operations_status_operations.py index e67f78f60dad..706fd60c271e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_operations_status_operations.py @@ -5,22 +5,61 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/operationsStatus/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class OperationsStatusOperations(object): """OperationsStatusOperations operations. @@ -44,14 +83,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Job" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Job": """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. @@ -72,28 +111,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -107,4 +136,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/operationsStatus/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_orders_operations.py index fa7e56a2dcb7..3e3d588439f5 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_orders_operations.py @@ -5,25 +5,177 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class OrdersOperations(object): """OrdersOperations operations. @@ -47,13 +199,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OrderList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.OrderList"]: """Lists all the orders related to a Data Box Edge/Data Box Gateway device. Lists all the orders related to a Data Box Edge/Data Box Gateway device. @@ -72,36 +224,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OrderList', pipeline_response) + deserialized = self._deserialize("OrderList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,18 +268,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Order" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Order": """Gets a specific order by name. Gets a specific order by name. @@ -149,27 +299,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,47 +323,38 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - resource_group_name, # type: str - order, # type: "_models.Order" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Order"] + device_name: str, + resource_group_name: str, + order: "_models.Order", + **kwargs: Any + ) -> Optional["_models.Order"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Order"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(order, 'Order') + + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(order, 'Order') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,16 +370,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - resource_group_name, # type: str - order, # type: "_models.Order" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Order"] + device_name: str, + resource_group_name: str, + order: "_models.Order", + **kwargs: Any + ) -> LROPoller["_models.Order"]: """Creates or updates an order. Creates or updates an order. @@ -261,15 +394,18 @@ def begin_create_or_update( :type order: ~azure.mgmt.databoxedge.v2019_07_01.models.Order :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Order or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_07_01.models.Order] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Order"] lro_delay = kwargs.pop( 'polling_interval', @@ -281,27 +417,21 @@ def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, order=order, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Order', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -313,41 +443,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore def _delete_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -360,13 +480,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the order related to the device. Deletes the order related to the device. @@ -377,15 +498,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -399,21 +522,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -425,4 +541,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_roles_operations.py index 2c7f33f1d31e..28422971ecf9 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_roles_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class RolesOperations(object): """RolesOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RoleList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.RoleList"]: """Lists all the roles configured in a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -70,36 +228,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RoleList', pipeline_response) + deserialized = self._deserialize("RoleList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,19 +272,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Role" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Role": """Gets a specific role by name. :param device_name: The device name. @@ -148,28 +304,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,49 +329,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - role, # type: "_models.Role" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Role"] + device_name: str, + name: str, + resource_group_name: str, + role: "_models.Role", + **kwargs: Any + ) -> Optional["_models.Role"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Role"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(role, 'Role') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(role, 'Role') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -241,17 +378,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - role, # type: "_models.Role" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Role"] + device_name: str, + name: str, + resource_group_name: str, + role: "_models.Role", + **kwargs: Any + ) -> LROPoller["_models.Role"]: """Create or update a role. :param device_name: The device name. @@ -264,15 +403,18 @@ def begin_create_or_update( :type role: ~azure.mgmt.databoxedge.v2019_07_01.models.Role :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Role or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_07_01.models.Role] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Role"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +427,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, role=role, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Role', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -318,43 +453,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -367,14 +492,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the role on the device. :param device_name: The device name. @@ -385,15 +511,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -408,22 +536,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -435,4 +555,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_shares_operations.py index dc6a461b1808..efe880a2c66f 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_shares_operations.py @@ -5,25 +5,220 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_refresh_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SharesOperations(object): """SharesOperations operations. @@ -47,13 +242,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ShareList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ShareList"]: """Lists all the shares in a Data Box Edge/Data Box Gateway device. Lists all the shares in a Data Box Edge/Data Box Gateway device. @@ -72,36 +267,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ShareList', pipeline_response) + deserialized = self._deserialize("ShareList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +311,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Share" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Share": """Gets a share by name. Gets a share by name. @@ -152,28 +345,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -187,49 +370,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - share, # type: "_models.Share" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Share"] + device_name: str, + name: str, + resource_group_name: str, + share: "_models.Share", + **kwargs: Any + ) -> Optional["_models.Share"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Share"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(share, 'Share') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(share, 'Share') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,17 +419,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - share, # type: "_models.Share" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Share"] + device_name: str, + name: str, + resource_group_name: str, + share: "_models.Share", + **kwargs: Any + ) -> LROPoller["_models.Share"]: """Creates a new share or updates an existing share on the device. Creates a new share or updates an existing share on the device. @@ -270,15 +446,18 @@ def begin_create_or_update( :type share: ~azure.mgmt.databoxedge.v2019_07_01.models.Share :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Share or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_07_01.models.Share] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Share"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +470,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, share=share, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Share', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -324,43 +496,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,14 +535,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the share on the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -391,15 +554,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -414,22 +579,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -441,43 +598,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore def _refresh_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -490,14 +637,15 @@ def _refresh_initial( _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore + + @distributed_trace def begin_refresh( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Refreshes the share metadata with the data from the cloud. Refreshes the share metadata with the data from the cloud. @@ -510,15 +658,17 @@ def begin_refresh( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -533,22 +683,14 @@ def begin_refresh( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -560,4 +702,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_storage_account_credentials_operations.py index 5f5eefec1248..ab7ebb90ab8b 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_storage_account_credentials_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class StorageAccountCredentialsOperations(object): """StorageAccountCredentialsOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountCredentialList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountCredentialList"]: """Gets all the storage account credentials in a Data Box Edge/Data Box Gateway device. Gets all the storage account credentials in a Data Box Edge/Data Box Gateway device. @@ -63,8 +221,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountCredentialList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.StorageAccountCredentialList] + :return: An iterator like instance of either StorageAccountCredentialList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2019_07_01.models.StorageAccountCredentialList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredentialList"] @@ -72,36 +232,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('StorageAccountCredentialList', pipeline_response) + deserialized = self._deserialize("StorageAccountCredentialList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +276,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountCredential" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.StorageAccountCredential": """Gets the properties of the specified storage account credential. :param device_name: The device name. @@ -150,28 +308,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,49 +333,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - storage_account_credential, # type: "_models.StorageAccountCredential" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageAccountCredential"] + device_name: str, + name: str, + resource_group_name: str, + storage_account_credential: "_models.StorageAccountCredential", + **kwargs: Any + ) -> Optional["_models.StorageAccountCredential"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccountCredential"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(storage_account_credential, 'StorageAccountCredential') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_account_credential, 'StorageAccountCredential') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -243,17 +382,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - storage_account_credential, # type: "_models.StorageAccountCredential" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageAccountCredential"] + device_name: str, + name: str, + resource_group_name: str, + storage_account_credential: "_models.StorageAccountCredential", + **kwargs: Any + ) -> LROPoller["_models.StorageAccountCredential"]: """Creates or updates the storage account credential. :param device_name: The device name. @@ -263,18 +404,24 @@ def begin_create_or_update( :param resource_group_name: The resource group name. :type resource_group_name: str :param storage_account_credential: The storage account credential. - :type storage_account_credential: ~azure.mgmt.databoxedge.v2019_07_01.models.StorageAccountCredential + :type storage_account_credential: + ~azure.mgmt.databoxedge.v2019_07_01.models.StorageAccountCredential :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either StorageAccountCredential or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_07_01.models.StorageAccountCredential] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either StorageAccountCredential or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_07_01.models.StorageAccountCredential] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredential"] lro_delay = kwargs.pop( 'polling_interval', @@ -287,28 +434,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, storage_account_credential=storage_account_credential, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccountCredential', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -320,43 +460,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -369,14 +499,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the storage account credential. :param device_name: The device name. @@ -387,15 +518,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -410,22 +543,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -437,4 +562,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_triggers_operations.py index 9c2ed94ccc52..7d219e142cfc 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_triggers_operations.py @@ -5,25 +5,187 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class TriggersOperations(object): """TriggersOperations operations. @@ -47,14 +209,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.TriggerList"] + device_name: str, + resource_group_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.TriggerList"]: """Lists all the triggers configured in the device. :param device_name: The device name. @@ -74,38 +236,35 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TriggerList', pipeline_response) + deserialized = self._deserialize("TriggerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -123,19 +282,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Trigger" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Trigger": """Get a specific trigger by name. :param device_name: The device name. @@ -154,28 +314,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -189,49 +339,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - trigger, # type: "_models.Trigger" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Trigger"] + device_name: str, + name: str, + resource_group_name: str, + trigger: "_models.Trigger", + **kwargs: Any + ) -> Optional["_models.Trigger"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Trigger"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(trigger, 'Trigger') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(trigger, 'Trigger') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,17 +388,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - trigger, # type: "_models.Trigger" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Trigger"] + device_name: str, + name: str, + resource_group_name: str, + trigger: "_models.Trigger", + **kwargs: Any + ) -> LROPoller["_models.Trigger"]: """Creates or updates a trigger. :param device_name: Creates or updates a trigger. @@ -270,15 +413,18 @@ def begin_create_or_update( :type trigger: ~azure.mgmt.databoxedge.v2019_07_01.models.Trigger :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Trigger or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_07_01.models.Trigger] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Trigger"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +437,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, trigger=trigger, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Trigger', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -324,43 +463,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,14 +502,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the trigger on the gateway device. :param device_name: The device name. @@ -391,15 +521,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -414,22 +546,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -441,4 +565,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_users_operations.py index 6eea2a22d3d6..5f10fe9d9596 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_users_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class UsersOperations(object): """UsersOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UserList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.UserList"]: """Gets all the users registered on a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -70,36 +228,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('UserList', pipeline_response) + deserialized = self._deserialize("UserList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,19 +272,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.User" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.User": """Gets the properties of the specified user. :param device_name: The device name. @@ -148,28 +304,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,49 +329,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - user, # type: "_models.User" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.User"] + device_name: str, + name: str, + resource_group_name: str, + user: "_models.User", + **kwargs: Any + ) -> Optional["_models.User"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.User"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(user, 'User') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(user, 'User') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -241,17 +378,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - user, # type: "_models.User" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.User"] + device_name: str, + name: str, + resource_group_name: str, + user: "_models.User", + **kwargs: Any + ) -> LROPoller["_models.User"]: """Creates a new user or updates an existing user's information on a Data Box Edge/Data Box Gateway device. @@ -265,15 +404,18 @@ def begin_create_or_update( :type user: ~azure.mgmt.databoxedge.v2019_07_01.models.User :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either User or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_07_01.models.User] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.User"] lro_delay = kwargs.pop( 'polling_interval', @@ -286,28 +428,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, user=user, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('User', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -319,43 +454,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -368,14 +493,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the user on a databox edge/gateway device. :param device_name: The device name. @@ -386,15 +512,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -409,22 +537,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -436,4 +556,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/__init__.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/__init__.py index e63196b6b98f..577ebf317c02 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/__init__.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/__init__.py @@ -7,10 +7,12 @@ # -------------------------------------------------------------------------- from ._data_box_edge_management_client import DataBoxEdgeManagementClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['DataBoxEdgeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_configuration.py index 1e8ec7d68167..e59b6be611dd 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_configuration.py @@ -6,19 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential -VERSION = "unknown" class DataBoxEdgeManagementClientConfiguration(Configuration): """Configuration for DataBoxEdgeManagementClient. @@ -34,16 +33,15 @@ class DataBoxEdgeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -67,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_data_box_edge_management_client.py index 0af6918216f3..1ae02a000aad 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_data_box_edge_management_client.py @@ -6,39 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import DataBoxEdgeManagementClientConfiguration +from .operations import AlertsOperations, BandwidthSchedulesOperations, ContainersOperations, DevicesOperations, JobsOperations, NodesOperations, Operations, OperationsStatusOperations, OrdersOperations, RolesOperations, SharesOperations, SkusOperations, StorageAccountCredentialsOperations, StorageAccountsOperations, TriggersOperations, UsersOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import DataBoxEdgeManagementClientConfiguration -from .operations import Operations -from .operations import DevicesOperations -from .operations import AlertsOperations -from .operations import BandwidthSchedulesOperations -from .operations import JobsOperations -from .operations import NodesOperations -from .operations import OperationsStatusOperations -from .operations import OrdersOperations -from .operations import RolesOperations -from .operations import SharesOperations -from .operations import StorageAccountCredentialsOperations -from .operations import StorageAccountsOperations -from .operations import ContainersOperations -from .operations import TriggersOperations -from .operations import UsersOperations -from .operations import SkusOperations -from . import models - -class DataBoxEdgeManagementClient(object): +class DataBoxEdgeManagementClient: """The DataBoxEdge Client. :ivar operations: Operations operations @@ -48,13 +31,15 @@ class DataBoxEdgeManagementClient(object): :ivar alerts: AlertsOperations operations :vartype alerts: azure.mgmt.databoxedge.v2019_08_01.operations.AlertsOperations :ivar bandwidth_schedules: BandwidthSchedulesOperations operations - :vartype bandwidth_schedules: azure.mgmt.databoxedge.v2019_08_01.operations.BandwidthSchedulesOperations + :vartype bandwidth_schedules: + azure.mgmt.databoxedge.v2019_08_01.operations.BandwidthSchedulesOperations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.databoxedge.v2019_08_01.operations.JobsOperations :ivar nodes: NodesOperations operations :vartype nodes: azure.mgmt.databoxedge.v2019_08_01.operations.NodesOperations :ivar operations_status: OperationsStatusOperations operations - :vartype operations_status: azure.mgmt.databoxedge.v2019_08_01.operations.OperationsStatusOperations + :vartype operations_status: + azure.mgmt.databoxedge.v2019_08_01.operations.OperationsStatusOperations :ivar orders: OrdersOperations operations :vartype orders: azure.mgmt.databoxedge.v2019_08_01.operations.OrdersOperations :ivar roles: RolesOperations operations @@ -62,9 +47,11 @@ class DataBoxEdgeManagementClient(object): :ivar shares: SharesOperations operations :vartype shares: azure.mgmt.databoxedge.v2019_08_01.operations.SharesOperations :ivar storage_account_credentials: StorageAccountCredentialsOperations operations - :vartype storage_account_credentials: azure.mgmt.databoxedge.v2019_08_01.operations.StorageAccountCredentialsOperations + :vartype storage_account_credentials: + azure.mgmt.databoxedge.v2019_08_01.operations.StorageAccountCredentialsOperations :ivar storage_accounts: StorageAccountsOperations operations - :vartype storage_accounts: azure.mgmt.databoxedge.v2019_08_01.operations.StorageAccountsOperations + :vartype storage_accounts: + azure.mgmt.databoxedge.v2019_08_01.operations.StorageAccountsOperations :ivar containers: ContainersOperations operations :vartype containers: azure.mgmt.databoxedge.v2019_08_01.operations.ContainersOperations :ivar triggers: TriggersOperations operations @@ -77,78 +64,69 @@ class DataBoxEdgeManagementClient(object): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = DataBoxEdgeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = DataBoxEdgeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.orders = OrdersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.shares = SharesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.containers = ContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bandwidth_schedules = BandwidthSchedulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations_status = OperationsStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_account_credentials = StorageAccountCredentialsOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_metadata.json b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_metadata.json index df175d3bbf33..bdc71eb425fa 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_metadata.json +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_metadata.json @@ -5,13 +5,13 @@ "name": "DataBoxEdgeManagementClient", "filename": "_data_box_edge_management_client", "description": "The DataBoxEdge Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "operations": "Operations", diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_patch.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_vendor.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_version.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/__init__.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/__init__.py index c33d46ee91d8..f33cac1fd9b0 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/__init__.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._data_box_edge_management_client import DataBoxEdgeManagementClient __all__ = ['DataBoxEdgeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/_configuration.py index 4b87b6133392..aaeb3c29b4a3 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/_configuration.py @@ -10,13 +10,14 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class DataBoxEdgeManagementClientConfiguration(Configuration): """Configuration for DataBoxEdgeManagementClient. @@ -36,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -63,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/_data_box_edge_management_client.py index 478a535da5e8..b1207a6303c8 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/_data_box_edge_management_client.py @@ -6,37 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import DataBoxEdgeManagementClientConfiguration +from .operations import AlertsOperations, BandwidthSchedulesOperations, ContainersOperations, DevicesOperations, JobsOperations, NodesOperations, Operations, OperationsStatusOperations, OrdersOperations, RolesOperations, SharesOperations, SkusOperations, StorageAccountCredentialsOperations, StorageAccountsOperations, TriggersOperations, UsersOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import DataBoxEdgeManagementClientConfiguration -from .operations import Operations -from .operations import DevicesOperations -from .operations import AlertsOperations -from .operations import BandwidthSchedulesOperations -from .operations import JobsOperations -from .operations import NodesOperations -from .operations import OperationsStatusOperations -from .operations import OrdersOperations -from .operations import RolesOperations -from .operations import SharesOperations -from .operations import StorageAccountCredentialsOperations -from .operations import StorageAccountsOperations -from .operations import ContainersOperations -from .operations import TriggersOperations -from .operations import UsersOperations -from .operations import SkusOperations -from .. import models - - -class DataBoxEdgeManagementClient(object): +class DataBoxEdgeManagementClient: """The DataBoxEdge Client. :ivar operations: Operations operations @@ -46,13 +31,15 @@ class DataBoxEdgeManagementClient(object): :ivar alerts: AlertsOperations operations :vartype alerts: azure.mgmt.databoxedge.v2019_08_01.aio.operations.AlertsOperations :ivar bandwidth_schedules: BandwidthSchedulesOperations operations - :vartype bandwidth_schedules: azure.mgmt.databoxedge.v2019_08_01.aio.operations.BandwidthSchedulesOperations + :vartype bandwidth_schedules: + azure.mgmt.databoxedge.v2019_08_01.aio.operations.BandwidthSchedulesOperations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.databoxedge.v2019_08_01.aio.operations.JobsOperations :ivar nodes: NodesOperations operations :vartype nodes: azure.mgmt.databoxedge.v2019_08_01.aio.operations.NodesOperations :ivar operations_status: OperationsStatusOperations operations - :vartype operations_status: azure.mgmt.databoxedge.v2019_08_01.aio.operations.OperationsStatusOperations + :vartype operations_status: + azure.mgmt.databoxedge.v2019_08_01.aio.operations.OperationsStatusOperations :ivar orders: OrdersOperations operations :vartype orders: azure.mgmt.databoxedge.v2019_08_01.aio.operations.OrdersOperations :ivar roles: RolesOperations operations @@ -60,9 +47,11 @@ class DataBoxEdgeManagementClient(object): :ivar shares: SharesOperations operations :vartype shares: azure.mgmt.databoxedge.v2019_08_01.aio.operations.SharesOperations :ivar storage_account_credentials: StorageAccountCredentialsOperations operations - :vartype storage_account_credentials: azure.mgmt.databoxedge.v2019_08_01.aio.operations.StorageAccountCredentialsOperations + :vartype storage_account_credentials: + azure.mgmt.databoxedge.v2019_08_01.aio.operations.StorageAccountCredentialsOperations :ivar storage_accounts: StorageAccountsOperations operations - :vartype storage_accounts: azure.mgmt.databoxedge.v2019_08_01.aio.operations.StorageAccountsOperations + :vartype storage_accounts: + azure.mgmt.databoxedge.v2019_08_01.aio.operations.StorageAccountsOperations :ivar containers: ContainersOperations operations :vartype containers: azure.mgmt.databoxedge.v2019_08_01.aio.operations.ContainersOperations :ivar triggers: TriggersOperations operations @@ -75,76 +64,69 @@ class DataBoxEdgeManagementClient(object): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = DataBoxEdgeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = DataBoxEdgeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bandwidth_schedules = BandwidthSchedulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations_status = OperationsStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_account_credentials = StorageAccountCredentialsOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.orders = OrdersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.shares = SharesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.containers = ContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/_patch.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_alerts_operations.py index a2fb12fcaa76..c95878a06af3 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_alerts_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._alerts_operations import build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,11 +46,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.AlertList"]: """Gets all the alerts for a Data Box Edge/Data Box Gateway device. @@ -55,7 +61,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AlertList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.AlertList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.AlertList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertList"] @@ -63,36 +70,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AlertList', pipeline_response) + deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,17 +114,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Alert": """Gets an alert by name. @@ -142,28 +148,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,4 +173,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_bandwidth_schedules_operations.py index ad93fee72241..743e8d793ac5 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_bandwidth_schedules_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._bandwidth_schedules_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.BandwidthSchedulesList"]: """Gets all the bandwidth schedules for a Data Box Edge/Data Box Gateway device. @@ -56,8 +62,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BandwidthSchedulesList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.BandwidthSchedulesList] + :return: An iterator like instance of either BandwidthSchedulesList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.BandwidthSchedulesList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedulesList"] @@ -65,36 +73,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BandwidthSchedulesList', pipeline_response) + deserialized = self._deserialize("BandwidthSchedulesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,17 +117,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.BandwidthSchedule": """Gets the properties of the specified bandwidth schedule. @@ -142,28 +149,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,48 +174,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, parameters: "_models.BandwidthSchedule", - **kwargs + **kwargs: Any ) -> Optional["_models.BandwidthSchedule"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BandwidthSchedule"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BandwidthSchedule') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BandwidthSchedule') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -234,15 +223,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, parameters: "_models.BandwidthSchedule", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.BandwidthSchedule"]: """Creates or updates a bandwidth schedule. @@ -256,15 +248,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.databoxedge.v2019_08_01.models.BandwidthSchedule :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BandwidthSchedule or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_08_01.models.BandwidthSchedule] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BandwidthSchedule or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_08_01.models.BandwidthSchedule] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedule"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,28 +274,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BandwidthSchedule', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -310,6 +300,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore async def _delete_initial( @@ -317,35 +308,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -358,12 +339,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the specified bandwidth schedule. @@ -375,15 +358,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -398,22 +383,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -425,4 +402,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_containers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_containers_operations.py index 1ed42763c01f..e11baa91d992 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_containers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_containers_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._containers_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_storage_account_request, build_refresh_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_storage_account( self, device_name: str, storage_account_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ContainerList"]: """Lists all the containers of a storage Account in a Data Box Edge/Data Box Gateway device. @@ -62,7 +68,8 @@ def list_by_storage_account( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ContainerList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.ContainerList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.ContainerList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerList"] @@ -70,37 +77,35 @@ def list_by_storage_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_storage_account.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_account_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_storage_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_account_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ContainerList', pipeline_response) + deserialized = self._deserialize("ContainerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,18 +123,20 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_storage_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, storage_account_name: str, container_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Container": """Gets a container by name. @@ -153,29 +160,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -189,8 +186,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, @@ -198,41 +197,31 @@ async def _create_or_update_initial( container_name: str, resource_group_name: str, container: "_models.Container", - **kwargs + **kwargs: Any ) -> Optional["_models.Container"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Container"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(container, 'Container') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(container, 'Container') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -248,8 +237,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, @@ -257,7 +249,7 @@ async def begin_create_or_update( container_name: str, resource_group_name: str, container: "_models.Container", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Container"]: """Creates a new container or updates an existing container on the device. @@ -275,15 +267,20 @@ async def begin_create_or_update( :type container: ~azure.mgmt.databoxedge.v2019_08_01.models.Container :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Container or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_08_01.models.Container] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Container or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_08_01.models.Container] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Container"] lro_delay = kwargs.pop( 'polling_interval', @@ -297,29 +294,21 @@ async def begin_create_or_update( container_name=container_name, resource_group_name=resource_group_name, container=container, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Container', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -331,6 +320,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore async def _delete_initial( @@ -339,36 +329,26 @@ async def _delete_initial( storage_account_name: str, container_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -381,13 +361,15 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, storage_account_name: str, container_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the container on the Data Box Edge/Data Box Gateway device. @@ -401,15 +383,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -425,23 +409,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -453,6 +428,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore async def _refresh_initial( @@ -461,36 +437,26 @@ async def _refresh_initial( storage_account_name: str, container_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -503,13 +469,15 @@ async def _refresh_initial( _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh'} # type: ignore + + @distributed_trace_async async def begin_refresh( self, device_name: str, storage_account_name: str, container_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Refreshes the container metadata with the data from the cloud. @@ -525,15 +493,17 @@ async def begin_refresh( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -549,23 +519,14 @@ async def begin_refresh( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -577,4 +538,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_devices_operations.py index 3bccba17df82..239aa967a1a2 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_devices_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._devices_operations import build_create_or_update_request_initial, build_create_or_update_security_settings_request_initial, build_delete_request_initial, build_download_updates_request_initial, build_get_extended_information_request, build_get_network_settings_request, build_get_request, build_get_update_summary_request, build_install_updates_request_initial, build_list_by_resource_group_request, build_list_by_subscription_request, build_scan_for_updates_request_initial, build_update_request, build_upload_certificate_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,10 +48,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, expand: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.DataBoxEdgeDeviceList"]: """Gets all the Data Box Edge/Data Box Gateway devices in a subscription. @@ -54,8 +60,10 @@ def list_by_subscription( Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -63,36 +71,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,16 +113,18 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, expand: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.DataBoxEdgeDeviceList"]: """Gets all the Data Box Edge/Data Box Gateway devices in a resource group. @@ -129,8 +134,10 @@ def list_by_resource_group( Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -138,37 +145,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -186,16 +189,18 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDevice": """Gets the properties of the Data Box Edge/Data Box Gateway device. @@ -213,27 +218,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,46 +242,38 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, resource_group_name: str, data_box_edge_device: "_models.DataBoxEdgeDevice", - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDevice": cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') + + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -300,14 +287,17 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, resource_group_name: str, data_box_edge_device: "_models.DataBoxEdgeDevice", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.DataBoxEdgeDevice"]: """Creates or updates a Data Box Edge/Data Box Gateway resource. @@ -319,15 +309,20 @@ async def begin_create_or_update( :type data_box_edge_device: ~azure.mgmt.databoxedge.v2019_08_01.models.DataBoxEdgeDevice :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DataBoxEdgeDevice or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_08_01.models.DataBoxEdgeDevice] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DataBoxEdgeDevice or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_08_01.models.DataBoxEdgeDevice] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] lro_delay = kwargs.pop( 'polling_interval', @@ -339,27 +334,21 @@ async def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, data_box_edge_device=data_box_edge_device, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DataBoxEdgeDevice', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -371,40 +360,31 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore async def _delete_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -417,11 +397,13 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the Data Box Edge/Data Box Gateway device. @@ -431,15 +413,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -453,21 +437,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -479,14 +456,16 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + @distributed_trace_async async def update( self, device_name: str, resource_group_name: str, parameters: "_models.DataBoxEdgeDevicePatch", - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDevice": """Modifies a Data Box Edge/Data Box Gateway resource. @@ -506,32 +485,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') + + request = build_update_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -545,40 +514,32 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + async def _download_updates_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self._download_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_download_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._download_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -591,11 +552,13 @@ async def _download_updates_initial( _download_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + + @distributed_trace_async async def begin_download_updates( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Downloads the updates on a Data Box Edge/Data Box Gateway device. @@ -607,15 +570,17 @@ async def begin_download_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -629,21 +594,14 @@ async def begin_download_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -655,13 +613,15 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_download_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + @distributed_trace_async async def get_extended_information( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDeviceExtendedInfo": """Gets additional information for the specified Data Box Edge/Data Box Gateway device. @@ -679,27 +639,17 @@ async def get_extended_information( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get_extended_information.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_extended_information_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_extended_information.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -713,40 +663,32 @@ async def get_extended_information( return cls(pipeline_response, deserialized, {}) return deserialized + get_extended_information.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation'} # type: ignore + async def _install_updates_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self._install_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_install_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._install_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -759,11 +701,13 @@ async def _install_updates_initial( _install_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + + @distributed_trace_async async def begin_install_updates( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Installs the updates on the Data Box Edge/Data Box Gateway device. @@ -775,15 +719,17 @@ async def begin_install_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -797,21 +743,14 @@ async def begin_install_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -823,13 +762,15 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_install_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + @distributed_trace_async async def get_network_settings( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.NetworkSettings": """Gets the network settings of the specified Data Box Edge/Data Box Gateway device. @@ -847,27 +788,17 @@ async def get_network_settings( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get_network_settings.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_network_settings_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_network_settings.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -881,40 +812,32 @@ async def get_network_settings( return cls(pipeline_response, deserialized, {}) return deserialized + get_network_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/networkSettings/default'} # type: ignore + async def _scan_for_updates_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self._scan_for_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_scan_for_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._scan_for_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -927,11 +850,13 @@ async def _scan_for_updates_initial( _scan_for_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore + + @distributed_trace_async async def begin_scan_for_updates( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Scans for updates on a Data Box Edge/Data Box Gateway device. @@ -943,15 +868,17 @@ async def begin_scan_for_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -965,21 +892,14 @@ async def begin_scan_for_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -991,6 +911,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_scan_for_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore async def _create_or_update_security_settings_initial( @@ -998,39 +919,29 @@ async def _create_or_update_security_settings_initial( device_name: str, resource_group_name: str, security_settings: "_models.SecuritySettings", - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_security_settings_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(security_settings, 'SecuritySettings') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_security_settings_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_security_settings_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(security_settings, 'SecuritySettings') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1043,12 +954,14 @@ async def _create_or_update_security_settings_initial( _create_or_update_security_settings_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + + @distributed_trace_async async def begin_create_or_update_security_settings( self, device_name: str, resource_group_name: str, security_settings: "_models.SecuritySettings", - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Updates the security settings on a Data Box Edge/Data Box Gateway device. @@ -1060,15 +973,18 @@ async def begin_create_or_update_security_settings( :type security_settings: ~azure.mgmt.databoxedge.v2019_08_01.models.SecuritySettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1080,24 +996,18 @@ async def begin_create_or_update_security_settings( device_name=device_name, resource_group_name=resource_group_name, security_settings=security_settings, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1109,15 +1019,18 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_security_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + @distributed_trace_async async def get_update_summary( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.UpdateSummary": - """Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. + """Gets information about the availability of updates based on the last scan of the device. It + also gets information about any ongoing download or install jobs on the device. Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. @@ -1136,27 +1049,17 @@ async def get_update_summary( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get_update_summary.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_update_summary_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_update_summary.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1170,14 +1073,17 @@ async def get_update_summary( return cls(pipeline_response, deserialized, {}) return deserialized + get_update_summary.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default'} # type: ignore + + @distributed_trace_async async def upload_certificate( self, device_name: str, resource_group_name: str, parameters: "_models.UploadCertificateRequest", - **kwargs + **kwargs: Any ) -> "_models.UploadCertificateResponse": """Uploads registration certificate for the device. @@ -1197,32 +1103,22 @@ async def upload_certificate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.upload_certificate.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'UploadCertificateRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_upload_certificate_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.upload_certificate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'UploadCertificateRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1236,4 +1132,6 @@ async def upload_certificate( return cls(pipeline_response, deserialized, {}) return deserialized + upload_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/uploadCertificate'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_jobs_operations.py index b03d8568a77a..59a624908d4e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_jobs_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._jobs_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,12 +44,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Job": """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. @@ -67,28 +72,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -102,4 +97,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_nodes_operations.py index d9d6afc3ee45..7ab77ea56bf0 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_nodes_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._nodes_operations import build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,11 +46,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.NodeList"]: """Gets all the nodes currently configured under this Data Box Edge device. @@ -55,7 +61,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either NodeList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.NodeList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.NodeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeList"] @@ -63,36 +70,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('NodeList', pipeline_response) + deserialized = self._deserialize("NodeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,6 +114,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_operations.py index 336edd0b9ab2..d0fbfbc3a1c9 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,9 +46,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OperationsList"]: """List all the supported operations. @@ -51,7 +57,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.OperationsList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.OperationsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationsList"] @@ -59,30 +66,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationsList', pipeline_response) + deserialized = self._deserialize("OperationsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -100,6 +104,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_operations_status_operations.py index 62707ccfeba5..3709b2550977 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_operations_status_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations_status_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,12 +44,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Job": """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. @@ -67,28 +72,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -102,4 +97,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/operationsStatus/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_orders_operations.py index f4b7df965092..a39bc7bdce5f 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_orders_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._orders_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OrderList"]: """Lists all the orders related to a Data Box Edge/Data Box Gateway device. @@ -59,7 +65,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OrderList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.OrderList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.OrderList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OrderList"] @@ -67,36 +74,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OrderList', pipeline_response) + deserialized = self._deserialize("OrderList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,16 +118,18 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Order": """Gets a specific order by name. @@ -143,27 +149,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,46 +173,38 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + async def _create_or_update_initial( self, device_name: str, resource_group_name: str, order: "_models.Order", - **kwargs + **kwargs: Any ) -> Optional["_models.Order"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Order"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(order, 'Order') + + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(order, 'Order') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -232,14 +220,17 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, resource_group_name: str, order: "_models.Order", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Order"]: """Creates or updates an order. @@ -253,15 +244,18 @@ async def begin_create_or_update( :type order: ~azure.mgmt.databoxedge.v2019_08_01.models.Order :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Order or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_08_01.models.Order] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Order"] lro_delay = kwargs.pop( 'polling_interval', @@ -273,27 +267,21 @@ async def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, order=order, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Order', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -305,40 +293,31 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore async def _delete_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -351,11 +330,13 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the order related to the device. @@ -367,15 +348,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -389,21 +372,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -415,4 +391,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_roles_operations.py index 822acd6ddbe0..949627818c71 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_roles_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._roles_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.RoleList"]: """Lists all the roles configured in a Data Box Edge/Data Box Gateway device. @@ -57,7 +63,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RoleList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.RoleList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.RoleList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleList"] @@ -65,36 +72,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RoleList', pipeline_response) + deserialized = self._deserialize("RoleList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,17 +116,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Role": """Gets a specific role by name. @@ -142,28 +148,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,48 +173,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, role: "_models.Role", - **kwargs + **kwargs: Any ) -> Optional["_models.Role"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Role"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(role, 'Role') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(role, 'Role') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -234,15 +222,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, role: "_models.Role", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Role"]: """Create or update a role. @@ -256,15 +247,18 @@ async def begin_create_or_update( :type role: ~azure.mgmt.databoxedge.v2019_08_01.models.Role :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Role or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_08_01.models.Role] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Role"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,28 +271,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, role=role, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Role', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -310,6 +297,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore async def _delete_initial( @@ -317,35 +305,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -358,12 +336,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the role on the device. @@ -375,15 +355,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -398,22 +380,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -425,4 +399,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_shares_operations.py index 1546cffb958f..7e98b88e6ac1 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_shares_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._shares_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request, build_refresh_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ShareList"]: """Lists all the shares in a Data Box Edge/Data Box Gateway device. @@ -59,7 +65,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ShareList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.ShareList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.ShareList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ShareList"] @@ -67,36 +74,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ShareList', pipeline_response) + deserialized = self._deserialize("ShareList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,17 +118,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Share": """Gets a share by name. @@ -146,28 +152,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -181,48 +177,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, share: "_models.Share", - **kwargs + **kwargs: Any ) -> Optional["_models.Share"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Share"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(share, 'Share') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(share, 'Share') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -238,15 +226,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, share: "_models.Share", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Share"]: """Creates a new share or updates an existing share on the device. @@ -262,15 +253,18 @@ async def begin_create_or_update( :type share: ~azure.mgmt.databoxedge.v2019_08_01.models.Share :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Share or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_08_01.models.Share] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Share"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,28 +277,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, share=share, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Share', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -316,6 +303,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore async def _delete_initial( @@ -323,35 +311,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,12 +342,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the share on the Data Box Edge/Data Box Gateway device. @@ -381,15 +361,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -404,22 +386,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -431,6 +405,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore async def _refresh_initial( @@ -438,35 +413,25 @@ async def _refresh_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -479,12 +444,14 @@ async def _refresh_initial( _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore + + @distributed_trace_async async def begin_refresh( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Refreshes the share metadata with the data from the cloud. @@ -498,15 +465,17 @@ async def begin_refresh( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -521,22 +490,14 @@ async def begin_refresh( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -548,4 +509,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_skus_operations.py index 45fbdcb005d9..cba6fa62b674 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_skus_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,10 +46,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, filter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.SkuInformationList"]: """List all the available Skus in the region and information related to them. @@ -54,7 +60,8 @@ def list( :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SkuInformationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.SkuInformationList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.SkuInformationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SkuInformationList"] @@ -62,36 +69,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SkuInformationList', pipeline_response) + deserialized = self._deserialize("SkuInformationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -109,6 +111,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_storage_account_credentials_operations.py index 1b7fc04d944c..3ec50f8fedb8 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_storage_account_credentials_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._storage_account_credentials_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.StorageAccountCredentialList"]: """Gets all the storage account credentials in a Data Box Edge/Data Box Gateway device. @@ -58,8 +64,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountCredentialList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.StorageAccountCredentialList] + :return: An iterator like instance of either StorageAccountCredentialList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.StorageAccountCredentialList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredentialList"] @@ -67,36 +75,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('StorageAccountCredentialList', pipeline_response) + deserialized = self._deserialize("StorageAccountCredentialList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,17 +119,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.StorageAccountCredential": """Gets the properties of the specified storage account credential. @@ -144,28 +151,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -179,48 +176,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, storage_account_credential: "_models.StorageAccountCredential", - **kwargs + **kwargs: Any ) -> Optional["_models.StorageAccountCredential"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccountCredential"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(storage_account_credential, 'StorageAccountCredential') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_account_credential, 'StorageAccountCredential') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -236,15 +225,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, storage_account_credential: "_models.StorageAccountCredential", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.StorageAccountCredential"]: """Creates or updates the storage account credential. @@ -255,18 +247,24 @@ async def begin_create_or_update( :param resource_group_name: The resource group name. :type resource_group_name: str :param storage_account_credential: The storage account credential. - :type storage_account_credential: ~azure.mgmt.databoxedge.v2019_08_01.models.StorageAccountCredential + :type storage_account_credential: + ~azure.mgmt.databoxedge.v2019_08_01.models.StorageAccountCredential :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either StorageAccountCredential or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_08_01.models.StorageAccountCredential] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageAccountCredential or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_08_01.models.StorageAccountCredential] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredential"] lro_delay = kwargs.pop( 'polling_interval', @@ -279,28 +277,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, storage_account_credential=storage_account_credential, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccountCredential', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -312,6 +303,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore async def _delete_initial( @@ -319,35 +311,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -360,12 +342,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the storage account credential. @@ -377,15 +361,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -400,22 +386,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -427,4 +405,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_storage_accounts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_storage_accounts_operations.py index 65fdbb465b3b..08e42b72096a 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_storage_accounts_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._storage_accounts_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.StorageAccountList"]: """Lists all the storage accounts in a Data Box Edge/Data Box Gateway device. @@ -59,7 +65,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either StorageAccountList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.StorageAccountList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.StorageAccountList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountList"] @@ -67,36 +74,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('StorageAccountList', pipeline_response) + deserialized = self._deserialize("StorageAccountList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,17 +118,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, storage_account_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.StorageAccount": """Gets a StorageAccount by name. @@ -146,28 +152,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -181,48 +177,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, storage_account_name: str, resource_group_name: str, storage_account: "_models.StorageAccount", - **kwargs + **kwargs: Any ) -> Optional["_models.StorageAccount"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(storage_account, 'StorageAccount') + + request = build_create_or_update_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_account, 'StorageAccount') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -238,15 +226,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, storage_account_name: str, resource_group_name: str, storage_account: "_models.StorageAccount", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.StorageAccount"]: """Creates a new StorageAccount or updates an existing StorageAccount on the device. @@ -262,15 +253,20 @@ async def begin_create_or_update( :type storage_account: ~azure.mgmt.databoxedge.v2019_08_01.models.StorageAccount :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either StorageAccount or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_08_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_08_01.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,28 +279,21 @@ async def begin_create_or_update( storage_account_name=storage_account_name, resource_group_name=resource_group_name, storage_account=storage_account, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -316,6 +305,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore async def _delete_initial( @@ -323,35 +313,25 @@ async def _delete_initial( device_name: str, storage_account_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,12 +344,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, storage_account_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the StorageAccount on the Data Box Edge/Data Box Gateway device. @@ -381,15 +363,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -404,22 +388,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -431,4 +407,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_triggers_operations.py index d066a5070140..acd6a2cf1d47 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_triggers_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._triggers_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, filter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.TriggerList"]: """Lists all the triggers configured in the device. @@ -61,7 +67,8 @@ def list_by_data_box_edge_device( :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TriggerList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.TriggerList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.TriggerList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TriggerList"] @@ -69,38 +76,35 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TriggerList', pipeline_response) + deserialized = self._deserialize("TriggerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,17 +122,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Trigger": """Get a specific trigger by name. @@ -148,28 +154,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,48 +179,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, trigger: "_models.Trigger", - **kwargs + **kwargs: Any ) -> Optional["_models.Trigger"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Trigger"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(trigger, 'Trigger') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(trigger, 'Trigger') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,15 +228,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, trigger: "_models.Trigger", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Trigger"]: """Creates or updates a trigger. @@ -262,15 +253,19 @@ async def begin_create_or_update( :type trigger: ~azure.mgmt.databoxedge.v2019_08_01.models.Trigger :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Trigger or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Trigger or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_08_01.models.Trigger] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Trigger"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,28 +278,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, trigger=trigger, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Trigger', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -316,6 +304,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore async def _delete_initial( @@ -323,35 +312,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,12 +343,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the trigger on the gateway device. @@ -381,15 +362,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -404,22 +387,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -431,4 +406,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_users_operations.py index 456ca3b771d3..21b6bec0d925 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_users_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._users_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, filter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.UserList"]: """Gets all the users registered on a Data Box Edge/Data Box Gateway device. @@ -60,7 +66,8 @@ def list_by_data_box_edge_device( :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.UserList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.UserList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UserList"] @@ -68,38 +75,35 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('UserList', pipeline_response) + deserialized = self._deserialize("UserList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,17 +121,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.User": """Gets the properties of the specified user. @@ -147,28 +153,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -182,48 +178,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, user: "_models.User", - **kwargs + **kwargs: Any ) -> Optional["_models.User"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.User"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(user, 'User') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(user, 'User') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,15 +227,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, user: "_models.User", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.User"]: """Creates a new user or updates an existing user's information on a Data Box Edge/Data Box Gateway device. @@ -262,15 +253,18 @@ async def begin_create_or_update( :type user: ~azure.mgmt.databoxedge.v2019_08_01.models.User :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either User or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2019_08_01.models.User] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.User"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,28 +277,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, user=user, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('User', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -316,6 +303,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore async def _delete_initial( @@ -323,35 +311,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,12 +342,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the user on a databox edge/gateway device. @@ -381,15 +361,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -404,22 +386,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -431,4 +405,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/models/__init__.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/models/__init__.py index bd24cea04afc..1feaa621f2f9 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/models/__init__.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/models/__init__.py @@ -6,160 +6,83 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ARMBaseModel - from ._models_py3 import Address - from ._models_py3 import Alert - from ._models_py3 import AlertErrorDetails - from ._models_py3 import AlertList - from ._models_py3 import AsymmetricEncryptedSecret - from ._models_py3 import Authentication - from ._models_py3 import AzureContainerInfo - from ._models_py3 import BandwidthSchedule - from ._models_py3 import BandwidthSchedulesList - from ._models_py3 import ClientAccessRight - from ._models_py3 import CloudErrorBody - from ._models_py3 import ContactDetails - from ._models_py3 import Container - from ._models_py3 import ContainerList - from ._models_py3 import DataBoxEdgeDevice - from ._models_py3 import DataBoxEdgeDeviceExtendedInfo - from ._models_py3 import DataBoxEdgeDeviceList - from ._models_py3 import DataBoxEdgeDevicePatch - from ._models_py3 import FileEventTrigger - from ._models_py3 import FileSourceInfo - from ._models_py3 import IoTDeviceInfo - from ._models_py3 import IoTRole - from ._models_py3 import Ipv4Config - from ._models_py3 import Ipv6Config - from ._models_py3 import Job - from ._models_py3 import JobErrorDetails - from ._models_py3 import JobErrorItem - from ._models_py3 import MetricDimensionV1 - from ._models_py3 import MetricSpecificationV1 - from ._models_py3 import MountPointMap - from ._models_py3 import NetworkAdapter - from ._models_py3 import NetworkAdapterPosition - from ._models_py3 import NetworkSettings - from ._models_py3 import Node - from ._models_py3 import NodeList - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationsList - from ._models_py3 import Order - from ._models_py3 import OrderList - from ._models_py3 import OrderStatus - from ._models_py3 import PeriodicTimerEventTrigger - from ._models_py3 import PeriodicTimerSourceInfo - from ._models_py3 import RefreshDetails - from ._models_py3 import ResourceTypeSku - from ._models_py3 import Role - from ._models_py3 import RoleList - from ._models_py3 import RoleSinkInfo - from ._models_py3 import SecuritySettings - from ._models_py3 import ServiceSpecification - from ._models_py3 import Share - from ._models_py3 import ShareAccessRight - from ._models_py3 import ShareList - from ._models_py3 import Sku - from ._models_py3 import SkuCost - from ._models_py3 import SkuInformationList - from ._models_py3 import SkuLocationInfo - from ._models_py3 import SkuRestriction - from ._models_py3 import SkuRestrictionInfo - from ._models_py3 import StorageAccount - from ._models_py3 import StorageAccountCredential - from ._models_py3 import StorageAccountCredentialList - from ._models_py3 import StorageAccountList - from ._models_py3 import SymmetricKey - from ._models_py3 import TrackingInfo - from ._models_py3 import Trigger - from ._models_py3 import TriggerList - from ._models_py3 import UpdateDownloadProgress - from ._models_py3 import UpdateInstallProgress - from ._models_py3 import UpdateSummary - from ._models_py3 import UploadCertificateRequest - from ._models_py3 import UploadCertificateResponse - from ._models_py3 import User - from ._models_py3 import UserAccessRight - from ._models_py3 import UserList -except (SyntaxError, ImportError): - from ._models import ARMBaseModel # type: ignore - from ._models import Address # type: ignore - from ._models import Alert # type: ignore - from ._models import AlertErrorDetails # type: ignore - from ._models import AlertList # type: ignore - from ._models import AsymmetricEncryptedSecret # type: ignore - from ._models import Authentication # type: ignore - from ._models import AzureContainerInfo # type: ignore - from ._models import BandwidthSchedule # type: ignore - from ._models import BandwidthSchedulesList # type: ignore - from ._models import ClientAccessRight # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import ContactDetails # type: ignore - from ._models import Container # type: ignore - from ._models import ContainerList # type: ignore - from ._models import DataBoxEdgeDevice # type: ignore - from ._models import DataBoxEdgeDeviceExtendedInfo # type: ignore - from ._models import DataBoxEdgeDeviceList # type: ignore - from ._models import DataBoxEdgeDevicePatch # type: ignore - from ._models import FileEventTrigger # type: ignore - from ._models import FileSourceInfo # type: ignore - from ._models import IoTDeviceInfo # type: ignore - from ._models import IoTRole # type: ignore - from ._models import Ipv4Config # type: ignore - from ._models import Ipv6Config # type: ignore - from ._models import Job # type: ignore - from ._models import JobErrorDetails # type: ignore - from ._models import JobErrorItem # type: ignore - from ._models import MetricDimensionV1 # type: ignore - from ._models import MetricSpecificationV1 # type: ignore - from ._models import MountPointMap # type: ignore - from ._models import NetworkAdapter # type: ignore - from ._models import NetworkAdapterPosition # type: ignore - from ._models import NetworkSettings # type: ignore - from ._models import Node # type: ignore - from ._models import NodeList # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationsList # type: ignore - from ._models import Order # type: ignore - from ._models import OrderList # type: ignore - from ._models import OrderStatus # type: ignore - from ._models import PeriodicTimerEventTrigger # type: ignore - from ._models import PeriodicTimerSourceInfo # type: ignore - from ._models import RefreshDetails # type: ignore - from ._models import ResourceTypeSku # type: ignore - from ._models import Role # type: ignore - from ._models import RoleList # type: ignore - from ._models import RoleSinkInfo # type: ignore - from ._models import SecuritySettings # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Share # type: ignore - from ._models import ShareAccessRight # type: ignore - from ._models import ShareList # type: ignore - from ._models import Sku # type: ignore - from ._models import SkuCost # type: ignore - from ._models import SkuInformationList # type: ignore - from ._models import SkuLocationInfo # type: ignore - from ._models import SkuRestriction # type: ignore - from ._models import SkuRestrictionInfo # type: ignore - from ._models import StorageAccount # type: ignore - from ._models import StorageAccountCredential # type: ignore - from ._models import StorageAccountCredentialList # type: ignore - from ._models import StorageAccountList # type: ignore - from ._models import SymmetricKey # type: ignore - from ._models import TrackingInfo # type: ignore - from ._models import Trigger # type: ignore - from ._models import TriggerList # type: ignore - from ._models import UpdateDownloadProgress # type: ignore - from ._models import UpdateInstallProgress # type: ignore - from ._models import UpdateSummary # type: ignore - from ._models import UploadCertificateRequest # type: ignore - from ._models import UploadCertificateResponse # type: ignore - from ._models import User # type: ignore - from ._models import UserAccessRight # type: ignore - from ._models import UserList # type: ignore +from ._models_py3 import ARMBaseModel +from ._models_py3 import Address +from ._models_py3 import Alert +from ._models_py3 import AlertErrorDetails +from ._models_py3 import AlertList +from ._models_py3 import AsymmetricEncryptedSecret +from ._models_py3 import Authentication +from ._models_py3 import AzureContainerInfo +from ._models_py3 import BandwidthSchedule +from ._models_py3 import BandwidthSchedulesList +from ._models_py3 import ClientAccessRight +from ._models_py3 import CloudErrorBody +from ._models_py3 import ContactDetails +from ._models_py3 import Container +from ._models_py3 import ContainerList +from ._models_py3 import DataBoxEdgeDevice +from ._models_py3 import DataBoxEdgeDeviceExtendedInfo +from ._models_py3 import DataBoxEdgeDeviceList +from ._models_py3 import DataBoxEdgeDevicePatch +from ._models_py3 import FileEventTrigger +from ._models_py3 import FileSourceInfo +from ._models_py3 import IoTDeviceInfo +from ._models_py3 import IoTRole +from ._models_py3 import Ipv4Config +from ._models_py3 import Ipv6Config +from ._models_py3 import Job +from ._models_py3 import JobErrorDetails +from ._models_py3 import JobErrorItem +from ._models_py3 import MetricDimensionV1 +from ._models_py3 import MetricSpecificationV1 +from ._models_py3 import MountPointMap +from ._models_py3 import NetworkAdapter +from ._models_py3 import NetworkAdapterPosition +from ._models_py3 import NetworkSettings +from ._models_py3 import Node +from ._models_py3 import NodeList +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationsList +from ._models_py3 import Order +from ._models_py3 import OrderList +from ._models_py3 import OrderStatus +from ._models_py3 import PeriodicTimerEventTrigger +from ._models_py3 import PeriodicTimerSourceInfo +from ._models_py3 import RefreshDetails +from ._models_py3 import ResourceTypeSku +from ._models_py3 import Role +from ._models_py3 import RoleList +from ._models_py3 import RoleSinkInfo +from ._models_py3 import SecuritySettings +from ._models_py3 import ServiceSpecification +from ._models_py3 import Share +from ._models_py3 import ShareAccessRight +from ._models_py3 import ShareList +from ._models_py3 import Sku +from ._models_py3 import SkuCost +from ._models_py3 import SkuInformationList +from ._models_py3 import SkuLocationInfo +from ._models_py3 import SkuRestriction +from ._models_py3 import SkuRestrictionInfo +from ._models_py3 import StorageAccount +from ._models_py3 import StorageAccountCredential +from ._models_py3 import StorageAccountCredentialList +from ._models_py3 import StorageAccountList +from ._models_py3 import SymmetricKey +from ._models_py3 import TrackingInfo +from ._models_py3 import Trigger +from ._models_py3 import TriggerList +from ._models_py3 import UpdateDownloadProgress +from ._models_py3 import UpdateInstallProgress +from ._models_py3 import UpdateSummary +from ._models_py3 import UploadCertificateRequest +from ._models_py3 import UploadCertificateResponse +from ._models_py3 import User +from ._models_py3 import UserAccessRight +from ._models_py3 import UserList + from ._data_box_edge_management_client_enums import ( AccountType, diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/models/_data_box_edge_management_client_enums.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/models/_data_box_edge_management_client_enums.py index ea7aec1355bf..9ea090d56e7f 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/models/_data_box_edge_management_client_enums.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/models/_data_box_edge_management_client_enums.py @@ -6,34 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccountType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of storage accessed on the storage account. """ GENERAL_PURPOSE_STORAGE = "GeneralPurposeStorage" BLOB_STORAGE = "BlobStorage" -class AlertSeverity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AlertSeverity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Severity of the alert. """ @@ -41,14 +26,14 @@ class AlertSeverity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" CRITICAL = "Critical" -class AuthenticationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AuthenticationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The authentication type. """ INVALID = "Invalid" AZURE_ACTIVE_DIRECTORY = "AzureActiveDirectory" -class AzureContainerDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AzureContainerDataFormat(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Storage format used for the file represented by the share. """ @@ -56,7 +41,7 @@ class AzureContainerDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu PAGE_BLOB = "PageBlob" AZURE_FILE = "AzureFile" -class ClientPermissionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ClientPermissionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of access to be allowed for the client. """ @@ -64,7 +49,7 @@ class ClientPermissionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ_ONLY = "ReadOnly" READ_WRITE = "ReadWrite" -class ContainerStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ContainerStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current status of the container. """ @@ -74,7 +59,7 @@ class ContainerStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UPDATING = "Updating" NEEDS_ATTENTION = "NeedsAttention" -class DataBoxEdgeDeviceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DataBoxEdgeDeviceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the Data Box Edge/Gateway device. """ @@ -86,14 +71,14 @@ class DataBoxEdgeDeviceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum PARTIALLY_DISCONNECTED = "PartiallyDisconnected" MAINTENANCE = "Maintenance" -class DataPolicy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DataPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Data policy of the share. """ CLOUD = "Cloud" LOCAL = "Local" -class DayOfWeek(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DayOfWeek(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SUNDAY = "Sunday" MONDAY = "Monday" @@ -103,13 +88,13 @@ class DayOfWeek(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FRIDAY = "Friday" SATURDAY = "Saturday" -class DeviceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeviceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the Data Box Edge/Gateway device. """ DATA_BOX_EDGE_DEVICE = "DataBoxEdgeDevice" -class DownloadPhase(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DownloadPhase(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The download phase. """ @@ -118,7 +103,7 @@ class DownloadPhase(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DOWNLOADING = "Downloading" VERIFYING = "Verifying" -class EncryptionAlgorithm(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The algorithm used to encrypt "Value". """ @@ -126,7 +111,7 @@ class EncryptionAlgorithm(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AES256 = "AES256" RSAES_PKCS1_V1_5 = "RSAES_PKCS1_v_1_5" -class InstallRebootBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InstallRebootBehavior(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates if updates are available and at least one of the updates needs a reboot. """ @@ -134,7 +119,7 @@ class InstallRebootBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) REQUIRES_REBOOT = "RequiresReboot" REQUEST_REBOOT = "RequestReboot" -class JobStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JobStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current status of the job. """ @@ -146,7 +131,7 @@ class JobStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PAUSED = "Paused" SCHEDULED = "Scheduled" -class JobType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JobType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the job. """ @@ -157,7 +142,7 @@ class JobType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): REFRESH_SHARE = "RefreshShare" REFRESH_CONTAINER = "RefreshContainer" -class MetricAggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricAggregationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Metric aggregation type. """ @@ -169,14 +154,14 @@ class MetricAggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) TOTAL = "Total" COUNT = "Count" -class MetricCategory(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricCategory(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Metric category. """ CAPACITY = "Capacity" TRANSACTION = "Transaction" -class MetricUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Metric units. """ @@ -189,35 +174,35 @@ class MetricUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BYTES_PER_SECOND = "BytesPerSecond" COUNT_PER_SECOND = "CountPerSecond" -class MonitoringStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MonitoringStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current monitoring status of the share. """ ENABLED = "Enabled" DISABLED = "Disabled" -class NetworkAdapterDHCPStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkAdapterDHCPStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Value indicating whether this adapter has DHCP enabled. """ DISABLED = "Disabled" ENABLED = "Enabled" -class NetworkAdapterRDMAStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkAdapterRDMAStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Value indicating whether this adapter is RDMA capable. """ INCAPABLE = "Incapable" CAPABLE = "Capable" -class NetworkAdapterStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkAdapterStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Value indicating whether this adapter is valid. """ INACTIVE = "Inactive" ACTIVE = "Active" -class NetworkGroup(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkGroup(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The network group. """ @@ -225,7 +210,7 @@ class NetworkGroup(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): NON_RDMA = "NonRDMA" RDMA = "RDMA" -class NodeStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NodeStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current status of the individual node """ @@ -235,7 +220,7 @@ class NodeStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): REBOOTING = "Rebooting" SHUTTING_DOWN = "ShuttingDown" -class OrderState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OrderState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the order as per the allowed status types. """ @@ -254,35 +239,35 @@ class OrderState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SHIPPED_BACK = "ShippedBack" COLLECTED_AT_MICROSOFT = "CollectedAtMicrosoft" -class PlatformType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PlatformType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Host OS supported by the IoT role. """ WINDOWS = "Windows" LINUX = "Linux" -class RoleStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RoleStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Role status. """ ENABLED = "Enabled" DISABLED = "Disabled" -class RoleTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RoleTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): IOT = "IOT" ASA = "ASA" FUNCTIONS = "Functions" COGNITIVE = "Cognitive" -class ShareAccessProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareAccessProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Access protocol to be used by the share. """ SMB = "SMB" NFS = "NFS" -class ShareAccessType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareAccessType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of access to be allowed on the share for this user. """ @@ -290,7 +275,7 @@ class ShareAccessType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ = "Read" CUSTOM = "Custom" -class ShareStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current status of the share. """ @@ -300,7 +285,7 @@ class ShareStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UPDATING = "Updating" NEEDS_ATTENTION = "NeedsAttention" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Sku name """ @@ -314,27 +299,27 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): TEA4_NODE_UPS_HEATER = "TEA_4Node_UPS_Heater" TMA = "TMA" -class SkuRestrictionReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuRestrictionReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SKU restriction reason. """ NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" QUOTA_ID = "QuotaId" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Sku tier """ STANDARD = "Standard" -class SSLStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SSLStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Signifies whether SSL needs to be enabled or not. """ ENABLED = "Enabled" DISABLED = "Disabled" -class StorageAccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current status of the storage account """ @@ -344,7 +329,7 @@ class StorageAccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UPDATING = "Updating" NEEDS_ATTENTION = "NeedsAttention" -class TimeGrain(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TimeGrain(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PT1_M = "PT1M" PT5_M = "PT5M" @@ -355,14 +340,14 @@ class TimeGrain(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PT12_H = "PT12H" PT1_D = "PT1D" -class TriggerEventType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TriggerEventType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Trigger Kind. """ FILE_EVENT = "FileEvent" PERIODIC_TIMER_EVENT = "PeriodicTimerEvent" -class UpdateOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpdateOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current update operation. """ @@ -371,7 +356,7 @@ class UpdateOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DOWNLOAD = "Download" INSTALL = "Install" -class UpdateOperationStage(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpdateOperationStage(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current stage of the update operation. """ @@ -393,7 +378,7 @@ class UpdateOperationStage(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESCAN_COMPLETE = "RescanComplete" RESCAN_FAILED = "RescanFailed" -class UserType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UserType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the user. """ diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/models/_models.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/models/_models.py deleted file mode 100644 index de25c17e49f4..000000000000 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/models/_models.py +++ /dev/null @@ -1,3305 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class Address(msrest.serialization.Model): - """The shipping address of the customer. - - All required parameters must be populated in order to send to Azure. - - :param address_line1: Required. The address line1. - :type address_line1: str - :param address_line2: The address line2. - :type address_line2: str - :param address_line3: The address line3. - :type address_line3: str - :param postal_code: Required. The postal code. - :type postal_code: str - :param city: Required. The city name. - :type city: str - :param state: Required. The state name. - :type state: str - :param country: Required. The country name. - :type country: str - """ - - _validation = { - 'address_line1': {'required': True}, - 'postal_code': {'required': True}, - 'city': {'required': True}, - 'state': {'required': True}, - 'country': {'required': True}, - } - - _attribute_map = { - 'address_line1': {'key': 'addressLine1', 'type': 'str'}, - 'address_line2': {'key': 'addressLine2', 'type': 'str'}, - 'address_line3': {'key': 'addressLine3', 'type': 'str'}, - 'postal_code': {'key': 'postalCode', 'type': 'str'}, - 'city': {'key': 'city', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'country': {'key': 'country', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Address, self).__init__(**kwargs) - self.address_line1 = kwargs['address_line1'] - self.address_line2 = kwargs.get('address_line2', None) - self.address_line3 = kwargs.get('address_line3', None) - self.postal_code = kwargs['postal_code'] - self.city = kwargs['city'] - self.state = kwargs['state'] - self.country = kwargs['country'] - - -class ARMBaseModel(msrest.serialization.Model): - """Represents the base class for all object models. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ARMBaseModel, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class Alert(ARMBaseModel): - """Alert on the data box edge/gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar title: Alert title. - :vartype title: str - :ivar alert_type: Alert type. - :vartype alert_type: str - :ivar appeared_at_date_time: UTC time when the alert appeared. - :vartype appeared_at_date_time: ~datetime.datetime - :ivar recommendation: Alert recommendation. - :vartype recommendation: str - :ivar severity: Severity of the alert. Possible values include: "Informational", "Warning", - "Critical". - :vartype severity: str or ~azure.mgmt.databoxedge.v2019_08_01.models.AlertSeverity - :ivar error_details: Error details of the alert. - :vartype error_details: ~azure.mgmt.databoxedge.v2019_08_01.models.AlertErrorDetails - :ivar detailed_information: Alert details. - :vartype detailed_information: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'title': {'readonly': True}, - 'alert_type': {'readonly': True}, - 'appeared_at_date_time': {'readonly': True}, - 'recommendation': {'readonly': True}, - 'severity': {'readonly': True}, - 'error_details': {'readonly': True}, - 'detailed_information': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'title': {'key': 'properties.title', 'type': 'str'}, - 'alert_type': {'key': 'properties.alertType', 'type': 'str'}, - 'appeared_at_date_time': {'key': 'properties.appearedAtDateTime', 'type': 'iso-8601'}, - 'recommendation': {'key': 'properties.recommendation', 'type': 'str'}, - 'severity': {'key': 'properties.severity', 'type': 'str'}, - 'error_details': {'key': 'properties.errorDetails', 'type': 'AlertErrorDetails'}, - 'detailed_information': {'key': 'properties.detailedInformation', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(Alert, self).__init__(**kwargs) - self.title = None - self.alert_type = None - self.appeared_at_date_time = None - self.recommendation = None - self.severity = None - self.error_details = None - self.detailed_information = None - - -class AlertErrorDetails(msrest.serialization.Model): - """Error details for the alert. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error_code: Error code. - :vartype error_code: str - :ivar error_message: Error Message. - :vartype error_message: str - :ivar occurrences: Number of occurrences. - :vartype occurrences: int - """ - - _validation = { - 'error_code': {'readonly': True}, - 'error_message': {'readonly': True}, - 'occurrences': {'readonly': True}, - } - - _attribute_map = { - 'error_code': {'key': 'errorCode', 'type': 'str'}, - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - 'occurrences': {'key': 'occurrences', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(AlertErrorDetails, self).__init__(**kwargs) - self.error_code = None - self.error_message = None - self.occurrences = None - - -class AlertList(msrest.serialization.Model): - """Collection of alerts. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The value. - :vartype value: list[~azure.mgmt.databoxedge.v2019_08_01.models.Alert] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Alert]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AlertList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class AsymmetricEncryptedSecret(msrest.serialization.Model): - """Represent the secrets intended for encryption with asymmetric key pair. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The value of the secret. - :type value: str - :param encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the - value is unencrypted, it will be null. - :type encryption_cert_thumbprint: str - :param encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values - include: "None", "AES256", "RSAES_PKCS1_v_1_5". - :type encryption_algorithm: str or - ~azure.mgmt.databoxedge.v2019_08_01.models.EncryptionAlgorithm - """ - - _validation = { - 'value': {'required': True}, - 'encryption_algorithm': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'encryption_cert_thumbprint': {'key': 'encryptionCertThumbprint', 'type': 'str'}, - 'encryption_algorithm': {'key': 'encryptionAlgorithm', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AsymmetricEncryptedSecret, self).__init__(**kwargs) - self.value = kwargs['value'] - self.encryption_cert_thumbprint = kwargs.get('encryption_cert_thumbprint', None) - self.encryption_algorithm = kwargs['encryption_algorithm'] - - -class Authentication(msrest.serialization.Model): - """Authentication mechanism for IoT devices. - - :param symmetric_key: Symmetric key for authentication. - :type symmetric_key: ~azure.mgmt.databoxedge.v2019_08_01.models.SymmetricKey - """ - - _attribute_map = { - 'symmetric_key': {'key': 'symmetricKey', 'type': 'SymmetricKey'}, - } - - def __init__( - self, - **kwargs - ): - super(Authentication, self).__init__(**kwargs) - self.symmetric_key = kwargs.get('symmetric_key', None) - - -class AzureContainerInfo(msrest.serialization.Model): - """Azure container mapping of the endpoint. - - All required parameters must be populated in order to send to Azure. - - :param storage_account_credential_id: Required. ID of the storage account credential used to - access storage. - :type storage_account_credential_id: str - :param container_name: Required. Container name (Based on the data format specified, this - represents the name of Azure Files/Page blob/Block blob). - :type container_name: str - :param data_format: Required. Storage format used for the file represented by the share. - Possible values include: "BlockBlob", "PageBlob", "AzureFile". - :type data_format: str or ~azure.mgmt.databoxedge.v2019_08_01.models.AzureContainerDataFormat - """ - - _validation = { - 'storage_account_credential_id': {'required': True}, - 'container_name': {'required': True}, - 'data_format': {'required': True}, - } - - _attribute_map = { - 'storage_account_credential_id': {'key': 'storageAccountCredentialId', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'data_format': {'key': 'dataFormat', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureContainerInfo, self).__init__(**kwargs) - self.storage_account_credential_id = kwargs['storage_account_credential_id'] - self.container_name = kwargs['container_name'] - self.data_format = kwargs['data_format'] - - -class BandwidthSchedule(ARMBaseModel): - """The bandwidth schedule details. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param start: Required. The start time of the schedule in UTC. - :type start: str - :param stop: Required. The stop time of the schedule in UTC. - :type stop: str - :param rate_in_mbps: Required. The bandwidth rate in Mbps. - :type rate_in_mbps: int - :param days: Required. The days of the week when this schedule is applicable. - :type days: list[str or ~azure.mgmt.databoxedge.v2019_08_01.models.DayOfWeek] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'start': {'required': True}, - 'stop': {'required': True}, - 'rate_in_mbps': {'required': True}, - 'days': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'start': {'key': 'properties.start', 'type': 'str'}, - 'stop': {'key': 'properties.stop', 'type': 'str'}, - 'rate_in_mbps': {'key': 'properties.rateInMbps', 'type': 'int'}, - 'days': {'key': 'properties.days', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(BandwidthSchedule, self).__init__(**kwargs) - self.start = kwargs['start'] - self.stop = kwargs['stop'] - self.rate_in_mbps = kwargs['rate_in_mbps'] - self.days = kwargs['days'] - - -class BandwidthSchedulesList(msrest.serialization.Model): - """The collection of bandwidth schedules. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of bandwidth schedules. - :vartype value: list[~azure.mgmt.databoxedge.v2019_08_01.models.BandwidthSchedule] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BandwidthSchedule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BandwidthSchedulesList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ClientAccessRight(msrest.serialization.Model): - """The mapping between a particular client IP and the type of access client has on the NFS share. - - All required parameters must be populated in order to send to Azure. - - :param client: Required. IP of the client. - :type client: str - :param access_permission: Required. Type of access to be allowed for the client. Possible - values include: "NoAccess", "ReadOnly", "ReadWrite". - :type access_permission: str or ~azure.mgmt.databoxedge.v2019_08_01.models.ClientPermissionType - """ - - _validation = { - 'client': {'required': True}, - 'access_permission': {'required': True}, - } - - _attribute_map = { - 'client': {'key': 'client', 'type': 'str'}, - 'access_permission': {'key': 'accessPermission', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClientAccessRight, self).__init__(**kwargs) - self.client = kwargs['client'] - self.access_permission = kwargs['access_permission'] - - -class CloudErrorBody(msrest.serialization.Model): - """An error response from the service. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.databoxedge.v2019_08_01.models.CloudErrorBody] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudErrorBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.details = kwargs.get('details', None) - - -class ContactDetails(msrest.serialization.Model): - """Contains all the contact details of the customer. - - All required parameters must be populated in order to send to Azure. - - :param contact_person: Required. The contact person name. - :type contact_person: str - :param company_name: Required. The name of the company. - :type company_name: str - :param phone: Required. The phone number. - :type phone: str - :param email_list: Required. The email list. - :type email_list: list[str] - """ - - _validation = { - 'contact_person': {'required': True}, - 'company_name': {'required': True}, - 'phone': {'required': True}, - 'email_list': {'required': True}, - } - - _attribute_map = { - 'contact_person': {'key': 'contactPerson', 'type': 'str'}, - 'company_name': {'key': 'companyName', 'type': 'str'}, - 'phone': {'key': 'phone', 'type': 'str'}, - 'email_list': {'key': 'emailList', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ContactDetails, self).__init__(**kwargs) - self.contact_person = kwargs['contact_person'] - self.company_name = kwargs['company_name'] - self.phone = kwargs['phone'] - self.email_list = kwargs['email_list'] - - -class Container(ARMBaseModel): - """Represents a container on the Data Box Edge/Gateway device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar container_status: Current status of the container. Possible values include: "OK", - "Offline", "Unknown", "Updating", "NeedsAttention". - :vartype container_status: str or ~azure.mgmt.databoxedge.v2019_08_01.models.ContainerStatus - :param data_format: Required. DataFormat for Container. Possible values include: "BlockBlob", - "PageBlob", "AzureFile". - :type data_format: str or ~azure.mgmt.databoxedge.v2019_08_01.models.AzureContainerDataFormat - :ivar refresh_details: Details of the refresh job on this container. - :vartype refresh_details: ~azure.mgmt.databoxedge.v2019_08_01.models.RefreshDetails - :ivar created_date_time: The UTC time when container got created. - :vartype created_date_time: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'container_status': {'readonly': True}, - 'data_format': {'required': True}, - 'refresh_details': {'readonly': True}, - 'created_date_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'container_status': {'key': 'properties.containerStatus', 'type': 'str'}, - 'data_format': {'key': 'properties.dataFormat', 'type': 'str'}, - 'refresh_details': {'key': 'properties.refreshDetails', 'type': 'RefreshDetails'}, - 'created_date_time': {'key': 'properties.createdDateTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(Container, self).__init__(**kwargs) - self.container_status = None - self.data_format = kwargs['data_format'] - self.refresh_details = None - self.created_date_time = None - - -class ContainerList(msrest.serialization.Model): - """Collection of all the containers on the Data Box Edge/Gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of containers. - :vartype value: list[~azure.mgmt.databoxedge.v2019_08_01.models.Container] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Container]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContainerList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class DataBoxEdgeDevice(ARMBaseModel): - """The Data Box Edge/Gateway device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param location: Required. The location of the device. This is a supported and registered Azure - geographical region (for example, West US, East US, or Southeast Asia). The geographical region - of a device cannot be changed once it is created, but if an identical geographical region is - specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. The list of tags that describe the device. These tags can be used - to view and group this device (across resource groups). - :type tags: dict[str, str] - :param sku: The SKU type. - :type sku: ~azure.mgmt.databoxedge.v2019_08_01.models.Sku - :param etag: The etag for the devices. - :type etag: str - :param data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible - values include: "ReadyToSetup", "Online", "Offline", "NeedsAttention", "Disconnected", - "PartiallyDisconnected", "Maintenance". - :type data_box_edge_device_status: str or - ~azure.mgmt.databoxedge.v2019_08_01.models.DataBoxEdgeDeviceStatus - :ivar serial_number: The Serial Number of Data Box Edge/Gateway device. - :vartype serial_number: str - :param description: The Description of the Data Box Edge/Gateway device. - :type description: str - :param model_description: The description of the Data Box Edge/Gateway device model. - :type model_description: str - :ivar device_type: The type of the Data Box Edge/Gateway device. Possible values include: - "DataBoxEdgeDevice". - :vartype device_type: str or ~azure.mgmt.databoxedge.v2019_08_01.models.DeviceType - :param friendly_name: The Data Box Edge/Gateway device name. - :type friendly_name: str - :ivar culture: The Data Box Edge/Gateway device culture. - :vartype culture: str - :ivar device_model: The Data Box Edge/Gateway device model. - :vartype device_model: str - :ivar device_software_version: The Data Box Edge/Gateway device software version. - :vartype device_software_version: str - :ivar device_local_capacity: The Data Box Edge/Gateway device local capacity in MB. - :vartype device_local_capacity: long - :ivar time_zone: The Data Box Edge/Gateway device timezone. - :vartype time_zone: str - :ivar device_hcs_version: The device software version number of the device (eg: 1.2.18105.6). - :vartype device_hcs_version: str - :ivar configured_role_types: Type of compute roles configured. - :vartype configured_role_types: list[str or - ~azure.mgmt.databoxedge.v2019_08_01.models.RoleTypes] - :ivar node_count: The number of nodes in the cluster. - :vartype node_count: int - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'serial_number': {'readonly': True}, - 'device_type': {'readonly': True}, - 'culture': {'readonly': True}, - 'device_model': {'readonly': True}, - 'device_software_version': {'readonly': True}, - 'device_local_capacity': {'readonly': True}, - 'time_zone': {'readonly': True}, - 'device_hcs_version': {'readonly': True}, - 'configured_role_types': {'readonly': True}, - 'node_count': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'data_box_edge_device_status': {'key': 'properties.dataBoxEdgeDeviceStatus', 'type': 'str'}, - 'serial_number': {'key': 'properties.serialNumber', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'model_description': {'key': 'properties.modelDescription', 'type': 'str'}, - 'device_type': {'key': 'properties.deviceType', 'type': 'str'}, - 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, - 'culture': {'key': 'properties.culture', 'type': 'str'}, - 'device_model': {'key': 'properties.deviceModel', 'type': 'str'}, - 'device_software_version': {'key': 'properties.deviceSoftwareVersion', 'type': 'str'}, - 'device_local_capacity': {'key': 'properties.deviceLocalCapacity', 'type': 'long'}, - 'time_zone': {'key': 'properties.timeZone', 'type': 'str'}, - 'device_hcs_version': {'key': 'properties.deviceHcsVersion', 'type': 'str'}, - 'configured_role_types': {'key': 'properties.configuredRoleTypes', 'type': '[str]'}, - 'node_count': {'key': 'properties.nodeCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeDevice, self).__init__(**kwargs) - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.etag = kwargs.get('etag', None) - self.data_box_edge_device_status = kwargs.get('data_box_edge_device_status', None) - self.serial_number = None - self.description = kwargs.get('description', None) - self.model_description = kwargs.get('model_description', None) - self.device_type = None - self.friendly_name = kwargs.get('friendly_name', None) - self.culture = None - self.device_model = None - self.device_software_version = None - self.device_local_capacity = None - self.time_zone = None - self.device_hcs_version = None - self.configured_role_types = None - self.node_count = None - - -class DataBoxEdgeDeviceExtendedInfo(ARMBaseModel): - """The extended Info of the Data Box Edge/Gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param encryption_key_thumbprint: The digital signature of encrypted certificate. - :type encryption_key_thumbprint: str - :param encryption_key: The public part of the encryption certificate. Client uses this to - encrypt any secret. - :type encryption_key: str - :ivar resource_key: The Resource ID of the Resource. - :vartype resource_key: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'resource_key': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'encryption_key_thumbprint': {'key': 'properties.encryptionKeyThumbprint', 'type': 'str'}, - 'encryption_key': {'key': 'properties.encryptionKey', 'type': 'str'}, - 'resource_key': {'key': 'properties.resourceKey', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeDeviceExtendedInfo, self).__init__(**kwargs) - self.encryption_key_thumbprint = kwargs.get('encryption_key_thumbprint', None) - self.encryption_key = kwargs.get('encryption_key', None) - self.resource_key = None - - -class DataBoxEdgeDeviceList(msrest.serialization.Model): - """The collection of Data Box Edge/Gateway devices. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of Data Box Edge/Gateway devices. - :vartype value: list[~azure.mgmt.databoxedge.v2019_08_01.models.DataBoxEdgeDevice] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DataBoxEdgeDevice]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeDeviceList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class DataBoxEdgeDevicePatch(msrest.serialization.Model): - """The Data Box Edge/Gateway device patch. - - :param tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeDevicePatch, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class Trigger(ARMBaseModel): - """Trigger details. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: FileEventTrigger, PeriodicTimerEventTrigger. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: - "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2019_08_01.models.TriggerEventType - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - } - - _subtype_map = { - 'kind': {'FileEvent': 'FileEventTrigger', 'PeriodicTimerEvent': 'PeriodicTimerEventTrigger'} - } - - def __init__( - self, - **kwargs - ): - super(Trigger, self).__init__(**kwargs) - self.kind = 'Trigger' # type: str - - -class FileEventTrigger(Trigger): - """Trigger details. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: - "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2019_08_01.models.TriggerEventType - :param source_info: Required. File event source details. - :type source_info: ~azure.mgmt.databoxedge.v2019_08_01.models.FileSourceInfo - :param sink_info: Required. Role sink info. - :type sink_info: ~azure.mgmt.databoxedge.v2019_08_01.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against - its usage. For example, if a periodic timer trigger is intended for certain specific IoT - modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'source_info': {'required': True}, - 'sink_info': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'source_info': {'key': 'properties.sourceInfo', 'type': 'FileSourceInfo'}, - 'sink_info': {'key': 'properties.sinkInfo', 'type': 'RoleSinkInfo'}, - 'custom_context_tag': {'key': 'properties.customContextTag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FileEventTrigger, self).__init__(**kwargs) - self.kind = 'FileEvent' # type: str - self.source_info = kwargs['source_info'] - self.sink_info = kwargs['sink_info'] - self.custom_context_tag = kwargs.get('custom_context_tag', None) - - -class FileSourceInfo(msrest.serialization.Model): - """File source details. - - All required parameters must be populated in order to send to Azure. - - :param share_id: Required. File share ID. - :type share_id: str - """ - - _validation = { - 'share_id': {'required': True}, - } - - _attribute_map = { - 'share_id': {'key': 'shareId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FileSourceInfo, self).__init__(**kwargs) - self.share_id = kwargs['share_id'] - - -class IoTDeviceInfo(msrest.serialization.Model): - """Metadata of IoT device/IoT Edge device to be configured. - - All required parameters must be populated in order to send to Azure. - - :param device_id: Required. ID of the IoT device/edge device. - :type device_id: str - :param io_t_host_hub: Required. Host name for the IoT hub associated to the device. - :type io_t_host_hub: str - :param io_t_host_hub_id: Id for the IoT hub associated to the device. - :type io_t_host_hub_id: str - :param authentication: IoT device authentication info. - :type authentication: ~azure.mgmt.databoxedge.v2019_08_01.models.Authentication - """ - - _validation = { - 'device_id': {'required': True}, - 'io_t_host_hub': {'required': True}, - } - - _attribute_map = { - 'device_id': {'key': 'deviceId', 'type': 'str'}, - 'io_t_host_hub': {'key': 'ioTHostHub', 'type': 'str'}, - 'io_t_host_hub_id': {'key': 'ioTHostHubId', 'type': 'str'}, - 'authentication': {'key': 'authentication', 'type': 'Authentication'}, - } - - def __init__( - self, - **kwargs - ): - super(IoTDeviceInfo, self).__init__(**kwargs) - self.device_id = kwargs['device_id'] - self.io_t_host_hub = kwargs['io_t_host_hub'] - self.io_t_host_hub_id = kwargs.get('io_t_host_hub_id', None) - self.authentication = kwargs.get('authentication', None) - - -class Role(ARMBaseModel): - """Compute role. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: IoTRole. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", - "ASA", "Functions", "Cognitive". - :type kind: str or ~azure.mgmt.databoxedge.v2019_08_01.models.RoleTypes - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - } - - _subtype_map = { - 'kind': {'IOT': 'IoTRole'} - } - - def __init__( - self, - **kwargs - ): - super(Role, self).__init__(**kwargs) - self.kind = 'Role' # type: str - - -class IoTRole(Role): - """Compute role. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", - "ASA", "Functions", "Cognitive". - :type kind: str or ~azure.mgmt.databoxedge.v2019_08_01.models.RoleTypes - :param host_platform: Host OS supported by the IoT role. Possible values include: "Windows", - "Linux". - :type host_platform: str or ~azure.mgmt.databoxedge.v2019_08_01.models.PlatformType - :param io_t_device_details: IoT device metadata to which data box edge device needs to be - connected. - :type io_t_device_details: ~azure.mgmt.databoxedge.v2019_08_01.models.IoTDeviceInfo - :param io_t_edge_device_details: IoT edge device to which the IoT role needs to be configured. - :type io_t_edge_device_details: ~azure.mgmt.databoxedge.v2019_08_01.models.IoTDeviceInfo - :param share_mappings: Mount points of shares in role(s). - :type share_mappings: list[~azure.mgmt.databoxedge.v2019_08_01.models.MountPointMap] - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2019_08_01.models.RoleStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'host_platform': {'key': 'properties.hostPlatform', 'type': 'str'}, - 'io_t_device_details': {'key': 'properties.ioTDeviceDetails', 'type': 'IoTDeviceInfo'}, - 'io_t_edge_device_details': {'key': 'properties.ioTEdgeDeviceDetails', 'type': 'IoTDeviceInfo'}, - 'share_mappings': {'key': 'properties.shareMappings', 'type': '[MountPointMap]'}, - 'role_status': {'key': 'properties.roleStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IoTRole, self).__init__(**kwargs) - self.kind = 'IOT' # type: str - self.host_platform = kwargs.get('host_platform', None) - self.io_t_device_details = kwargs.get('io_t_device_details', None) - self.io_t_edge_device_details = kwargs.get('io_t_edge_device_details', None) - self.share_mappings = kwargs.get('share_mappings', None) - self.role_status = kwargs.get('role_status', None) - - -class Ipv4Config(msrest.serialization.Model): - """Details related to the IPv4 address configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar ip_address: The IPv4 address of the network adapter. - :vartype ip_address: str - :ivar subnet: The IPv4 subnet of the network adapter. - :vartype subnet: str - :ivar gateway: The IPv4 gateway of the network adapter. - :vartype gateway: str - """ - - _validation = { - 'ip_address': {'readonly': True}, - 'subnet': {'readonly': True}, - 'gateway': {'readonly': True}, - } - - _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'subnet': {'key': 'subnet', 'type': 'str'}, - 'gateway': {'key': 'gateway', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Ipv4Config, self).__init__(**kwargs) - self.ip_address = None - self.subnet = None - self.gateway = None - - -class Ipv6Config(msrest.serialization.Model): - """Details related to the IPv6 address configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar ip_address: The IPv6 address of the network adapter. - :vartype ip_address: str - :ivar prefix_length: The IPv6 prefix of the network adapter. - :vartype prefix_length: int - :ivar gateway: The IPv6 gateway of the network adapter. - :vartype gateway: str - """ - - _validation = { - 'ip_address': {'readonly': True}, - 'prefix_length': {'readonly': True}, - 'gateway': {'readonly': True}, - } - - _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'prefix_length': {'key': 'prefixLength', 'type': 'int'}, - 'gateway': {'key': 'gateway', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Ipv6Config, self).__init__(**kwargs) - self.ip_address = None - self.prefix_length = None - self.gateway = None - - -class Job(msrest.serialization.Model): - """A device job. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The name of the object. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar status: The current status of the job. Possible values include: "Invalid", "Running", - "Succeeded", "Failed", "Canceled", "Paused", "Scheduled". - :vartype status: str or ~azure.mgmt.databoxedge.v2019_08_01.models.JobStatus - :ivar start_time: The UTC date and time at which the job started. - :vartype start_time: ~datetime.datetime - :ivar end_time: The UTC date and time at which the job completed. - :vartype end_time: ~datetime.datetime - :ivar percent_complete: The percentage of the job that is complete. - :vartype percent_complete: int - :ivar error: The error details. - :vartype error: ~azure.mgmt.databoxedge.v2019_08_01.models.JobErrorDetails - :ivar job_type: The type of the job. Possible values include: "Invalid", "ScanForUpdates", - "DownloadUpdates", "InstallUpdates", "RefreshShare", "RefreshContainer". - :vartype job_type: str or ~azure.mgmt.databoxedge.v2019_08_01.models.JobType - :ivar current_stage: Current stage of the update operation. Possible values include: "Unknown", - "Initial", "ScanStarted", "ScanComplete", "ScanFailed", "DownloadStarted", "DownloadComplete", - "DownloadFailed", "InstallStarted", "InstallComplete", "InstallFailed", "RebootInitiated", - "Success", "Failure", "RescanStarted", "RescanComplete", "RescanFailed". - :vartype current_stage: str or ~azure.mgmt.databoxedge.v2019_08_01.models.UpdateOperationStage - :ivar download_progress: The download progress. - :vartype download_progress: ~azure.mgmt.databoxedge.v2019_08_01.models.UpdateDownloadProgress - :ivar install_progress: The install progress. - :vartype install_progress: ~azure.mgmt.databoxedge.v2019_08_01.models.UpdateInstallProgress - :ivar total_refresh_errors: Total number of errors encountered during the refresh process. - :vartype total_refresh_errors: int - :ivar error_manifest_file: Local share/remote container relative path to the error manifest - file of the refresh. - :vartype error_manifest_file: str - :ivar refreshed_entity_id: ARM ID of the entity that was refreshed. - :vartype refreshed_entity_id: str - :param folder: If only subfolders need to be refreshed, then the subfolder path inside the - share or container. (The path is empty if there are no subfolders.). - :type folder: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'status': {'readonly': True}, - 'start_time': {'readonly': True}, - 'end_time': {'readonly': True}, - 'percent_complete': {'readonly': True}, - 'error': {'readonly': True}, - 'job_type': {'readonly': True}, - 'current_stage': {'readonly': True}, - 'download_progress': {'readonly': True}, - 'install_progress': {'readonly': True}, - 'total_refresh_errors': {'readonly': True}, - 'error_manifest_file': {'readonly': True}, - 'refreshed_entity_id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'percent_complete': {'key': 'percentComplete', 'type': 'int'}, - 'error': {'key': 'error', 'type': 'JobErrorDetails'}, - 'job_type': {'key': 'properties.jobType', 'type': 'str'}, - 'current_stage': {'key': 'properties.currentStage', 'type': 'str'}, - 'download_progress': {'key': 'properties.downloadProgress', 'type': 'UpdateDownloadProgress'}, - 'install_progress': {'key': 'properties.installProgress', 'type': 'UpdateInstallProgress'}, - 'total_refresh_errors': {'key': 'properties.totalRefreshErrors', 'type': 'int'}, - 'error_manifest_file': {'key': 'properties.errorManifestFile', 'type': 'str'}, - 'refreshed_entity_id': {'key': 'properties.refreshedEntityId', 'type': 'str'}, - 'folder': {'key': 'properties.folder', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Job, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.status = None - self.start_time = None - self.end_time = None - self.percent_complete = None - self.error = None - self.job_type = None - self.current_stage = None - self.download_progress = None - self.install_progress = None - self.total_refresh_errors = None - self.error_manifest_file = None - self.refreshed_entity_id = None - self.folder = kwargs.get('folder', None) - - -class JobErrorDetails(msrest.serialization.Model): - """The job error information containing the list of job errors. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error_details: The error details. - :vartype error_details: list[~azure.mgmt.databoxedge.v2019_08_01.models.JobErrorItem] - :ivar code: The code intended for programmatic access. - :vartype code: str - :ivar message: The message that describes the error in detail. - :vartype message: str - """ - - _validation = { - 'error_details': {'readonly': True}, - 'code': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'error_details': {'key': 'errorDetails', 'type': '[JobErrorItem]'}, - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(JobErrorDetails, self).__init__(**kwargs) - self.error_details = None - self.code = None - self.message = None - - -class JobErrorItem(msrest.serialization.Model): - """The job error items. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar recommendations: The recommended actions. - :vartype recommendations: list[str] - :ivar code: The code intended for programmatic access. - :vartype code: str - :ivar message: The message that describes the error in detail. - :vartype message: str - """ - - _validation = { - 'recommendations': {'readonly': True}, - 'code': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'recommendations': {'key': 'recommendations', 'type': '[str]'}, - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(JobErrorItem, self).__init__(**kwargs) - self.recommendations = None - self.code = None - self.message = None - - -class MetricDimensionV1(msrest.serialization.Model): - """Metric Dimension v1. - - :param name: Name of the metrics dimension. - :type name: str - :param display_name: Display name of the metrics dimension. - :type display_name: str - :param to_be_exported_for_shoebox: To be exported to shoe box. - :type to_be_exported_for_shoebox: bool - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricDimensionV1, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) - - -class MetricSpecificationV1(msrest.serialization.Model): - """Metric specification version 1. - - :param name: Name of the metric. - :type name: str - :param display_name: Display name of the metric. - :type display_name: str - :param display_description: Description of the metric to be displayed. - :type display_description: str - :param unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", - "Seconds", "Milliseconds", "Bytes", "BytesPerSecond", "CountPerSecond". - :type unit: str or ~azure.mgmt.databoxedge.v2019_08_01.models.MetricUnit - :param aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", - "None", "Average", "Minimum", "Maximum", "Total", "Count". - :type aggregation_type: str or ~azure.mgmt.databoxedge.v2019_08_01.models.MetricAggregationType - :param dimensions: Metric dimensions, other than default dimension which is resource. - :type dimensions: list[~azure.mgmt.databoxedge.v2019_08_01.models.MetricDimensionV1] - :param fill_gap_with_zero: Set true to fill the gaps with zero. - :type fill_gap_with_zero: bool - :param category: Metric category. Possible values include: "Capacity", "Transaction". - :type category: str or ~azure.mgmt.databoxedge.v2019_08_01.models.MetricCategory - :param resource_id_dimension_name_override: Resource name override. - :type resource_id_dimension_name_override: str - :param supported_time_grain_types: Support granularity of metrics. - :type supported_time_grain_types: list[str or - ~azure.mgmt.databoxedge.v2019_08_01.models.TimeGrain] - :param supported_aggregation_types: Support metric aggregation type. - :type supported_aggregation_types: list[str or - ~azure.mgmt.databoxedge.v2019_08_01.models.MetricAggregationType] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[MetricDimensionV1]'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'category': {'key': 'category', 'type': 'str'}, - 'resource_id_dimension_name_override': {'key': 'resourceIdDimensionNameOverride', 'type': 'str'}, - 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, - 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricSpecificationV1, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.dimensions = kwargs.get('dimensions', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.category = kwargs.get('category', None) - self.resource_id_dimension_name_override = kwargs.get('resource_id_dimension_name_override', None) - self.supported_time_grain_types = kwargs.get('supported_time_grain_types', None) - self.supported_aggregation_types = kwargs.get('supported_aggregation_types', None) - - -class MountPointMap(msrest.serialization.Model): - """The share mount point. - - 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 share_id: Required. ID of the share mounted to the role VM. - :type share_id: str - :ivar role_id: ID of the role to which share is mounted. - :vartype role_id: str - :ivar mount_point: Mount point for the share. - :vartype mount_point: str - :ivar role_type: Role type. Possible values include: "IOT", "ASA", "Functions", "Cognitive". - :vartype role_type: str or ~azure.mgmt.databoxedge.v2019_08_01.models.RoleTypes - """ - - _validation = { - 'share_id': {'required': True}, - 'role_id': {'readonly': True}, - 'mount_point': {'readonly': True}, - 'role_type': {'readonly': True}, - } - - _attribute_map = { - 'share_id': {'key': 'shareId', 'type': 'str'}, - 'role_id': {'key': 'roleId', 'type': 'str'}, - 'mount_point': {'key': 'mountPoint', 'type': 'str'}, - 'role_type': {'key': 'roleType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MountPointMap, self).__init__(**kwargs) - self.share_id = kwargs['share_id'] - self.role_id = None - self.mount_point = None - self.role_type = None - - -class NetworkAdapter(msrest.serialization.Model): - """Represents the networkAdapter on a device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar adapter_id: Instance ID of network adapter. - :vartype adapter_id: str - :ivar adapter_position: Hardware position of network adapter. - :vartype adapter_position: ~azure.mgmt.databoxedge.v2019_08_01.models.NetworkAdapterPosition - :ivar index: Logical index of the adapter. - :vartype index: int - :ivar node_id: Node ID of the network adapter. - :vartype node_id: str - :ivar network_adapter_name: Network adapter name. - :vartype network_adapter_name: str - :ivar label: Hardware label for the adapter. - :vartype label: str - :ivar mac_address: MAC address. - :vartype mac_address: str - :ivar link_speed: Link speed. - :vartype link_speed: long - :ivar status: Value indicating whether this adapter is valid. Possible values include: - "Inactive", "Active". - :vartype status: str or ~azure.mgmt.databoxedge.v2019_08_01.models.NetworkAdapterStatus - :param rdma_status: Value indicating whether this adapter is RDMA capable. Possible values - include: "Incapable", "Capable". - :type rdma_status: str or ~azure.mgmt.databoxedge.v2019_08_01.models.NetworkAdapterRDMAStatus - :param dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values - include: "Disabled", "Enabled". - :type dhcp_status: str or ~azure.mgmt.databoxedge.v2019_08_01.models.NetworkAdapterDHCPStatus - :ivar ipv4_configuration: The IPv4 configuration of the network adapter. - :vartype ipv4_configuration: ~azure.mgmt.databoxedge.v2019_08_01.models.Ipv4Config - :ivar ipv6_configuration: The IPv6 configuration of the network adapter. - :vartype ipv6_configuration: ~azure.mgmt.databoxedge.v2019_08_01.models.Ipv6Config - :ivar ipv6_link_local_address: The IPv6 local address. - :vartype ipv6_link_local_address: str - :ivar dns_servers: The list of DNS Servers of the device. - :vartype dns_servers: list[str] - """ - - _validation = { - 'adapter_id': {'readonly': True}, - 'adapter_position': {'readonly': True}, - 'index': {'readonly': True}, - 'node_id': {'readonly': True}, - 'network_adapter_name': {'readonly': True}, - 'label': {'readonly': True}, - 'mac_address': {'readonly': True}, - 'link_speed': {'readonly': True}, - 'status': {'readonly': True}, - 'ipv4_configuration': {'readonly': True}, - 'ipv6_configuration': {'readonly': True}, - 'ipv6_link_local_address': {'readonly': True}, - 'dns_servers': {'readonly': True}, - } - - _attribute_map = { - 'adapter_id': {'key': 'adapterId', 'type': 'str'}, - 'adapter_position': {'key': 'adapterPosition', 'type': 'NetworkAdapterPosition'}, - 'index': {'key': 'index', 'type': 'int'}, - 'node_id': {'key': 'nodeId', 'type': 'str'}, - 'network_adapter_name': {'key': 'networkAdapterName', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'mac_address': {'key': 'macAddress', 'type': 'str'}, - 'link_speed': {'key': 'linkSpeed', 'type': 'long'}, - 'status': {'key': 'status', 'type': 'str'}, - 'rdma_status': {'key': 'rdmaStatus', 'type': 'str'}, - 'dhcp_status': {'key': 'dhcpStatus', 'type': 'str'}, - 'ipv4_configuration': {'key': 'ipv4Configuration', 'type': 'Ipv4Config'}, - 'ipv6_configuration': {'key': 'ipv6Configuration', 'type': 'Ipv6Config'}, - 'ipv6_link_local_address': {'key': 'ipv6LinkLocalAddress', 'type': 'str'}, - 'dns_servers': {'key': 'dnsServers', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkAdapter, self).__init__(**kwargs) - self.adapter_id = None - self.adapter_position = None - self.index = None - self.node_id = None - self.network_adapter_name = None - self.label = None - self.mac_address = None - self.link_speed = None - self.status = None - self.rdma_status = kwargs.get('rdma_status', None) - self.dhcp_status = kwargs.get('dhcp_status', None) - self.ipv4_configuration = None - self.ipv6_configuration = None - self.ipv6_link_local_address = None - self.dns_servers = None - - -class NetworkAdapterPosition(msrest.serialization.Model): - """The network adapter position. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar network_group: The network group. Possible values include: "None", "NonRDMA", "RDMA". - :vartype network_group: str or ~azure.mgmt.databoxedge.v2019_08_01.models.NetworkGroup - :ivar port: The port. - :vartype port: int - """ - - _validation = { - 'network_group': {'readonly': True}, - 'port': {'readonly': True}, - } - - _attribute_map = { - 'network_group': {'key': 'networkGroup', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkAdapterPosition, self).__init__(**kwargs) - self.network_group = None - self.port = None - - -class NetworkSettings(ARMBaseModel): - """The network settings of a device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar network_adapters: The network adapter list on the device. - :vartype network_adapters: list[~azure.mgmt.databoxedge.v2019_08_01.models.NetworkAdapter] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'network_adapters': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'network_adapters': {'key': 'properties.networkAdapters', 'type': '[NetworkAdapter]'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkSettings, self).__init__(**kwargs) - self.network_adapters = None - - -class Node(ARMBaseModel): - """Represents a single node in a Data box Edge/Gateway device -Gateway devices, standalone Edge devices and a single node cluster Edge device will all have 1 node -Multi-node Edge devices will have more than 1 nodes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar node_status: The current status of the individual node. Possible values include: - "Unknown", "Up", "Down", "Rebooting", "ShuttingDown". - :vartype node_status: str or ~azure.mgmt.databoxedge.v2019_08_01.models.NodeStatus - :ivar node_chassis_serial_number: Serial number of the Chassis. - :vartype node_chassis_serial_number: str - :ivar node_serial_number: Serial number of the individual node. - :vartype node_serial_number: str - :ivar node_display_name: Display Name of the individual node. - :vartype node_display_name: str - :ivar node_friendly_software_version: Friendly software version name that is currently - installed on the node. - :vartype node_friendly_software_version: str - :ivar node_hcs_version: HCS version that is currently installed on the node. - :vartype node_hcs_version: str - :ivar node_instance_id: Guid instance id of the node. - :vartype node_instance_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'node_status': {'readonly': True}, - 'node_chassis_serial_number': {'readonly': True}, - 'node_serial_number': {'readonly': True}, - 'node_display_name': {'readonly': True}, - 'node_friendly_software_version': {'readonly': True}, - 'node_hcs_version': {'readonly': True}, - 'node_instance_id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'node_status': {'key': 'properties.nodeStatus', 'type': 'str'}, - 'node_chassis_serial_number': {'key': 'properties.nodeChassisSerialNumber', 'type': 'str'}, - 'node_serial_number': {'key': 'properties.nodeSerialNumber', 'type': 'str'}, - 'node_display_name': {'key': 'properties.nodeDisplayName', 'type': 'str'}, - 'node_friendly_software_version': {'key': 'properties.nodeFriendlySoftwareVersion', 'type': 'str'}, - 'node_hcs_version': {'key': 'properties.nodeHcsVersion', 'type': 'str'}, - 'node_instance_id': {'key': 'properties.nodeInstanceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Node, self).__init__(**kwargs) - self.node_status = None - self.node_chassis_serial_number = None - self.node_serial_number = None - self.node_display_name = None - self.node_friendly_software_version = None - self.node_hcs_version = None - self.node_instance_id = None - - -class NodeList(msrest.serialization.Model): - """Collection of Nodes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of Nodes. - :vartype value: list[~azure.mgmt.databoxedge.v2019_08_01.models.Node] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Node]'}, - } - - def __init__( - self, - **kwargs - ): - super(NodeList, self).__init__(**kwargs) - self.value = None - - -class Operation(msrest.serialization.Model): - """Operations. - - :param name: Name of the operation. - :type name: str - :param display: Properties displayed for the operation. - :type display: ~azure.mgmt.databoxedge.v2019_08_01.models.OperationDisplay - :param origin: Origin of the operation. - :type origin: str - :param service_specification: Service specification. - :type service_specification: ~azure.mgmt.databoxedge.v2019_08_01.models.ServiceSpecification - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplay(msrest.serialization.Model): - """Operation display properties. - - :param provider: Provider name. - :type provider: str - :param resource: The type of resource in which the operation is performed. - :type resource: str - :param operation: Operation to be performed on the resource. - :type operation: str - :param description: Description of the operation to be performed. - :type description: str - """ - - _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 - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationsList(msrest.serialization.Model): - """The list of operations used for the discovery of available provider operations. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The value. - :type value: list[~azure.mgmt.databoxedge.v2019_08_01.models.Operation] - :param next_link: Link to the next set of results. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationsList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class Order(ARMBaseModel): - """The order details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param contact_information: The contact details. - :type contact_information: ~azure.mgmt.databoxedge.v2019_08_01.models.ContactDetails - :param shipping_address: The shipping address. - :type shipping_address: ~azure.mgmt.databoxedge.v2019_08_01.models.Address - :param current_status: Current status of the order. - :type current_status: ~azure.mgmt.databoxedge.v2019_08_01.models.OrderStatus - :ivar order_history: List of status changes in the order. - :vartype order_history: list[~azure.mgmt.databoxedge.v2019_08_01.models.OrderStatus] - :ivar serial_number: Serial number of the device. - :vartype serial_number: str - :ivar delivery_tracking_info: Tracking information for the package delivered to the customer - whether it has an original or a replacement device. - :vartype delivery_tracking_info: list[~azure.mgmt.databoxedge.v2019_08_01.models.TrackingInfo] - :ivar return_tracking_info: Tracking information for the package returned from the customer - whether it has an original or a replacement device. - :vartype return_tracking_info: list[~azure.mgmt.databoxedge.v2019_08_01.models.TrackingInfo] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'order_history': {'readonly': True}, - 'serial_number': {'readonly': True}, - 'delivery_tracking_info': {'readonly': True}, - 'return_tracking_info': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'contact_information': {'key': 'properties.contactInformation', 'type': 'ContactDetails'}, - 'shipping_address': {'key': 'properties.shippingAddress', 'type': 'Address'}, - 'current_status': {'key': 'properties.currentStatus', 'type': 'OrderStatus'}, - 'order_history': {'key': 'properties.orderHistory', 'type': '[OrderStatus]'}, - 'serial_number': {'key': 'properties.serialNumber', 'type': 'str'}, - 'delivery_tracking_info': {'key': 'properties.deliveryTrackingInfo', 'type': '[TrackingInfo]'}, - 'return_tracking_info': {'key': 'properties.returnTrackingInfo', 'type': '[TrackingInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(Order, self).__init__(**kwargs) - self.contact_information = kwargs.get('contact_information', None) - self.shipping_address = kwargs.get('shipping_address', None) - self.current_status = kwargs.get('current_status', None) - self.order_history = None - self.serial_number = None - self.delivery_tracking_info = None - self.return_tracking_info = None - - -class OrderList(msrest.serialization.Model): - """List of order entities. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of orders. - :vartype value: list[~azure.mgmt.databoxedge.v2019_08_01.models.Order] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Order]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OrderList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class OrderStatus(msrest.serialization.Model): - """Represents a single status change. - - 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 status: Required. Status of the order as per the allowed status types. Possible values - include: "Untracked", "AwaitingFulfilment", "AwaitingPreparation", "AwaitingShipment", - "Shipped", "Arriving", "Delivered", "ReplacementRequested", "LostDevice", "Declined", - "ReturnInitiated", "AwaitingReturnShipment", "ShippedBack", "CollectedAtMicrosoft". - :type status: str or ~azure.mgmt.databoxedge.v2019_08_01.models.OrderState - :ivar update_date_time: Time of status update. - :vartype update_date_time: ~datetime.datetime - :param comments: Comments related to this status change. - :type comments: str - :ivar additional_order_details: Dictionary to hold generic information which is not stored - by the already existing properties. - :vartype additional_order_details: dict[str, str] - """ - - _validation = { - 'status': {'required': True}, - 'update_date_time': {'readonly': True}, - 'additional_order_details': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'update_date_time': {'key': 'updateDateTime', 'type': 'iso-8601'}, - 'comments': {'key': 'comments', 'type': 'str'}, - 'additional_order_details': {'key': 'additionalOrderDetails', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(OrderStatus, self).__init__(**kwargs) - self.status = kwargs['status'] - self.update_date_time = None - self.comments = kwargs.get('comments', None) - self.additional_order_details = None - - -class PeriodicTimerEventTrigger(Trigger): - """Trigger details. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: - "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2019_08_01.models.TriggerEventType - :param source_info: Required. Periodic timer details. - :type source_info: ~azure.mgmt.databoxedge.v2019_08_01.models.PeriodicTimerSourceInfo - :param sink_info: Required. Role Sink information. - :type sink_info: ~azure.mgmt.databoxedge.v2019_08_01.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against - its usage. For example, if a periodic timer trigger is intended for certain specific IoT - modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'source_info': {'required': True}, - 'sink_info': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'source_info': {'key': 'properties.sourceInfo', 'type': 'PeriodicTimerSourceInfo'}, - 'sink_info': {'key': 'properties.sinkInfo', 'type': 'RoleSinkInfo'}, - 'custom_context_tag': {'key': 'properties.customContextTag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PeriodicTimerEventTrigger, self).__init__(**kwargs) - self.kind = 'PeriodicTimerEvent' # type: str - self.source_info = kwargs['source_info'] - self.sink_info = kwargs['sink_info'] - self.custom_context_tag = kwargs.get('custom_context_tag', None) - - -class PeriodicTimerSourceInfo(msrest.serialization.Model): - """Periodic timer event source. - - All required parameters must be populated in order to send to Azure. - - :param start_time: Required. The time of the day that results in a valid trigger. Schedule is - computed with reference to the time specified upto seconds. If timezone is not specified the - time will considered to be in device timezone. The value will always be returned as UTC time. - :type start_time: ~datetime.datetime - :param schedule: Required. Periodic frequency at which timer event needs to be raised. Supports - daily, hourly, minutes, and seconds. - :type schedule: str - :param topic: Topic where periodic events are published to IoT device. - :type topic: str - """ - - _validation = { - 'start_time': {'required': True}, - 'schedule': {'required': True}, - } - - _attribute_map = { - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'schedule': {'key': 'schedule', 'type': 'str'}, - 'topic': {'key': 'topic', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PeriodicTimerSourceInfo, self).__init__(**kwargs) - self.start_time = kwargs['start_time'] - self.schedule = kwargs['schedule'] - self.topic = kwargs.get('topic', None) - - -class RefreshDetails(msrest.serialization.Model): - """Fields for tracking refresh job on the share or container. - - :param in_progress_refresh_job_id: If a refresh job is currently in progress on this share or - container, this field indicates the ARM resource ID of that job. The field is empty if no job - is in progress. - :type in_progress_refresh_job_id: str - :param last_completed_refresh_job_time_in_utc: Indicates the completed time for the last - refresh job on this particular share or container, if any.This could be a failed job or a - successful job. - :type last_completed_refresh_job_time_in_utc: ~datetime.datetime - :param error_manifest_file: Indicates the relative path of the error xml for the last refresh - job on this particular share or container, if any. This could be a failed job or a successful - job. - :type error_manifest_file: str - :param last_job: Indicates the id of the last refresh job on this particular share or - container,if any. This could be a failed job or a successful job. - :type last_job: str - """ - - _attribute_map = { - 'in_progress_refresh_job_id': {'key': 'inProgressRefreshJobId', 'type': 'str'}, - 'last_completed_refresh_job_time_in_utc': {'key': 'lastCompletedRefreshJobTimeInUTC', 'type': 'iso-8601'}, - 'error_manifest_file': {'key': 'errorManifestFile', 'type': 'str'}, - 'last_job': {'key': 'lastJob', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RefreshDetails, self).__init__(**kwargs) - self.in_progress_refresh_job_id = kwargs.get('in_progress_refresh_job_id', None) - self.last_completed_refresh_job_time_in_utc = kwargs.get('last_completed_refresh_job_time_in_utc', None) - self.error_manifest_file = kwargs.get('error_manifest_file', None) - self.last_job = kwargs.get('last_job', None) - - -class ResourceTypeSku(msrest.serialization.Model): - """SkuInformation object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar resource_type: The type of the resource. - :vartype resource_type: str - :ivar name: The Sku name. Possible values include: "Gateway", "Edge", "TEA_1Node", - "TEA_1Node_UPS", "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", - "TEA_4Node_UPS_Heater", "TMA". - :vartype name: str or ~azure.mgmt.databoxedge.v2019_08_01.models.SkuName - :ivar kind: The Sku kind. - :vartype kind: str - :ivar tier: The Sku tier. Possible values include: "Standard". - :vartype tier: str or ~azure.mgmt.databoxedge.v2019_08_01.models.SkuTier - :ivar family: The Sku family. - :vartype family: str - :ivar locations: Availability of the SKU for the region. - :vartype locations: list[str] - :ivar api_versions: The API versions in which SKU is available. - :vartype api_versions: list[str] - :ivar location_info: Availability of the SKU for the location/zone. - :vartype location_info: list[~azure.mgmt.databoxedge.v2019_08_01.models.SkuLocationInfo] - :ivar costs: The pricing info of the Sku. - :vartype costs: list[~azure.mgmt.databoxedge.v2019_08_01.models.SkuCost] - :ivar restrictions: Restrictions of the SKU availability. - :vartype restrictions: list[~azure.mgmt.databoxedge.v2019_08_01.models.SkuRestriction] - """ - - _validation = { - 'resource_type': {'readonly': True}, - 'name': {'readonly': True}, - 'kind': {'readonly': True}, - 'tier': {'readonly': True}, - 'family': {'readonly': True}, - 'locations': {'readonly': True}, - 'api_versions': {'readonly': True}, - 'location_info': {'readonly': True}, - 'costs': {'readonly': True}, - 'restrictions': {'readonly': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'family': {'key': 'family', 'type': 'str'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'api_versions': {'key': 'apiVersions', 'type': '[str]'}, - 'location_info': {'key': 'locationInfo', 'type': '[SkuLocationInfo]'}, - 'costs': {'key': 'costs', 'type': '[SkuCost]'}, - 'restrictions': {'key': 'restrictions', 'type': '[SkuRestriction]'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceTypeSku, self).__init__(**kwargs) - self.resource_type = None - self.name = None - self.kind = None - self.tier = None - self.family = None - self.locations = None - self.api_versions = None - self.location_info = None - self.costs = None - self.restrictions = None - - -class RoleList(msrest.serialization.Model): - """Collection of all the roles on the Data Box Edge device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The Value. - :vartype value: list[~azure.mgmt.databoxedge.v2019_08_01.models.Role] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Role]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RoleList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class RoleSinkInfo(msrest.serialization.Model): - """Compute role against which events will be raised. - - All required parameters must be populated in order to send to Azure. - - :param role_id: Required. Compute role ID. - :type role_id: str - """ - - _validation = { - 'role_id': {'required': True}, - } - - _attribute_map = { - 'role_id': {'key': 'roleId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RoleSinkInfo, self).__init__(**kwargs) - self.role_id = kwargs['role_id'] - - -class SecuritySettings(ARMBaseModel): - """The security settings of a device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param device_admin_password: Required. Device administrator password as an encrypted string - (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual - password should have at least 8 characters that are a combination of uppercase, lowercase, - numeric, and special characters. - :type device_admin_password: - ~azure.mgmt.databoxedge.v2019_08_01.models.AsymmetricEncryptedSecret - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'device_admin_password': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'device_admin_password': {'key': 'properties.deviceAdminPassword', 'type': 'AsymmetricEncryptedSecret'}, - } - - def __init__( - self, - **kwargs - ): - super(SecuritySettings, self).__init__(**kwargs) - self.device_admin_password = kwargs['device_admin_password'] - - -class ServiceSpecification(msrest.serialization.Model): - """Service specification. - - :param metric_specifications: Metric specification as defined by shoebox. - :type metric_specifications: - list[~azure.mgmt.databoxedge.v2019_08_01.models.MetricSpecificationV1] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecificationV1]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class Share(ARMBaseModel): - """Represents a share on the Data Box Edge/Gateway device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param description: Description for the share. - :type description: str - :param share_status: Required. Current status of the share. Possible values include: "Offline", - "Unknown", "OK", "Updating", "NeedsAttention". - :type share_status: str or ~azure.mgmt.databoxedge.v2019_08_01.models.ShareStatus - :param monitoring_status: Required. Current monitoring status of the share. Possible values - include: "Enabled", "Disabled". - :type monitoring_status: str or ~azure.mgmt.databoxedge.v2019_08_01.models.MonitoringStatus - :param azure_container_info: Azure container mapping for the share. - :type azure_container_info: ~azure.mgmt.databoxedge.v2019_08_01.models.AzureContainerInfo - :param access_protocol: Required. Access protocol to be used by the share. Possible values - include: "SMB", "NFS". - :type access_protocol: str or ~azure.mgmt.databoxedge.v2019_08_01.models.ShareAccessProtocol - :param user_access_rights: Mapping of users and corresponding access rights on the share - (required for SMB protocol). - :type user_access_rights: list[~azure.mgmt.databoxedge.v2019_08_01.models.UserAccessRight] - :param client_access_rights: List of IP addresses and corresponding access rights on the - share(required for NFS protocol). - :type client_access_rights: list[~azure.mgmt.databoxedge.v2019_08_01.models.ClientAccessRight] - :param refresh_details: Details of the refresh job on this share. - :type refresh_details: ~azure.mgmt.databoxedge.v2019_08_01.models.RefreshDetails - :ivar share_mappings: Share mount point to the role. - :vartype share_mappings: list[~azure.mgmt.databoxedge.v2019_08_01.models.MountPointMap] - :param data_policy: Data policy of the share. Possible values include: "Cloud", "Local". - :type data_policy: str or ~azure.mgmt.databoxedge.v2019_08_01.models.DataPolicy - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'share_status': {'required': True}, - 'monitoring_status': {'required': True}, - 'access_protocol': {'required': True}, - 'share_mappings': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'share_status': {'key': 'properties.shareStatus', 'type': 'str'}, - 'monitoring_status': {'key': 'properties.monitoringStatus', 'type': 'str'}, - 'azure_container_info': {'key': 'properties.azureContainerInfo', 'type': 'AzureContainerInfo'}, - 'access_protocol': {'key': 'properties.accessProtocol', 'type': 'str'}, - 'user_access_rights': {'key': 'properties.userAccessRights', 'type': '[UserAccessRight]'}, - 'client_access_rights': {'key': 'properties.clientAccessRights', 'type': '[ClientAccessRight]'}, - 'refresh_details': {'key': 'properties.refreshDetails', 'type': 'RefreshDetails'}, - 'share_mappings': {'key': 'properties.shareMappings', 'type': '[MountPointMap]'}, - 'data_policy': {'key': 'properties.dataPolicy', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Share, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.share_status = kwargs['share_status'] - self.monitoring_status = kwargs['monitoring_status'] - self.azure_container_info = kwargs.get('azure_container_info', None) - self.access_protocol = kwargs['access_protocol'] - self.user_access_rights = kwargs.get('user_access_rights', None) - self.client_access_rights = kwargs.get('client_access_rights', None) - self.refresh_details = kwargs.get('refresh_details', None) - self.share_mappings = None - self.data_policy = kwargs.get('data_policy', None) - - -class ShareAccessRight(msrest.serialization.Model): - """Specifies the mapping between this particular user and the type of access he has on shares on this device. - - All required parameters must be populated in order to send to Azure. - - :param share_id: Required. The share ID. - :type share_id: str - :param access_type: Required. Type of access to be allowed on the share for this user. Possible - values include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2019_08_01.models.ShareAccessType - """ - - _validation = { - 'share_id': {'required': True}, - 'access_type': {'required': True}, - } - - _attribute_map = { - 'share_id': {'key': 'shareId', 'type': 'str'}, - 'access_type': {'key': 'accessType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ShareAccessRight, self).__init__(**kwargs) - self.share_id = kwargs['share_id'] - self.access_type = kwargs['access_type'] - - -class ShareList(msrest.serialization.Model): - """Collection of all the shares on the Data Box Edge/Gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of shares. - :vartype value: list[~azure.mgmt.databoxedge.v2019_08_01.models.Share] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Share]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ShareList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class Sku(msrest.serialization.Model): - """The SKU type. - - :param name: SKU name. Possible values include: "Gateway", "Edge", "TEA_1Node", - "TEA_1Node_UPS", "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", - "TEA_4Node_UPS_Heater", "TMA". - :type name: str or ~azure.mgmt.databoxedge.v2019_08_01.models.SkuName - :param tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard". - :type tier: str or ~azure.mgmt.databoxedge.v2019_08_01.models.SkuTier - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = kwargs.get('tier', None) - - -class SkuCost(msrest.serialization.Model): - """The metadata for retrieving price info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar meter_id: Used for querying price from commerce. - :vartype meter_id: str - :ivar quantity: The cost quantity. - :vartype quantity: long - :ivar extended_unit: Restriction of the SKU for the location/zone. - :vartype extended_unit: str - """ - - _validation = { - 'meter_id': {'readonly': True}, - 'quantity': {'readonly': True}, - 'extended_unit': {'readonly': True}, - } - - _attribute_map = { - 'meter_id': {'key': 'meterId', 'type': 'str'}, - 'quantity': {'key': 'quantity', 'type': 'long'}, - 'extended_unit': {'key': 'extendedUnit', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuCost, self).__init__(**kwargs) - self.meter_id = None - self.quantity = None - self.extended_unit = None - - -class SkuInformationList(msrest.serialization.Model): - """List of SKU Information objects. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of ResourceType Sku. - :vartype value: list[~azure.mgmt.databoxedge.v2019_08_01.models.ResourceTypeSku] - :ivar next_link: Links to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceTypeSku]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuInformationList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SkuLocationInfo(msrest.serialization.Model): - """The location info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar location: The location. - :vartype location: str - :ivar zones: The zones. - :vartype zones: list[str] - :ivar sites: The sites. - :vartype sites: list[str] - """ - - _validation = { - 'location': {'readonly': True}, - 'zones': {'readonly': True}, - 'sites': {'readonly': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'sites': {'key': 'sites', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuLocationInfo, self).__init__(**kwargs) - self.location = None - self.zones = None - self.sites = None - - -class SkuRestriction(msrest.serialization.Model): - """The restrictions because of which SKU cannot be used. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The type of the restriction. - :vartype type: str - :ivar values: The locations where sku is restricted. - :vartype values: list[str] - :ivar reason_code: The SKU restriction reason. Possible values include: - "NotAvailableForSubscription", "QuotaId". - :vartype reason_code: str or - ~azure.mgmt.databoxedge.v2019_08_01.models.SkuRestrictionReasonCode - :ivar restriction_info: Restriction of the SKU for the location/zone. - :vartype restriction_info: ~azure.mgmt.databoxedge.v2019_08_01.models.SkuRestrictionInfo - """ - - _validation = { - 'type': {'readonly': True}, - 'values': {'readonly': True}, - 'reason_code': {'readonly': True}, - 'restriction_info': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[str]'}, - 'reason_code': {'key': 'reasonCode', 'type': 'str'}, - 'restriction_info': {'key': 'restrictionInfo', 'type': 'SkuRestrictionInfo'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuRestriction, self).__init__(**kwargs) - self.type = None - self.values = None - self.reason_code = None - self.restriction_info = None - - -class SkuRestrictionInfo(msrest.serialization.Model): - """The restriction info with locations and zones. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar locations: The locations. - :vartype locations: list[str] - :ivar zones: The zones. - :vartype zones: list[str] - """ - - _validation = { - 'locations': {'readonly': True}, - 'zones': {'readonly': True}, - } - - _attribute_map = { - 'locations': {'key': 'locations', 'type': '[str]'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuRestrictionInfo, self).__init__(**kwargs) - self.locations = None - self.zones = None - - -class StorageAccount(ARMBaseModel): - """Represents a Storage Account on the Data Box Edge/Gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param description: Description for the storage Account. - :type description: str - :param storage_account_status: Current status of the storage account. Possible values include: - "OK", "Offline", "Unknown", "Updating", "NeedsAttention". - :type storage_account_status: str or - ~azure.mgmt.databoxedge.v2019_08_01.models.StorageAccountStatus - :param data_policy: Data policy of the storage Account. Possible values include: "Cloud", - "Local". - :type data_policy: str or ~azure.mgmt.databoxedge.v2019_08_01.models.DataPolicy - :param storage_account_credential_id: Storage Account Credential Id. - :type storage_account_credential_id: str - :ivar blob_endpoint: BlobEndpoint of Storage Account. - :vartype blob_endpoint: str - :ivar container_count: The Container Count. Present only for Storage Accounts with DataPolicy - set to Cloud. - :vartype container_count: int - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'blob_endpoint': {'readonly': True}, - 'container_count': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'storage_account_status': {'key': 'properties.storageAccountStatus', 'type': 'str'}, - 'data_policy': {'key': 'properties.dataPolicy', 'type': 'str'}, - 'storage_account_credential_id': {'key': 'properties.storageAccountCredentialId', 'type': 'str'}, - 'blob_endpoint': {'key': 'properties.blobEndpoint', 'type': 'str'}, - 'container_count': {'key': 'properties.containerCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccount, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.storage_account_status = kwargs.get('storage_account_status', None) - self.data_policy = kwargs.get('data_policy', None) - self.storage_account_credential_id = kwargs.get('storage_account_credential_id', None) - self.blob_endpoint = None - self.container_count = None - - -class StorageAccountCredential(ARMBaseModel): - """The storage account credential. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param alias: Required. Alias for the storage account. - :type alias: str - :param user_name: Username for the storage account. - :type user_name: str - :param account_key: Encrypted storage key. - :type account_key: ~azure.mgmt.databoxedge.v2019_08_01.models.AsymmetricEncryptedSecret - :param connection_string: Connection string for the storage account. Use this string if - username and account key are not specified. - :type connection_string: str - :param ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible values - include: "Enabled", "Disabled". - :type ssl_status: str or ~azure.mgmt.databoxedge.v2019_08_01.models.SSLStatus - :param blob_domain_name: Blob end point for private clouds. - :type blob_domain_name: str - :param account_type: Required. Type of storage accessed on the storage account. Possible values - include: "GeneralPurposeStorage", "BlobStorage". - :type account_type: str or ~azure.mgmt.databoxedge.v2019_08_01.models.AccountType - :param storage_account_id: Id of the storage account. - :type storage_account_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'alias': {'required': True}, - 'ssl_status': {'required': True}, - 'account_type': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'alias': {'key': 'properties.alias', 'type': 'str'}, - 'user_name': {'key': 'properties.userName', 'type': 'str'}, - 'account_key': {'key': 'properties.accountKey', 'type': 'AsymmetricEncryptedSecret'}, - 'connection_string': {'key': 'properties.connectionString', 'type': 'str'}, - 'ssl_status': {'key': 'properties.sslStatus', 'type': 'str'}, - 'blob_domain_name': {'key': 'properties.blobDomainName', 'type': 'str'}, - 'account_type': {'key': 'properties.accountType', 'type': 'str'}, - 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCredential, self).__init__(**kwargs) - self.alias = kwargs['alias'] - self.user_name = kwargs.get('user_name', None) - self.account_key = kwargs.get('account_key', None) - self.connection_string = kwargs.get('connection_string', None) - self.ssl_status = kwargs['ssl_status'] - self.blob_domain_name = kwargs.get('blob_domain_name', None) - self.account_type = kwargs['account_type'] - self.storage_account_id = kwargs.get('storage_account_id', None) - - -class StorageAccountCredentialList(msrest.serialization.Model): - """The collection of storage account credentials. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The value. - :vartype value: list[~azure.mgmt.databoxedge.v2019_08_01.models.StorageAccountCredential] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccountCredential]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCredentialList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class StorageAccountList(msrest.serialization.Model): - """Collection of all the Storage Accounts on the Data Box Edge/Gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of storageAccounts. - :vartype value: list[~azure.mgmt.databoxedge.v2019_08_01.models.StorageAccount] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccount]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SymmetricKey(msrest.serialization.Model): - """Symmetric key for authentication. - - :param connection_string: Connection string based on the symmetric key. - :type connection_string: ~azure.mgmt.databoxedge.v2019_08_01.models.AsymmetricEncryptedSecret - """ - - _attribute_map = { - 'connection_string': {'key': 'connectionString', 'type': 'AsymmetricEncryptedSecret'}, - } - - def __init__( - self, - **kwargs - ): - super(SymmetricKey, self).__init__(**kwargs) - self.connection_string = kwargs.get('connection_string', None) - - -class TrackingInfo(msrest.serialization.Model): - """Tracking courier information. - - :param serial_number: Serial number of the device being tracked. - :type serial_number: str - :param carrier_name: Name of the carrier used in the delivery. - :type carrier_name: str - :param tracking_id: Tracking ID of the shipment. - :type tracking_id: str - :param tracking_url: Tracking URL of the shipment. - :type tracking_url: str - """ - - _attribute_map = { - 'serial_number': {'key': 'serialNumber', 'type': 'str'}, - 'carrier_name': {'key': 'carrierName', 'type': 'str'}, - 'tracking_id': {'key': 'trackingId', 'type': 'str'}, - 'tracking_url': {'key': 'trackingUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackingInfo, self).__init__(**kwargs) - self.serial_number = kwargs.get('serial_number', None) - self.carrier_name = kwargs.get('carrier_name', None) - self.tracking_id = kwargs.get('tracking_id', None) - self.tracking_url = kwargs.get('tracking_url', None) - - -class TriggerList(msrest.serialization.Model): - """Collection of all trigger on the data box edge device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of triggers. - :vartype value: list[~azure.mgmt.databoxedge.v2019_08_01.models.Trigger] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Trigger]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TriggerList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class UpdateDownloadProgress(msrest.serialization.Model): - """Details about the download progress of update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar download_phase: The download phase. Possible values include: "Unknown", "Initializing", - "Downloading", "Verifying". - :vartype download_phase: str or ~azure.mgmt.databoxedge.v2019_08_01.models.DownloadPhase - :ivar percent_complete: Percentage of completion. - :vartype percent_complete: int - :ivar total_bytes_to_download: Total bytes to download. - :vartype total_bytes_to_download: float - :ivar total_bytes_downloaded: Total bytes downloaded. - :vartype total_bytes_downloaded: float - :ivar number_of_updates_to_download: Number of updates to download. - :vartype number_of_updates_to_download: int - :ivar number_of_updates_downloaded: Number of updates downloaded. - :vartype number_of_updates_downloaded: int - """ - - _validation = { - 'download_phase': {'readonly': True}, - 'percent_complete': {'readonly': True}, - 'total_bytes_to_download': {'readonly': True}, - 'total_bytes_downloaded': {'readonly': True}, - 'number_of_updates_to_download': {'readonly': True}, - 'number_of_updates_downloaded': {'readonly': True}, - } - - _attribute_map = { - 'download_phase': {'key': 'downloadPhase', 'type': 'str'}, - 'percent_complete': {'key': 'percentComplete', 'type': 'int'}, - 'total_bytes_to_download': {'key': 'totalBytesToDownload', 'type': 'float'}, - 'total_bytes_downloaded': {'key': 'totalBytesDownloaded', 'type': 'float'}, - 'number_of_updates_to_download': {'key': 'numberOfUpdatesToDownload', 'type': 'int'}, - 'number_of_updates_downloaded': {'key': 'numberOfUpdatesDownloaded', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateDownloadProgress, self).__init__(**kwargs) - self.download_phase = None - self.percent_complete = None - self.total_bytes_to_download = None - self.total_bytes_downloaded = None - self.number_of_updates_to_download = None - self.number_of_updates_downloaded = None - - -class UpdateInstallProgress(msrest.serialization.Model): - """Progress details during installation of updates. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar percent_complete: Percentage completed. - :vartype percent_complete: int - :ivar number_of_updates_to_install: Number of updates to install. - :vartype number_of_updates_to_install: int - :ivar number_of_updates_installed: Number of updates installed. - :vartype number_of_updates_installed: int - """ - - _validation = { - 'percent_complete': {'readonly': True}, - 'number_of_updates_to_install': {'readonly': True}, - 'number_of_updates_installed': {'readonly': True}, - } - - _attribute_map = { - 'percent_complete': {'key': 'percentComplete', 'type': 'int'}, - 'number_of_updates_to_install': {'key': 'numberOfUpdatesToInstall', 'type': 'int'}, - 'number_of_updates_installed': {'key': 'numberOfUpdatesInstalled', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateInstallProgress, self).__init__(**kwargs) - self.percent_complete = None - self.number_of_updates_to_install = None - self.number_of_updates_installed = None - - -class UpdateSummary(ARMBaseModel): - """Details about ongoing updates and availability of updates on the device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param device_version_number: The current version of the device in format: 1.2.17312.13.",. - :type device_version_number: str - :param friendly_device_version_name: The current version of the device in text format. - :type friendly_device_version_name: str - :param device_last_scanned_date_time: The last time when a scan was done on the device. - :type device_last_scanned_date_time: ~datetime.datetime - :param last_completed_scan_job_date_time: The time when the last scan job was completed - (success/cancelled/failed) on the appliance. - :type last_completed_scan_job_date_time: ~datetime.datetime - :ivar last_completed_download_job_date_time: The time when the last Download job was completed - (success/cancelled/failed) on the appliance. - :vartype last_completed_download_job_date_time: ~datetime.datetime - :ivar last_completed_install_job_date_time: The time when the last Install job was completed - (success/cancelled/failed) on the appliance. - :vartype last_completed_install_job_date_time: ~datetime.datetime - :ivar total_number_of_updates_available: The number of updates available for the current device - version as per the last device scan. - :vartype total_number_of_updates_available: int - :ivar total_number_of_updates_pending_download: The total number of items pending download. - :vartype total_number_of_updates_pending_download: int - :ivar total_number_of_updates_pending_install: The total number of items pending install. - :vartype total_number_of_updates_pending_install: int - :ivar reboot_behavior: Indicates if updates are available and at least one of the updates needs - a reboot. Possible values include: "NeverReboots", "RequiresReboot", "RequestReboot". - :vartype reboot_behavior: str or - ~azure.mgmt.databoxedge.v2019_08_01.models.InstallRebootBehavior - :ivar ongoing_update_operation: The current update operation. Possible values include: "None", - "Scan", "Download", "Install". - :vartype ongoing_update_operation: str or - ~azure.mgmt.databoxedge.v2019_08_01.models.UpdateOperation - :ivar in_progress_download_job_id: The job ID of the download job in progress. - :vartype in_progress_download_job_id: str - :ivar in_progress_install_job_id: The job ID of the install job in progress. - :vartype in_progress_install_job_id: str - :ivar in_progress_download_job_started_date_time: The time when the currently running download - (if any) started. - :vartype in_progress_download_job_started_date_time: ~datetime.datetime - :ivar in_progress_install_job_started_date_time: The time when the currently running install - (if any) started. - :vartype in_progress_install_job_started_date_time: ~datetime.datetime - :ivar update_titles: The list of updates available for install. - :vartype update_titles: list[str] - :ivar total_update_size_in_bytes: The total size of updates available for download in bytes. - :vartype total_update_size_in_bytes: float - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'last_completed_download_job_date_time': {'readonly': True}, - 'last_completed_install_job_date_time': {'readonly': True}, - 'total_number_of_updates_available': {'readonly': True}, - 'total_number_of_updates_pending_download': {'readonly': True}, - 'total_number_of_updates_pending_install': {'readonly': True}, - 'reboot_behavior': {'readonly': True}, - 'ongoing_update_operation': {'readonly': True}, - 'in_progress_download_job_id': {'readonly': True}, - 'in_progress_install_job_id': {'readonly': True}, - 'in_progress_download_job_started_date_time': {'readonly': True}, - 'in_progress_install_job_started_date_time': {'readonly': True}, - 'update_titles': {'readonly': True}, - 'total_update_size_in_bytes': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'device_version_number': {'key': 'properties.deviceVersionNumber', 'type': 'str'}, - 'friendly_device_version_name': {'key': 'properties.friendlyDeviceVersionName', 'type': 'str'}, - 'device_last_scanned_date_time': {'key': 'properties.deviceLastScannedDateTime', 'type': 'iso-8601'}, - 'last_completed_scan_job_date_time': {'key': 'properties.lastCompletedScanJobDateTime', 'type': 'iso-8601'}, - 'last_completed_download_job_date_time': {'key': 'properties.lastCompletedDownloadJobDateTime', 'type': 'iso-8601'}, - 'last_completed_install_job_date_time': {'key': 'properties.lastCompletedInstallJobDateTime', 'type': 'iso-8601'}, - 'total_number_of_updates_available': {'key': 'properties.totalNumberOfUpdatesAvailable', 'type': 'int'}, - 'total_number_of_updates_pending_download': {'key': 'properties.totalNumberOfUpdatesPendingDownload', 'type': 'int'}, - 'total_number_of_updates_pending_install': {'key': 'properties.totalNumberOfUpdatesPendingInstall', 'type': 'int'}, - 'reboot_behavior': {'key': 'properties.rebootBehavior', 'type': 'str'}, - 'ongoing_update_operation': {'key': 'properties.ongoingUpdateOperation', 'type': 'str'}, - 'in_progress_download_job_id': {'key': 'properties.inProgressDownloadJobId', 'type': 'str'}, - 'in_progress_install_job_id': {'key': 'properties.inProgressInstallJobId', 'type': 'str'}, - 'in_progress_download_job_started_date_time': {'key': 'properties.inProgressDownloadJobStartedDateTime', 'type': 'iso-8601'}, - 'in_progress_install_job_started_date_time': {'key': 'properties.inProgressInstallJobStartedDateTime', 'type': 'iso-8601'}, - 'update_titles': {'key': 'properties.updateTitles', 'type': '[str]'}, - 'total_update_size_in_bytes': {'key': 'properties.totalUpdateSizeInBytes', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateSummary, self).__init__(**kwargs) - self.device_version_number = kwargs.get('device_version_number', None) - self.friendly_device_version_name = kwargs.get('friendly_device_version_name', None) - self.device_last_scanned_date_time = kwargs.get('device_last_scanned_date_time', None) - self.last_completed_scan_job_date_time = kwargs.get('last_completed_scan_job_date_time', None) - self.last_completed_download_job_date_time = None - self.last_completed_install_job_date_time = None - self.total_number_of_updates_available = None - self.total_number_of_updates_pending_download = None - self.total_number_of_updates_pending_install = None - self.reboot_behavior = None - self.ongoing_update_operation = None - self.in_progress_download_job_id = None - self.in_progress_install_job_id = None - self.in_progress_download_job_started_date_time = None - self.in_progress_install_job_started_date_time = None - self.update_titles = None - self.total_update_size_in_bytes = None - - -class UploadCertificateRequest(msrest.serialization.Model): - """The upload certificate request. - - All required parameters must be populated in order to send to Azure. - - :param authentication_type: The authentication type. Possible values include: "Invalid", - "AzureActiveDirectory". - :type authentication_type: str or ~azure.mgmt.databoxedge.v2019_08_01.models.AuthenticationType - :param certificate: Required. The base64 encoded certificate raw data. - :type certificate: str - """ - - _validation = { - 'certificate': {'required': True}, - } - - _attribute_map = { - 'authentication_type': {'key': 'properties.authenticationType', 'type': 'str'}, - 'certificate': {'key': 'properties.certificate', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UploadCertificateRequest, self).__init__(**kwargs) - self.authentication_type = kwargs.get('authentication_type', None) - self.certificate = kwargs['certificate'] - - -class UploadCertificateResponse(msrest.serialization.Model): - """The upload registration certificate response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param auth_type: Specifies authentication type. Possible values include: "Invalid", - "AzureActiveDirectory". - :type auth_type: str or ~azure.mgmt.databoxedge.v2019_08_01.models.AuthenticationType - :ivar resource_id: The resource ID of the Data Box Edge/Gateway device. - :vartype resource_id: str - :ivar aad_authority: Azure Active Directory tenant authority. - :vartype aad_authority: str - :ivar aad_tenant_id: Azure Active Directory tenant ID. - :vartype aad_tenant_id: str - :ivar service_principal_client_id: Azure Active Directory service principal client ID. - :vartype service_principal_client_id: str - :ivar service_principal_object_id: Azure Active Directory service principal object ID. - :vartype service_principal_object_id: str - :ivar azure_management_endpoint_audience: The azure management endpoint audience. - :vartype azure_management_endpoint_audience: str - :ivar aad_audience: Identifier of the target resource that is the recipient of the requested - token. - :vartype aad_audience: str - """ - - _validation = { - 'resource_id': {'readonly': True}, - 'aad_authority': {'readonly': True}, - 'aad_tenant_id': {'readonly': True}, - 'service_principal_client_id': {'readonly': True}, - 'service_principal_object_id': {'readonly': True}, - 'azure_management_endpoint_audience': {'readonly': True}, - 'aad_audience': {'readonly': True}, - } - - _attribute_map = { - 'auth_type': {'key': 'authType', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'aad_authority': {'key': 'aadAuthority', 'type': 'str'}, - 'aad_tenant_id': {'key': 'aadTenantId', 'type': 'str'}, - 'service_principal_client_id': {'key': 'servicePrincipalClientId', 'type': 'str'}, - 'service_principal_object_id': {'key': 'servicePrincipalObjectId', 'type': 'str'}, - 'azure_management_endpoint_audience': {'key': 'azureManagementEndpointAudience', 'type': 'str'}, - 'aad_audience': {'key': 'aadAudience', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UploadCertificateResponse, self).__init__(**kwargs) - self.auth_type = kwargs.get('auth_type', None) - self.resource_id = None - self.aad_authority = None - self.aad_tenant_id = None - self.service_principal_client_id = None - self.service_principal_object_id = None - self.azure_management_endpoint_audience = None - self.aad_audience = None - - -class User(ARMBaseModel): - """Represents a user who has access to one or more shares on the Data Box Edge/Gateway device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param encrypted_password: The password details. - :type encrypted_password: ~azure.mgmt.databoxedge.v2019_08_01.models.AsymmetricEncryptedSecret - :param share_access_rights: List of shares that the user has rights on. This field should not - be specified during user creation. - :type share_access_rights: list[~azure.mgmt.databoxedge.v2019_08_01.models.ShareAccessRight] - :param user_type: Required. Type of the user. Possible values include: "Share", - "LocalManagement", "ARM". - :type user_type: str or ~azure.mgmt.databoxedge.v2019_08_01.models.UserType - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'user_type': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'encrypted_password': {'key': 'properties.encryptedPassword', 'type': 'AsymmetricEncryptedSecret'}, - 'share_access_rights': {'key': 'properties.shareAccessRights', 'type': '[ShareAccessRight]'}, - 'user_type': {'key': 'properties.userType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(User, self).__init__(**kwargs) - self.encrypted_password = kwargs.get('encrypted_password', None) - self.share_access_rights = kwargs.get('share_access_rights', None) - self.user_type = kwargs['user_type'] - - -class UserAccessRight(msrest.serialization.Model): - """The mapping between a particular user and the access type on the SMB share. - - All required parameters must be populated in order to send to Azure. - - :param user_id: Required. User ID (already existing in the device). - :type user_id: str - :param access_type: Required. Type of access to be allowed for the user. Possible values - include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2019_08_01.models.ShareAccessType - """ - - _validation = { - 'user_id': {'required': True}, - 'access_type': {'required': True}, - } - - _attribute_map = { - 'user_id': {'key': 'userId', 'type': 'str'}, - 'access_type': {'key': 'accessType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserAccessRight, self).__init__(**kwargs) - self.user_id = kwargs['user_id'] - self.access_type = kwargs['access_type'] - - -class UserList(msrest.serialization.Model): - """Collection of users. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of users. - :vartype value: list[~azure.mgmt.databoxedge.v2019_08_01.models.User] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[User]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserList, self).__init__(**kwargs) - self.value = None - self.next_link = None diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/models/_models_py3.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/models/_models_py3.py index 8127bc9f7fdb..38d700e4ae08 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/models/_models_py3.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/models/_models_py3.py @@ -19,20 +19,20 @@ class Address(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param address_line1: Required. The address line1. - :type address_line1: str - :param address_line2: The address line2. - :type address_line2: str - :param address_line3: The address line3. - :type address_line3: str - :param postal_code: Required. The postal code. - :type postal_code: str - :param city: Required. The city name. - :type city: str - :param state: Required. The state name. - :type state: str - :param country: Required. The country name. - :type country: str + :ivar address_line1: Required. The address line1. + :vartype address_line1: str + :ivar address_line2: The address line2. + :vartype address_line2: str + :ivar address_line3: The address line3. + :vartype address_line3: str + :ivar postal_code: Required. The postal code. + :vartype postal_code: str + :ivar city: Required. The city name. + :vartype city: str + :ivar state: Required. The state name. + :vartype state: str + :ivar country: Required. The country name. + :vartype country: str """ _validation = { @@ -65,6 +65,22 @@ def __init__( address_line3: Optional[str] = None, **kwargs ): + """ + :keyword address_line1: Required. The address line1. + :paramtype address_line1: str + :keyword address_line2: The address line2. + :paramtype address_line2: str + :keyword address_line3: The address line3. + :paramtype address_line3: str + :keyword postal_code: Required. The postal code. + :paramtype postal_code: str + :keyword city: Required. The city name. + :paramtype city: str + :keyword state: Required. The state name. + :paramtype state: str + :keyword country: Required. The country name. + :paramtype country: str + """ super(Address, self).__init__(**kwargs) self.address_line1 = address_line1 self.address_line2 = address_line2 @@ -104,6 +120,8 @@ def __init__( self, **kwargs ): + """ + """ super(ARMBaseModel, self).__init__(**kwargs) self.id = None self.name = None @@ -168,6 +186,8 @@ def __init__( self, **kwargs ): + """ + """ super(Alert, self).__init__(**kwargs) self.title = None self.alert_type = None @@ -207,6 +227,8 @@ def __init__( self, **kwargs ): + """ + """ super(AlertErrorDetails, self).__init__(**kwargs) self.error_code = None self.error_message = None @@ -238,6 +260,8 @@ def __init__( self, **kwargs ): + """ + """ super(AlertList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -248,14 +272,14 @@ class AsymmetricEncryptedSecret(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The value of the secret. - :type value: str - :param encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the + :ivar value: Required. The value of the secret. + :vartype value: str + :ivar encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the value is unencrypted, it will be null. - :type encryption_cert_thumbprint: str - :param encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values + :vartype encryption_cert_thumbprint: str + :ivar encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values include: "None", "AES256", "RSAES_PKCS1_v_1_5". - :type encryption_algorithm: str or + :vartype encryption_algorithm: str or ~azure.mgmt.databoxedge.v2019_08_01.models.EncryptionAlgorithm """ @@ -278,6 +302,17 @@ def __init__( encryption_cert_thumbprint: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The value of the secret. + :paramtype value: str + :keyword encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the + value is unencrypted, it will be null. + :paramtype encryption_cert_thumbprint: str + :keyword encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values + include: "None", "AES256", "RSAES_PKCS1_v_1_5". + :paramtype encryption_algorithm: str or + ~azure.mgmt.databoxedge.v2019_08_01.models.EncryptionAlgorithm + """ super(AsymmetricEncryptedSecret, self).__init__(**kwargs) self.value = value self.encryption_cert_thumbprint = encryption_cert_thumbprint @@ -287,8 +322,8 @@ def __init__( class Authentication(msrest.serialization.Model): """Authentication mechanism for IoT devices. - :param symmetric_key: Symmetric key for authentication. - :type symmetric_key: ~azure.mgmt.databoxedge.v2019_08_01.models.SymmetricKey + :ivar symmetric_key: Symmetric key for authentication. + :vartype symmetric_key: ~azure.mgmt.databoxedge.v2019_08_01.models.SymmetricKey """ _attribute_map = { @@ -301,6 +336,10 @@ def __init__( symmetric_key: Optional["SymmetricKey"] = None, **kwargs ): + """ + :keyword symmetric_key: Symmetric key for authentication. + :paramtype symmetric_key: ~azure.mgmt.databoxedge.v2019_08_01.models.SymmetricKey + """ super(Authentication, self).__init__(**kwargs) self.symmetric_key = symmetric_key @@ -310,15 +349,16 @@ class AzureContainerInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param storage_account_credential_id: Required. ID of the storage account credential used to + :ivar storage_account_credential_id: Required. ID of the storage account credential used to access storage. - :type storage_account_credential_id: str - :param container_name: Required. Container name (Based on the data format specified, this + :vartype storage_account_credential_id: str + :ivar container_name: Required. Container name (Based on the data format specified, this represents the name of Azure Files/Page blob/Block blob). - :type container_name: str - :param data_format: Required. Storage format used for the file represented by the share. + :vartype container_name: str + :ivar data_format: Required. Storage format used for the file represented by the share. Possible values include: "BlockBlob", "PageBlob", "AzureFile". - :type data_format: str or ~azure.mgmt.databoxedge.v2019_08_01.models.AzureContainerDataFormat + :vartype data_format: str or + ~azure.mgmt.databoxedge.v2019_08_01.models.AzureContainerDataFormat """ _validation = { @@ -341,6 +381,18 @@ def __init__( data_format: Union[str, "AzureContainerDataFormat"], **kwargs ): + """ + :keyword storage_account_credential_id: Required. ID of the storage account credential used to + access storage. + :paramtype storage_account_credential_id: str + :keyword container_name: Required. Container name (Based on the data format specified, this + represents the name of Azure Files/Page blob/Block blob). + :paramtype container_name: str + :keyword data_format: Required. Storage format used for the file represented by the share. + Possible values include: "BlockBlob", "PageBlob", "AzureFile". + :paramtype data_format: str or + ~azure.mgmt.databoxedge.v2019_08_01.models.AzureContainerDataFormat + """ super(AzureContainerInfo, self).__init__(**kwargs) self.storage_account_credential_id = storage_account_credential_id self.container_name = container_name @@ -360,14 +412,14 @@ class BandwidthSchedule(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param start: Required. The start time of the schedule in UTC. - :type start: str - :param stop: Required. The stop time of the schedule in UTC. - :type stop: str - :param rate_in_mbps: Required. The bandwidth rate in Mbps. - :type rate_in_mbps: int - :param days: Required. The days of the week when this schedule is applicable. - :type days: list[str or ~azure.mgmt.databoxedge.v2019_08_01.models.DayOfWeek] + :ivar start: Required. The start time of the schedule in UTC. + :vartype start: str + :ivar stop: Required. The stop time of the schedule in UTC. + :vartype stop: str + :ivar rate_in_mbps: Required. The bandwidth rate in Mbps. + :vartype rate_in_mbps: int + :ivar days: Required. The days of the week when this schedule is applicable. + :vartype days: list[str or ~azure.mgmt.databoxedge.v2019_08_01.models.DayOfWeek] """ _validation = { @@ -399,6 +451,16 @@ def __init__( days: List[Union[str, "DayOfWeek"]], **kwargs ): + """ + :keyword start: Required. The start time of the schedule in UTC. + :paramtype start: str + :keyword stop: Required. The stop time of the schedule in UTC. + :paramtype stop: str + :keyword rate_in_mbps: Required. The bandwidth rate in Mbps. + :paramtype rate_in_mbps: int + :keyword days: Required. The days of the week when this schedule is applicable. + :paramtype days: list[str or ~azure.mgmt.databoxedge.v2019_08_01.models.DayOfWeek] + """ super(BandwidthSchedule, self).__init__(**kwargs) self.start = start self.stop = stop @@ -431,6 +493,8 @@ def __init__( self, **kwargs ): + """ + """ super(BandwidthSchedulesList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -441,11 +505,12 @@ class ClientAccessRight(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param client: Required. IP of the client. - :type client: str - :param access_permission: Required. Type of access to be allowed for the client. Possible - values include: "NoAccess", "ReadOnly", "ReadWrite". - :type access_permission: str or ~azure.mgmt.databoxedge.v2019_08_01.models.ClientPermissionType + :ivar client: Required. IP of the client. + :vartype client: str + :ivar access_permission: Required. Type of access to be allowed for the client. Possible values + include: "NoAccess", "ReadOnly", "ReadWrite". + :vartype access_permission: str or + ~azure.mgmt.databoxedge.v2019_08_01.models.ClientPermissionType """ _validation = { @@ -465,6 +530,14 @@ def __init__( access_permission: Union[str, "ClientPermissionType"], **kwargs ): + """ + :keyword client: Required. IP of the client. + :paramtype client: str + :keyword access_permission: Required. Type of access to be allowed for the client. Possible + values include: "NoAccess", "ReadOnly", "ReadWrite". + :paramtype access_permission: str or + ~azure.mgmt.databoxedge.v2019_08_01.models.ClientPermissionType + """ super(ClientAccessRight, self).__init__(**kwargs) self.client = client self.access_permission = access_permission @@ -473,14 +546,14 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from the service. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.databoxedge.v2019_08_01.models.CloudErrorBody] + :vartype message: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.databoxedge.v2019_08_01.models.CloudErrorBody] """ _attribute_map = { @@ -497,6 +570,16 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.databoxedge.v2019_08_01.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -508,14 +591,14 @@ class ContactDetails(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param contact_person: Required. The contact person name. - :type contact_person: str - :param company_name: Required. The name of the company. - :type company_name: str - :param phone: Required. The phone number. - :type phone: str - :param email_list: Required. The email list. - :type email_list: list[str] + :ivar contact_person: Required. The contact person name. + :vartype contact_person: str + :ivar company_name: Required. The name of the company. + :vartype company_name: str + :ivar phone: Required. The phone number. + :vartype phone: str + :ivar email_list: Required. The email list. + :vartype email_list: list[str] """ _validation = { @@ -541,6 +624,16 @@ def __init__( email_list: List[str], **kwargs ): + """ + :keyword contact_person: Required. The contact person name. + :paramtype contact_person: str + :keyword company_name: Required. The name of the company. + :paramtype company_name: str + :keyword phone: Required. The phone number. + :paramtype phone: str + :keyword email_list: Required. The email list. + :paramtype email_list: list[str] + """ super(ContactDetails, self).__init__(**kwargs) self.contact_person = contact_person self.company_name = company_name @@ -564,9 +657,10 @@ class Container(ARMBaseModel): :ivar container_status: Current status of the container. Possible values include: "OK", "Offline", "Unknown", "Updating", "NeedsAttention". :vartype container_status: str or ~azure.mgmt.databoxedge.v2019_08_01.models.ContainerStatus - :param data_format: Required. DataFormat for Container. Possible values include: "BlockBlob", + :ivar data_format: Required. DataFormat for Container. Possible values include: "BlockBlob", "PageBlob", "AzureFile". - :type data_format: str or ~azure.mgmt.databoxedge.v2019_08_01.models.AzureContainerDataFormat + :vartype data_format: str or + ~azure.mgmt.databoxedge.v2019_08_01.models.AzureContainerDataFormat :ivar refresh_details: Details of the refresh job on this container. :vartype refresh_details: ~azure.mgmt.databoxedge.v2019_08_01.models.RefreshDetails :ivar created_date_time: The UTC time when container got created. @@ -599,6 +693,12 @@ def __init__( data_format: Union[str, "AzureContainerDataFormat"], **kwargs ): + """ + :keyword data_format: Required. DataFormat for Container. Possible values include: "BlockBlob", + "PageBlob", "AzureFile". + :paramtype data_format: str or + ~azure.mgmt.databoxedge.v2019_08_01.models.AzureContainerDataFormat + """ super(Container, self).__init__(**kwargs) self.container_status = None self.data_format = data_format @@ -631,6 +731,8 @@ def __init__( self, **kwargs ): + """ + """ super(ContainerList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -649,34 +751,34 @@ class DataBoxEdgeDevice(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param location: Required. The location of the device. This is a supported and registered Azure + :ivar location: Required. The location of the device. This is a supported and registered Azure geographical region (for example, West US, East US, or Southeast Asia). The geographical region of a device cannot be changed once it is created, but if an identical geographical region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. The list of tags that describe the device. These tags can be used - to view and group this device (across resource groups). - :type tags: dict[str, str] - :param sku: The SKU type. - :type sku: ~azure.mgmt.databoxedge.v2019_08_01.models.Sku - :param etag: The etag for the devices. - :type etag: str - :param data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible + :vartype location: str + :ivar tags: A set of tags. The list of tags that describe the device. These tags can be used to + view and group this device (across resource groups). + :vartype tags: dict[str, str] + :ivar sku: The SKU type. + :vartype sku: ~azure.mgmt.databoxedge.v2019_08_01.models.Sku + :ivar etag: The etag for the devices. + :vartype etag: str + :ivar data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible values include: "ReadyToSetup", "Online", "Offline", "NeedsAttention", "Disconnected", "PartiallyDisconnected", "Maintenance". - :type data_box_edge_device_status: str or + :vartype data_box_edge_device_status: str or ~azure.mgmt.databoxedge.v2019_08_01.models.DataBoxEdgeDeviceStatus :ivar serial_number: The Serial Number of Data Box Edge/Gateway device. :vartype serial_number: str - :param description: The Description of the Data Box Edge/Gateway device. - :type description: str - :param model_description: The description of the Data Box Edge/Gateway device model. - :type model_description: str + :ivar description: The Description of the Data Box Edge/Gateway device. + :vartype description: str + :ivar model_description: The description of the Data Box Edge/Gateway device model. + :vartype model_description: str :ivar device_type: The type of the Data Box Edge/Gateway device. Possible values include: "DataBoxEdgeDevice". :vartype device_type: str or ~azure.mgmt.databoxedge.v2019_08_01.models.DeviceType - :param friendly_name: The Data Box Edge/Gateway device name. - :type friendly_name: str + :ivar friendly_name: The Data Box Edge/Gateway device name. + :vartype friendly_name: str :ivar culture: The Data Box Edge/Gateway device culture. :vartype culture: str :ivar device_model: The Data Box Edge/Gateway device model. @@ -750,6 +852,31 @@ def __init__( friendly_name: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. The location of the device. This is a supported and registered + Azure geographical region (for example, West US, East US, or Southeast Asia). The geographical + region of a device cannot be changed once it is created, but if an identical geographical + region is specified on update, the request will succeed. + :paramtype location: str + :keyword tags: A set of tags. The list of tags that describe the device. These tags can be used + to view and group this device (across resource groups). + :paramtype tags: dict[str, str] + :keyword sku: The SKU type. + :paramtype sku: ~azure.mgmt.databoxedge.v2019_08_01.models.Sku + :keyword etag: The etag for the devices. + :paramtype etag: str + :keyword data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible + values include: "ReadyToSetup", "Online", "Offline", "NeedsAttention", "Disconnected", + "PartiallyDisconnected", "Maintenance". + :paramtype data_box_edge_device_status: str or + ~azure.mgmt.databoxedge.v2019_08_01.models.DataBoxEdgeDeviceStatus + :keyword description: The Description of the Data Box Edge/Gateway device. + :paramtype description: str + :keyword model_description: The description of the Data Box Edge/Gateway device model. + :paramtype model_description: str + :keyword friendly_name: The Data Box Edge/Gateway device name. + :paramtype friendly_name: str + """ super(DataBoxEdgeDevice, self).__init__(**kwargs) self.location = location self.tags = tags @@ -782,11 +909,11 @@ class DataBoxEdgeDeviceExtendedInfo(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param encryption_key_thumbprint: The digital signature of encrypted certificate. - :type encryption_key_thumbprint: str - :param encryption_key: The public part of the encryption certificate. Client uses this to + :ivar encryption_key_thumbprint: The digital signature of encrypted certificate. + :vartype encryption_key_thumbprint: str + :ivar encryption_key: The public part of the encryption certificate. Client uses this to encrypt any secret. - :type encryption_key: str + :vartype encryption_key: str :ivar resource_key: The Resource ID of the Resource. :vartype resource_key: str """ @@ -814,6 +941,13 @@ def __init__( encryption_key: Optional[str] = None, **kwargs ): + """ + :keyword encryption_key_thumbprint: The digital signature of encrypted certificate. + :paramtype encryption_key_thumbprint: str + :keyword encryption_key: The public part of the encryption certificate. Client uses this to + encrypt any secret. + :paramtype encryption_key: str + """ super(DataBoxEdgeDeviceExtendedInfo, self).__init__(**kwargs) self.encryption_key_thumbprint = encryption_key_thumbprint self.encryption_key = encryption_key @@ -845,6 +979,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataBoxEdgeDeviceList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -853,8 +989,8 @@ def __init__( class DataBoxEdgeDevicePatch(msrest.serialization.Model): """The Data Box Edge/Gateway device patch. - :param tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. - :type tags: dict[str, str] + :ivar tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -867,6 +1003,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. + :paramtype tags: dict[str, str] + """ super(DataBoxEdgeDevicePatch, self).__init__(**kwargs) self.tags = tags @@ -887,9 +1027,9 @@ class Trigger(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: + :ivar kind: Required. Trigger Kind.Constant filled by server. Possible values include: "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2019_08_01.models.TriggerEventType + :vartype kind: str or ~azure.mgmt.databoxedge.v2019_08_01.models.TriggerEventType """ _validation = { @@ -914,6 +1054,8 @@ def __init__( self, **kwargs ): + """ + """ super(Trigger, self).__init__(**kwargs) self.kind = 'Trigger' # type: str @@ -931,17 +1073,17 @@ class FileEventTrigger(Trigger): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: + :ivar kind: Required. Trigger Kind.Constant filled by server. Possible values include: "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2019_08_01.models.TriggerEventType - :param source_info: Required. File event source details. - :type source_info: ~azure.mgmt.databoxedge.v2019_08_01.models.FileSourceInfo - :param sink_info: Required. Role sink info. - :type sink_info: ~azure.mgmt.databoxedge.v2019_08_01.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against + :vartype kind: str or ~azure.mgmt.databoxedge.v2019_08_01.models.TriggerEventType + :ivar source_info: Required. File event source details. + :vartype source_info: ~azure.mgmt.databoxedge.v2019_08_01.models.FileSourceInfo + :ivar sink_info: Required. Role sink info. + :vartype sink_info: ~azure.mgmt.databoxedge.v2019_08_01.models.RoleSinkInfo + :ivar custom_context_tag: A custom context tag typically used to correlate the trigger against its usage. For example, if a periodic timer trigger is intended for certain specific IoT modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str + :vartype custom_context_tag: str """ _validation = { @@ -971,6 +1113,16 @@ def __init__( custom_context_tag: Optional[str] = None, **kwargs ): + """ + :keyword source_info: Required. File event source details. + :paramtype source_info: ~azure.mgmt.databoxedge.v2019_08_01.models.FileSourceInfo + :keyword sink_info: Required. Role sink info. + :paramtype sink_info: ~azure.mgmt.databoxedge.v2019_08_01.models.RoleSinkInfo + :keyword custom_context_tag: A custom context tag typically used to correlate the trigger + against its usage. For example, if a periodic timer trigger is intended for certain specific + IoT modules in the device, the tag can be the name or the image URL of the module. + :paramtype custom_context_tag: str + """ super(FileEventTrigger, self).__init__(**kwargs) self.kind = 'FileEvent' # type: str self.source_info = source_info @@ -983,8 +1135,8 @@ class FileSourceInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param share_id: Required. File share ID. - :type share_id: str + :ivar share_id: Required. File share ID. + :vartype share_id: str """ _validation = { @@ -1001,6 +1153,10 @@ def __init__( share_id: str, **kwargs ): + """ + :keyword share_id: Required. File share ID. + :paramtype share_id: str + """ super(FileSourceInfo, self).__init__(**kwargs) self.share_id = share_id @@ -1010,14 +1166,14 @@ class IoTDeviceInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param device_id: Required. ID of the IoT device/edge device. - :type device_id: str - :param io_t_host_hub: Required. Host name for the IoT hub associated to the device. - :type io_t_host_hub: str - :param io_t_host_hub_id: Id for the IoT hub associated to the device. - :type io_t_host_hub_id: str - :param authentication: IoT device authentication info. - :type authentication: ~azure.mgmt.databoxedge.v2019_08_01.models.Authentication + :ivar device_id: Required. ID of the IoT device/edge device. + :vartype device_id: str + :ivar io_t_host_hub: Required. Host name for the IoT hub associated to the device. + :vartype io_t_host_hub: str + :ivar io_t_host_hub_id: Id for the IoT hub associated to the device. + :vartype io_t_host_hub_id: str + :ivar authentication: IoT device authentication info. + :vartype authentication: ~azure.mgmt.databoxedge.v2019_08_01.models.Authentication """ _validation = { @@ -1041,6 +1197,16 @@ def __init__( authentication: Optional["Authentication"] = None, **kwargs ): + """ + :keyword device_id: Required. ID of the IoT device/edge device. + :paramtype device_id: str + :keyword io_t_host_hub: Required. Host name for the IoT hub associated to the device. + :paramtype io_t_host_hub: str + :keyword io_t_host_hub_id: Id for the IoT hub associated to the device. + :paramtype io_t_host_hub_id: str + :keyword authentication: IoT device authentication info. + :paramtype authentication: ~azure.mgmt.databoxedge.v2019_08_01.models.Authentication + """ super(IoTDeviceInfo, self).__init__(**kwargs) self.device_id = device_id self.io_t_host_hub = io_t_host_hub @@ -1064,9 +1230,9 @@ class Role(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive". - :type kind: str or ~azure.mgmt.databoxedge.v2019_08_01.models.RoleTypes + :vartype kind: str or ~azure.mgmt.databoxedge.v2019_08_01.models.RoleTypes """ _validation = { @@ -1091,6 +1257,8 @@ def __init__( self, **kwargs ): + """ + """ super(Role, self).__init__(**kwargs) self.kind = 'Role' # type: str @@ -1108,21 +1276,21 @@ class IoTRole(Role): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive". - :type kind: str or ~azure.mgmt.databoxedge.v2019_08_01.models.RoleTypes - :param host_platform: Host OS supported by the IoT role. Possible values include: "Windows", + :vartype kind: str or ~azure.mgmt.databoxedge.v2019_08_01.models.RoleTypes + :ivar host_platform: Host OS supported by the IoT role. Possible values include: "Windows", "Linux". - :type host_platform: str or ~azure.mgmt.databoxedge.v2019_08_01.models.PlatformType - :param io_t_device_details: IoT device metadata to which data box edge device needs to be + :vartype host_platform: str or ~azure.mgmt.databoxedge.v2019_08_01.models.PlatformType + :ivar io_t_device_details: IoT device metadata to which data box edge device needs to be connected. - :type io_t_device_details: ~azure.mgmt.databoxedge.v2019_08_01.models.IoTDeviceInfo - :param io_t_edge_device_details: IoT edge device to which the IoT role needs to be configured. - :type io_t_edge_device_details: ~azure.mgmt.databoxedge.v2019_08_01.models.IoTDeviceInfo - :param share_mappings: Mount points of shares in role(s). - :type share_mappings: list[~azure.mgmt.databoxedge.v2019_08_01.models.MountPointMap] - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2019_08_01.models.RoleStatus + :vartype io_t_device_details: ~azure.mgmt.databoxedge.v2019_08_01.models.IoTDeviceInfo + :ivar io_t_edge_device_details: IoT edge device to which the IoT role needs to be configured. + :vartype io_t_edge_device_details: ~azure.mgmt.databoxedge.v2019_08_01.models.IoTDeviceInfo + :ivar share_mappings: Mount points of shares in role(s). + :vartype share_mappings: list[~azure.mgmt.databoxedge.v2019_08_01.models.MountPointMap] + :ivar role_status: Role status. Possible values include: "Enabled", "Disabled". + :vartype role_status: str or ~azure.mgmt.databoxedge.v2019_08_01.models.RoleStatus """ _validation = { @@ -1154,6 +1322,21 @@ def __init__( role_status: Optional[Union[str, "RoleStatus"]] = None, **kwargs ): + """ + :keyword host_platform: Host OS supported by the IoT role. Possible values include: "Windows", + "Linux". + :paramtype host_platform: str or ~azure.mgmt.databoxedge.v2019_08_01.models.PlatformType + :keyword io_t_device_details: IoT device metadata to which data box edge device needs to be + connected. + :paramtype io_t_device_details: ~azure.mgmt.databoxedge.v2019_08_01.models.IoTDeviceInfo + :keyword io_t_edge_device_details: IoT edge device to which the IoT role needs to be + configured. + :paramtype io_t_edge_device_details: ~azure.mgmt.databoxedge.v2019_08_01.models.IoTDeviceInfo + :keyword share_mappings: Mount points of shares in role(s). + :paramtype share_mappings: list[~azure.mgmt.databoxedge.v2019_08_01.models.MountPointMap] + :keyword role_status: Role status. Possible values include: "Enabled", "Disabled". + :paramtype role_status: str or ~azure.mgmt.databoxedge.v2019_08_01.models.RoleStatus + """ super(IoTRole, self).__init__(**kwargs) self.kind = 'IOT' # type: str self.host_platform = host_platform @@ -1192,6 +1375,8 @@ def __init__( self, **kwargs ): + """ + """ super(Ipv4Config, self).__init__(**kwargs) self.ip_address = None self.subnet = None @@ -1227,6 +1412,8 @@ def __init__( self, **kwargs ): + """ + """ super(Ipv6Config, self).__init__(**kwargs) self.ip_address = None self.prefix_length = None @@ -1274,9 +1461,9 @@ class Job(msrest.serialization.Model): :vartype error_manifest_file: str :ivar refreshed_entity_id: ARM ID of the entity that was refreshed. :vartype refreshed_entity_id: str - :param folder: If only subfolders need to be refreshed, then the subfolder path inside the - share or container. (The path is empty if there are no subfolders.). - :type folder: str + :ivar folder: If only subfolders need to be refreshed, then the subfolder path inside the share + or container. (The path is empty if there are no subfolders.). + :vartype folder: str """ _validation = { @@ -1322,6 +1509,11 @@ def __init__( folder: Optional[str] = None, **kwargs ): + """ + :keyword folder: If only subfolders need to be refreshed, then the subfolder path inside the + share or container. (The path is empty if there are no subfolders.). + :paramtype folder: str + """ super(Job, self).__init__(**kwargs) self.id = None self.name = None @@ -1370,6 +1562,8 @@ def __init__( self, **kwargs ): + """ + """ super(JobErrorDetails, self).__init__(**kwargs) self.error_details = None self.code = None @@ -1405,6 +1599,8 @@ def __init__( self, **kwargs ): + """ + """ super(JobErrorItem, self).__init__(**kwargs) self.recommendations = None self.code = None @@ -1414,12 +1610,12 @@ def __init__( class MetricDimensionV1(msrest.serialization.Model): """Metric Dimension v1. - :param name: Name of the metrics dimension. - :type name: str - :param display_name: Display name of the metrics dimension. - :type display_name: str - :param to_be_exported_for_shoebox: To be exported to shoe box. - :type to_be_exported_for_shoebox: bool + :ivar name: Name of the metrics dimension. + :vartype name: str + :ivar display_name: Display name of the metrics dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: To be exported to shoe box. + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -1436,6 +1632,14 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): + """ + :keyword name: Name of the metrics dimension. + :paramtype name: str + :keyword display_name: Display name of the metrics dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: To be exported to shoe box. + :paramtype to_be_exported_for_shoebox: bool + """ super(MetricDimensionV1, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1445,31 +1649,32 @@ def __init__( class MetricSpecificationV1(msrest.serialization.Model): """Metric specification version 1. - :param name: Name of the metric. - :type name: str - :param display_name: Display name of the metric. - :type display_name: str - :param display_description: Description of the metric to be displayed. - :type display_description: str - :param unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Display name of the metric. + :vartype display_name: str + :ivar display_description: Description of the metric to be displayed. + :vartype display_description: str + :ivar unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", "Seconds", "Milliseconds", "Bytes", "BytesPerSecond", "CountPerSecond". - :type unit: str or ~azure.mgmt.databoxedge.v2019_08_01.models.MetricUnit - :param aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", + :vartype unit: str or ~azure.mgmt.databoxedge.v2019_08_01.models.MetricUnit + :ivar aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", "None", "Average", "Minimum", "Maximum", "Total", "Count". - :type aggregation_type: str or ~azure.mgmt.databoxedge.v2019_08_01.models.MetricAggregationType - :param dimensions: Metric dimensions, other than default dimension which is resource. - :type dimensions: list[~azure.mgmt.databoxedge.v2019_08_01.models.MetricDimensionV1] - :param fill_gap_with_zero: Set true to fill the gaps with zero. - :type fill_gap_with_zero: bool - :param category: Metric category. Possible values include: "Capacity", "Transaction". - :type category: str or ~azure.mgmt.databoxedge.v2019_08_01.models.MetricCategory - :param resource_id_dimension_name_override: Resource name override. - :type resource_id_dimension_name_override: str - :param supported_time_grain_types: Support granularity of metrics. - :type supported_time_grain_types: list[str or + :vartype aggregation_type: str or + ~azure.mgmt.databoxedge.v2019_08_01.models.MetricAggregationType + :ivar dimensions: Metric dimensions, other than default dimension which is resource. + :vartype dimensions: list[~azure.mgmt.databoxedge.v2019_08_01.models.MetricDimensionV1] + :ivar fill_gap_with_zero: Set true to fill the gaps with zero. + :vartype fill_gap_with_zero: bool + :ivar category: Metric category. Possible values include: "Capacity", "Transaction". + :vartype category: str or ~azure.mgmt.databoxedge.v2019_08_01.models.MetricCategory + :ivar resource_id_dimension_name_override: Resource name override. + :vartype resource_id_dimension_name_override: str + :ivar supported_time_grain_types: Support granularity of metrics. + :vartype supported_time_grain_types: list[str or ~azure.mgmt.databoxedge.v2019_08_01.models.TimeGrain] - :param supported_aggregation_types: Support metric aggregation type. - :type supported_aggregation_types: list[str or + :ivar supported_aggregation_types: Support metric aggregation type. + :vartype supported_aggregation_types: list[str or ~azure.mgmt.databoxedge.v2019_08_01.models.MetricAggregationType] """ @@ -1503,6 +1708,35 @@ def __init__( supported_aggregation_types: Optional[List[Union[str, "MetricAggregationType"]]] = None, **kwargs ): + """ + :keyword name: Name of the metric. + :paramtype name: str + :keyword display_name: Display name of the metric. + :paramtype display_name: str + :keyword display_description: Description of the metric to be displayed. + :paramtype display_description: str + :keyword unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", + "Seconds", "Milliseconds", "Bytes", "BytesPerSecond", "CountPerSecond". + :paramtype unit: str or ~azure.mgmt.databoxedge.v2019_08_01.models.MetricUnit + :keyword aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", + "None", "Average", "Minimum", "Maximum", "Total", "Count". + :paramtype aggregation_type: str or + ~azure.mgmt.databoxedge.v2019_08_01.models.MetricAggregationType + :keyword dimensions: Metric dimensions, other than default dimension which is resource. + :paramtype dimensions: list[~azure.mgmt.databoxedge.v2019_08_01.models.MetricDimensionV1] + :keyword fill_gap_with_zero: Set true to fill the gaps with zero. + :paramtype fill_gap_with_zero: bool + :keyword category: Metric category. Possible values include: "Capacity", "Transaction". + :paramtype category: str or ~azure.mgmt.databoxedge.v2019_08_01.models.MetricCategory + :keyword resource_id_dimension_name_override: Resource name override. + :paramtype resource_id_dimension_name_override: str + :keyword supported_time_grain_types: Support granularity of metrics. + :paramtype supported_time_grain_types: list[str or + ~azure.mgmt.databoxedge.v2019_08_01.models.TimeGrain] + :keyword supported_aggregation_types: Support metric aggregation type. + :paramtype supported_aggregation_types: list[str or + ~azure.mgmt.databoxedge.v2019_08_01.models.MetricAggregationType] + """ super(MetricSpecificationV1, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1524,8 +1758,8 @@ class MountPointMap(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param share_id: Required. ID of the share mounted to the role VM. - :type share_id: str + :ivar share_id: Required. ID of the share mounted to the role VM. + :vartype share_id: str :ivar role_id: ID of the role to which share is mounted. :vartype role_id: str :ivar mount_point: Mount point for the share. @@ -1554,6 +1788,10 @@ def __init__( share_id: str, **kwargs ): + """ + :keyword share_id: Required. ID of the share mounted to the role VM. + :paramtype share_id: str + """ super(MountPointMap, self).__init__(**kwargs) self.share_id = share_id self.role_id = None @@ -1585,12 +1823,14 @@ class NetworkAdapter(msrest.serialization.Model): :ivar status: Value indicating whether this adapter is valid. Possible values include: "Inactive", "Active". :vartype status: str or ~azure.mgmt.databoxedge.v2019_08_01.models.NetworkAdapterStatus - :param rdma_status: Value indicating whether this adapter is RDMA capable. Possible values + :ivar rdma_status: Value indicating whether this adapter is RDMA capable. Possible values include: "Incapable", "Capable". - :type rdma_status: str or ~azure.mgmt.databoxedge.v2019_08_01.models.NetworkAdapterRDMAStatus - :param dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values + :vartype rdma_status: str or + ~azure.mgmt.databoxedge.v2019_08_01.models.NetworkAdapterRDMAStatus + :ivar dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values include: "Disabled", "Enabled". - :type dhcp_status: str or ~azure.mgmt.databoxedge.v2019_08_01.models.NetworkAdapterDHCPStatus + :vartype dhcp_status: str or + ~azure.mgmt.databoxedge.v2019_08_01.models.NetworkAdapterDHCPStatus :ivar ipv4_configuration: The IPv4 configuration of the network adapter. :vartype ipv4_configuration: ~azure.mgmt.databoxedge.v2019_08_01.models.Ipv4Config :ivar ipv6_configuration: The IPv6 configuration of the network adapter. @@ -1642,6 +1882,16 @@ def __init__( dhcp_status: Optional[Union[str, "NetworkAdapterDHCPStatus"]] = None, **kwargs ): + """ + :keyword rdma_status: Value indicating whether this adapter is RDMA capable. Possible values + include: "Incapable", "Capable". + :paramtype rdma_status: str or + ~azure.mgmt.databoxedge.v2019_08_01.models.NetworkAdapterRDMAStatus + :keyword dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values + include: "Disabled", "Enabled". + :paramtype dhcp_status: str or + ~azure.mgmt.databoxedge.v2019_08_01.models.NetworkAdapterDHCPStatus + """ super(NetworkAdapter, self).__init__(**kwargs) self.adapter_id = None self.adapter_position = None @@ -1685,6 +1935,8 @@ def __init__( self, **kwargs ): + """ + """ super(NetworkAdapterPosition, self).__init__(**kwargs) self.network_group = None self.port = None @@ -1723,6 +1975,8 @@ def __init__( self, **kwargs ): + """ + """ super(NetworkSettings, self).__init__(**kwargs) self.network_adapters = None @@ -1788,6 +2042,8 @@ def __init__( self, **kwargs ): + """ + """ super(Node, self).__init__(**kwargs) self.node_status = None self.node_chassis_serial_number = None @@ -1819,6 +2075,8 @@ def __init__( self, **kwargs ): + """ + """ super(NodeList, self).__init__(**kwargs) self.value = None @@ -1826,14 +2084,14 @@ def __init__( class Operation(msrest.serialization.Model): """Operations. - :param name: Name of the operation. - :type name: str - :param display: Properties displayed for the operation. - :type display: ~azure.mgmt.databoxedge.v2019_08_01.models.OperationDisplay - :param origin: Origin of the operation. - :type origin: str - :param service_specification: Service specification. - :type service_specification: ~azure.mgmt.databoxedge.v2019_08_01.models.ServiceSpecification + :ivar name: Name of the operation. + :vartype name: str + :ivar display: Properties displayed for the operation. + :vartype display: ~azure.mgmt.databoxedge.v2019_08_01.models.OperationDisplay + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar service_specification: Service specification. + :vartype service_specification: ~azure.mgmt.databoxedge.v2019_08_01.models.ServiceSpecification """ _attribute_map = { @@ -1852,6 +2110,17 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword name: Name of the operation. + :paramtype name: str + :keyword display: Properties displayed for the operation. + :paramtype display: ~azure.mgmt.databoxedge.v2019_08_01.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword service_specification: Service specification. + :paramtype service_specification: + ~azure.mgmt.databoxedge.v2019_08_01.models.ServiceSpecification + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -1862,14 +2131,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Operation display properties. - :param provider: Provider name. - :type provider: str - :param resource: The type of resource in which the operation is performed. - :type resource: str - :param operation: Operation to be performed on the resource. - :type operation: str - :param description: Description of the operation to be performed. - :type description: str + :ivar provider: Provider name. + :vartype provider: str + :ivar resource: The type of resource in which the operation is performed. + :vartype resource: str + :ivar operation: Operation to be performed on the resource. + :vartype operation: str + :ivar description: Description of the operation to be performed. + :vartype description: str """ _attribute_map = { @@ -1888,6 +2157,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Provider name. + :paramtype provider: str + :keyword resource: The type of resource in which the operation is performed. + :paramtype resource: str + :keyword operation: Operation to be performed on the resource. + :paramtype operation: str + :keyword description: Description of the operation to be performed. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1900,10 +2179,10 @@ class OperationsList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The value. - :type value: list[~azure.mgmt.databoxedge.v2019_08_01.models.Operation] - :param next_link: Link to the next set of results. - :type next_link: str + :ivar value: Required. The value. + :vartype value: list[~azure.mgmt.databoxedge.v2019_08_01.models.Operation] + :ivar next_link: Link to the next set of results. + :vartype next_link: str """ _validation = { @@ -1922,6 +2201,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The value. + :paramtype value: list[~azure.mgmt.databoxedge.v2019_08_01.models.Operation] + :keyword next_link: Link to the next set of results. + :paramtype next_link: str + """ super(OperationsList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1938,12 +2223,12 @@ class Order(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param contact_information: The contact details. - :type contact_information: ~azure.mgmt.databoxedge.v2019_08_01.models.ContactDetails - :param shipping_address: The shipping address. - :type shipping_address: ~azure.mgmt.databoxedge.v2019_08_01.models.Address - :param current_status: Current status of the order. - :type current_status: ~azure.mgmt.databoxedge.v2019_08_01.models.OrderStatus + :ivar contact_information: The contact details. + :vartype contact_information: ~azure.mgmt.databoxedge.v2019_08_01.models.ContactDetails + :ivar shipping_address: The shipping address. + :vartype shipping_address: ~azure.mgmt.databoxedge.v2019_08_01.models.Address + :ivar current_status: Current status of the order. + :vartype current_status: ~azure.mgmt.databoxedge.v2019_08_01.models.OrderStatus :ivar order_history: List of status changes in the order. :vartype order_history: list[~azure.mgmt.databoxedge.v2019_08_01.models.OrderStatus] :ivar serial_number: Serial number of the device. @@ -1987,6 +2272,14 @@ def __init__( current_status: Optional["OrderStatus"] = None, **kwargs ): + """ + :keyword contact_information: The contact details. + :paramtype contact_information: ~azure.mgmt.databoxedge.v2019_08_01.models.ContactDetails + :keyword shipping_address: The shipping address. + :paramtype shipping_address: ~azure.mgmt.databoxedge.v2019_08_01.models.Address + :keyword current_status: Current status of the order. + :paramtype current_status: ~azure.mgmt.databoxedge.v2019_08_01.models.OrderStatus + """ super(Order, self).__init__(**kwargs) self.contact_information = contact_information self.shipping_address = shipping_address @@ -2022,6 +2315,8 @@ def __init__( self, **kwargs ): + """ + """ super(OrderList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2034,15 +2329,15 @@ class OrderStatus(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param status: Required. Status of the order as per the allowed status types. Possible values + :ivar status: Required. Status of the order as per the allowed status types. Possible values include: "Untracked", "AwaitingFulfilment", "AwaitingPreparation", "AwaitingShipment", "Shipped", "Arriving", "Delivered", "ReplacementRequested", "LostDevice", "Declined", "ReturnInitiated", "AwaitingReturnShipment", "ShippedBack", "CollectedAtMicrosoft". - :type status: str or ~azure.mgmt.databoxedge.v2019_08_01.models.OrderState + :vartype status: str or ~azure.mgmt.databoxedge.v2019_08_01.models.OrderState :ivar update_date_time: Time of status update. :vartype update_date_time: ~datetime.datetime - :param comments: Comments related to this status change. - :type comments: str + :ivar comments: Comments related to this status change. + :vartype comments: str :ivar additional_order_details: Dictionary to hold generic information which is not stored by the already existing properties. :vartype additional_order_details: dict[str, str] @@ -2068,6 +2363,15 @@ def __init__( comments: Optional[str] = None, **kwargs ): + """ + :keyword status: Required. Status of the order as per the allowed status types. Possible values + include: "Untracked", "AwaitingFulfilment", "AwaitingPreparation", "AwaitingShipment", + "Shipped", "Arriving", "Delivered", "ReplacementRequested", "LostDevice", "Declined", + "ReturnInitiated", "AwaitingReturnShipment", "ShippedBack", "CollectedAtMicrosoft". + :paramtype status: str or ~azure.mgmt.databoxedge.v2019_08_01.models.OrderState + :keyword comments: Comments related to this status change. + :paramtype comments: str + """ super(OrderStatus, self).__init__(**kwargs) self.status = status self.update_date_time = None @@ -2088,17 +2392,17 @@ class PeriodicTimerEventTrigger(Trigger): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: + :ivar kind: Required. Trigger Kind.Constant filled by server. Possible values include: "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2019_08_01.models.TriggerEventType - :param source_info: Required. Periodic timer details. - :type source_info: ~azure.mgmt.databoxedge.v2019_08_01.models.PeriodicTimerSourceInfo - :param sink_info: Required. Role Sink information. - :type sink_info: ~azure.mgmt.databoxedge.v2019_08_01.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against + :vartype kind: str or ~azure.mgmt.databoxedge.v2019_08_01.models.TriggerEventType + :ivar source_info: Required. Periodic timer details. + :vartype source_info: ~azure.mgmt.databoxedge.v2019_08_01.models.PeriodicTimerSourceInfo + :ivar sink_info: Required. Role Sink information. + :vartype sink_info: ~azure.mgmt.databoxedge.v2019_08_01.models.RoleSinkInfo + :ivar custom_context_tag: A custom context tag typically used to correlate the trigger against its usage. For example, if a periodic timer trigger is intended for certain specific IoT modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str + :vartype custom_context_tag: str """ _validation = { @@ -2128,6 +2432,16 @@ def __init__( custom_context_tag: Optional[str] = None, **kwargs ): + """ + :keyword source_info: Required. Periodic timer details. + :paramtype source_info: ~azure.mgmt.databoxedge.v2019_08_01.models.PeriodicTimerSourceInfo + :keyword sink_info: Required. Role Sink information. + :paramtype sink_info: ~azure.mgmt.databoxedge.v2019_08_01.models.RoleSinkInfo + :keyword custom_context_tag: A custom context tag typically used to correlate the trigger + against its usage. For example, if a periodic timer trigger is intended for certain specific + IoT modules in the device, the tag can be the name or the image URL of the module. + :paramtype custom_context_tag: str + """ super(PeriodicTimerEventTrigger, self).__init__(**kwargs) self.kind = 'PeriodicTimerEvent' # type: str self.source_info = source_info @@ -2140,15 +2454,15 @@ class PeriodicTimerSourceInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param start_time: Required. The time of the day that results in a valid trigger. Schedule is + :ivar start_time: Required. The time of the day that results in a valid trigger. Schedule is computed with reference to the time specified upto seconds. If timezone is not specified the time will considered to be in device timezone. The value will always be returned as UTC time. - :type start_time: ~datetime.datetime - :param schedule: Required. Periodic frequency at which timer event needs to be raised. Supports + :vartype start_time: ~datetime.datetime + :ivar schedule: Required. Periodic frequency at which timer event needs to be raised. Supports daily, hourly, minutes, and seconds. - :type schedule: str - :param topic: Topic where periodic events are published to IoT device. - :type topic: str + :vartype schedule: str + :ivar topic: Topic where periodic events are published to IoT device. + :vartype topic: str """ _validation = { @@ -2170,6 +2484,17 @@ def __init__( topic: Optional[str] = None, **kwargs ): + """ + :keyword start_time: Required. The time of the day that results in a valid trigger. Schedule is + computed with reference to the time specified upto seconds. If timezone is not specified the + time will considered to be in device timezone. The value will always be returned as UTC time. + :paramtype start_time: ~datetime.datetime + :keyword schedule: Required. Periodic frequency at which timer event needs to be raised. + Supports daily, hourly, minutes, and seconds. + :paramtype schedule: str + :keyword topic: Topic where periodic events are published to IoT device. + :paramtype topic: str + """ super(PeriodicTimerSourceInfo, self).__init__(**kwargs) self.start_time = start_time self.schedule = schedule @@ -2179,21 +2504,21 @@ def __init__( class RefreshDetails(msrest.serialization.Model): """Fields for tracking refresh job on the share or container. - :param in_progress_refresh_job_id: If a refresh job is currently in progress on this share or + :ivar in_progress_refresh_job_id: If a refresh job is currently in progress on this share or container, this field indicates the ARM resource ID of that job. The field is empty if no job is in progress. - :type in_progress_refresh_job_id: str - :param last_completed_refresh_job_time_in_utc: Indicates the completed time for the last - refresh job on this particular share or container, if any.This could be a failed job or a - successful job. - :type last_completed_refresh_job_time_in_utc: ~datetime.datetime - :param error_manifest_file: Indicates the relative path of the error xml for the last refresh + :vartype in_progress_refresh_job_id: str + :ivar last_completed_refresh_job_time_in_utc: Indicates the completed time for the last refresh + job on this particular share or container, if any.This could be a failed job or a successful + job. + :vartype last_completed_refresh_job_time_in_utc: ~datetime.datetime + :ivar error_manifest_file: Indicates the relative path of the error xml for the last refresh job on this particular share or container, if any. This could be a failed job or a successful job. - :type error_manifest_file: str - :param last_job: Indicates the id of the last refresh job on this particular share or + :vartype error_manifest_file: str + :ivar last_job: Indicates the id of the last refresh job on this particular share or container,if any. This could be a failed job or a successful job. - :type last_job: str + :vartype last_job: str """ _attribute_map = { @@ -2212,6 +2537,23 @@ def __init__( last_job: Optional[str] = None, **kwargs ): + """ + :keyword in_progress_refresh_job_id: If a refresh job is currently in progress on this share or + container, this field indicates the ARM resource ID of that job. The field is empty if no job + is in progress. + :paramtype in_progress_refresh_job_id: str + :keyword last_completed_refresh_job_time_in_utc: Indicates the completed time for the last + refresh job on this particular share or container, if any.This could be a failed job or a + successful job. + :paramtype last_completed_refresh_job_time_in_utc: ~datetime.datetime + :keyword error_manifest_file: Indicates the relative path of the error xml for the last refresh + job on this particular share or container, if any. This could be a failed job or a successful + job. + :paramtype error_manifest_file: str + :keyword last_job: Indicates the id of the last refresh job on this particular share or + container,if any. This could be a failed job or a successful job. + :paramtype last_job: str + """ super(RefreshDetails, self).__init__(**kwargs) self.in_progress_refresh_job_id = in_progress_refresh_job_id self.last_completed_refresh_job_time_in_utc = last_completed_refresh_job_time_in_utc @@ -2278,6 +2620,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceTypeSku, self).__init__(**kwargs) self.resource_type = None self.name = None @@ -2316,6 +2660,8 @@ def __init__( self, **kwargs ): + """ + """ super(RoleList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2326,8 +2672,8 @@ class RoleSinkInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param role_id: Required. Compute role ID. - :type role_id: str + :ivar role_id: Required. Compute role ID. + :vartype role_id: str """ _validation = { @@ -2344,6 +2690,10 @@ def __init__( role_id: str, **kwargs ): + """ + :keyword role_id: Required. Compute role ID. + :paramtype role_id: str + """ super(RoleSinkInfo, self).__init__(**kwargs) self.role_id = role_id @@ -2361,11 +2711,11 @@ class SecuritySettings(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param device_admin_password: Required. Device administrator password as an encrypted string + :ivar device_admin_password: Required. Device administrator password as an encrypted string (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual password should have at least 8 characters that are a combination of uppercase, lowercase, numeric, and special characters. - :type device_admin_password: + :vartype device_admin_password: ~azure.mgmt.databoxedge.v2019_08_01.models.AsymmetricEncryptedSecret """ @@ -2389,6 +2739,14 @@ def __init__( device_admin_password: "AsymmetricEncryptedSecret", **kwargs ): + """ + :keyword device_admin_password: Required. Device administrator password as an encrypted string + (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual + password should have at least 8 characters that are a combination of uppercase, lowercase, + numeric, and special characters. + :paramtype device_admin_password: + ~azure.mgmt.databoxedge.v2019_08_01.models.AsymmetricEncryptedSecret + """ super(SecuritySettings, self).__init__(**kwargs) self.device_admin_password = device_admin_password @@ -2396,8 +2754,8 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """Service specification. - :param metric_specifications: Metric specification as defined by shoebox. - :type metric_specifications: + :ivar metric_specifications: Metric specification as defined by shoebox. + :vartype metric_specifications: list[~azure.mgmt.databoxedge.v2019_08_01.models.MetricSpecificationV1] """ @@ -2411,6 +2769,11 @@ def __init__( metric_specifications: Optional[List["MetricSpecificationV1"]] = None, **kwargs ): + """ + :keyword metric_specifications: Metric specification as defined by shoebox. + :paramtype metric_specifications: + list[~azure.mgmt.databoxedge.v2019_08_01.models.MetricSpecificationV1] + """ super(ServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications @@ -2428,31 +2791,32 @@ class Share(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param description: Description for the share. - :type description: str - :param share_status: Required. Current status of the share. Possible values include: "Offline", + :ivar description: Description for the share. + :vartype description: str + :ivar share_status: Required. Current status of the share. Possible values include: "Offline", "Unknown", "OK", "Updating", "NeedsAttention". - :type share_status: str or ~azure.mgmt.databoxedge.v2019_08_01.models.ShareStatus - :param monitoring_status: Required. Current monitoring status of the share. Possible values + :vartype share_status: str or ~azure.mgmt.databoxedge.v2019_08_01.models.ShareStatus + :ivar monitoring_status: Required. Current monitoring status of the share. Possible values include: "Enabled", "Disabled". - :type monitoring_status: str or ~azure.mgmt.databoxedge.v2019_08_01.models.MonitoringStatus - :param azure_container_info: Azure container mapping for the share. - :type azure_container_info: ~azure.mgmt.databoxedge.v2019_08_01.models.AzureContainerInfo - :param access_protocol: Required. Access protocol to be used by the share. Possible values + :vartype monitoring_status: str or ~azure.mgmt.databoxedge.v2019_08_01.models.MonitoringStatus + :ivar azure_container_info: Azure container mapping for the share. + :vartype azure_container_info: ~azure.mgmt.databoxedge.v2019_08_01.models.AzureContainerInfo + :ivar access_protocol: Required. Access protocol to be used by the share. Possible values include: "SMB", "NFS". - :type access_protocol: str or ~azure.mgmt.databoxedge.v2019_08_01.models.ShareAccessProtocol - :param user_access_rights: Mapping of users and corresponding access rights on the share + :vartype access_protocol: str or ~azure.mgmt.databoxedge.v2019_08_01.models.ShareAccessProtocol + :ivar user_access_rights: Mapping of users and corresponding access rights on the share (required for SMB protocol). - :type user_access_rights: list[~azure.mgmt.databoxedge.v2019_08_01.models.UserAccessRight] - :param client_access_rights: List of IP addresses and corresponding access rights on the + :vartype user_access_rights: list[~azure.mgmt.databoxedge.v2019_08_01.models.UserAccessRight] + :ivar client_access_rights: List of IP addresses and corresponding access rights on the share(required for NFS protocol). - :type client_access_rights: list[~azure.mgmt.databoxedge.v2019_08_01.models.ClientAccessRight] - :param refresh_details: Details of the refresh job on this share. - :type refresh_details: ~azure.mgmt.databoxedge.v2019_08_01.models.RefreshDetails + :vartype client_access_rights: + list[~azure.mgmt.databoxedge.v2019_08_01.models.ClientAccessRight] + :ivar refresh_details: Details of the refresh job on this share. + :vartype refresh_details: ~azure.mgmt.databoxedge.v2019_08_01.models.RefreshDetails :ivar share_mappings: Share mount point to the role. :vartype share_mappings: list[~azure.mgmt.databoxedge.v2019_08_01.models.MountPointMap] - :param data_policy: Data policy of the share. Possible values include: "Cloud", "Local". - :type data_policy: str or ~azure.mgmt.databoxedge.v2019_08_01.models.DataPolicy + :ivar data_policy: Data policy of the share. Possible values include: "Cloud", "Local". + :vartype data_policy: str or ~azure.mgmt.databoxedge.v2019_08_01.models.DataPolicy """ _validation = { @@ -2495,6 +2859,34 @@ def __init__( data_policy: Optional[Union[str, "DataPolicy"]] = None, **kwargs ): + """ + :keyword description: Description for the share. + :paramtype description: str + :keyword share_status: Required. Current status of the share. Possible values include: + "Offline", "Unknown", "OK", "Updating", "NeedsAttention". + :paramtype share_status: str or ~azure.mgmt.databoxedge.v2019_08_01.models.ShareStatus + :keyword monitoring_status: Required. Current monitoring status of the share. Possible values + include: "Enabled", "Disabled". + :paramtype monitoring_status: str or + ~azure.mgmt.databoxedge.v2019_08_01.models.MonitoringStatus + :keyword azure_container_info: Azure container mapping for the share. + :paramtype azure_container_info: ~azure.mgmt.databoxedge.v2019_08_01.models.AzureContainerInfo + :keyword access_protocol: Required. Access protocol to be used by the share. Possible values + include: "SMB", "NFS". + :paramtype access_protocol: str or + ~azure.mgmt.databoxedge.v2019_08_01.models.ShareAccessProtocol + :keyword user_access_rights: Mapping of users and corresponding access rights on the share + (required for SMB protocol). + :paramtype user_access_rights: list[~azure.mgmt.databoxedge.v2019_08_01.models.UserAccessRight] + :keyword client_access_rights: List of IP addresses and corresponding access rights on the + share(required for NFS protocol). + :paramtype client_access_rights: + list[~azure.mgmt.databoxedge.v2019_08_01.models.ClientAccessRight] + :keyword refresh_details: Details of the refresh job on this share. + :paramtype refresh_details: ~azure.mgmt.databoxedge.v2019_08_01.models.RefreshDetails + :keyword data_policy: Data policy of the share. Possible values include: "Cloud", "Local". + :paramtype data_policy: str or ~azure.mgmt.databoxedge.v2019_08_01.models.DataPolicy + """ super(Share, self).__init__(**kwargs) self.description = description self.share_status = share_status @@ -2513,11 +2905,11 @@ class ShareAccessRight(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param share_id: Required. The share ID. - :type share_id: str - :param access_type: Required. Type of access to be allowed on the share for this user. Possible + :ivar share_id: Required. The share ID. + :vartype share_id: str + :ivar access_type: Required. Type of access to be allowed on the share for this user. Possible values include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2019_08_01.models.ShareAccessType + :vartype access_type: str or ~azure.mgmt.databoxedge.v2019_08_01.models.ShareAccessType """ _validation = { @@ -2537,6 +2929,13 @@ def __init__( access_type: Union[str, "ShareAccessType"], **kwargs ): + """ + :keyword share_id: Required. The share ID. + :paramtype share_id: str + :keyword access_type: Required. Type of access to be allowed on the share for this user. + Possible values include: "Change", "Read", "Custom". + :paramtype access_type: str or ~azure.mgmt.databoxedge.v2019_08_01.models.ShareAccessType + """ super(ShareAccessRight, self).__init__(**kwargs) self.share_id = share_id self.access_type = access_type @@ -2567,6 +2966,8 @@ def __init__( self, **kwargs ): + """ + """ super(ShareList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2575,12 +2976,11 @@ def __init__( class Sku(msrest.serialization.Model): """The SKU type. - :param name: SKU name. Possible values include: "Gateway", "Edge", "TEA_1Node", - "TEA_1Node_UPS", "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", - "TEA_4Node_UPS_Heater", "TMA". - :type name: str or ~azure.mgmt.databoxedge.v2019_08_01.models.SkuName - :param tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard". - :type tier: str or ~azure.mgmt.databoxedge.v2019_08_01.models.SkuTier + :ivar name: SKU name. Possible values include: "Gateway", "Edge", "TEA_1Node", "TEA_1Node_UPS", + "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", "TEA_4Node_UPS_Heater", "TMA". + :vartype name: str or ~azure.mgmt.databoxedge.v2019_08_01.models.SkuName + :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard". + :vartype tier: str or ~azure.mgmt.databoxedge.v2019_08_01.models.SkuTier """ _attribute_map = { @@ -2595,6 +2995,15 @@ def __init__( tier: Optional[Union[str, "SkuTier"]] = None, **kwargs ): + """ + :keyword name: SKU name. Possible values include: "Gateway", "Edge", "TEA_1Node", + "TEA_1Node_UPS", "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", + "TEA_4Node_UPS_Heater", "TMA". + :paramtype name: str or ~azure.mgmt.databoxedge.v2019_08_01.models.SkuName + :keyword tier: The SKU tier. This is based on the SKU name. Possible values include: + "Standard". + :paramtype tier: str or ~azure.mgmt.databoxedge.v2019_08_01.models.SkuTier + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -2629,6 +3038,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuCost, self).__init__(**kwargs) self.meter_id = None self.quantity = None @@ -2660,6 +3071,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuInformationList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2694,6 +3107,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuLocationInfo, self).__init__(**kwargs) self.location = None self.zones = None @@ -2735,6 +3150,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuRestriction, self).__init__(**kwargs) self.type = None self.values = None @@ -2767,6 +3184,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuRestrictionInfo, self).__init__(**kwargs) self.locations = None self.zones = None @@ -2783,17 +3202,17 @@ class StorageAccount(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param description: Description for the storage Account. - :type description: str - :param storage_account_status: Current status of the storage account. Possible values include: + :ivar description: Description for the storage Account. + :vartype description: str + :ivar storage_account_status: Current status of the storage account. Possible values include: "OK", "Offline", "Unknown", "Updating", "NeedsAttention". - :type storage_account_status: str or + :vartype storage_account_status: str or ~azure.mgmt.databoxedge.v2019_08_01.models.StorageAccountStatus - :param data_policy: Data policy of the storage Account. Possible values include: "Cloud", + :ivar data_policy: Data policy of the storage Account. Possible values include: "Cloud", "Local". - :type data_policy: str or ~azure.mgmt.databoxedge.v2019_08_01.models.DataPolicy - :param storage_account_credential_id: Storage Account Credential Id. - :type storage_account_credential_id: str + :vartype data_policy: str or ~azure.mgmt.databoxedge.v2019_08_01.models.DataPolicy + :ivar storage_account_credential_id: Storage Account Credential Id. + :vartype storage_account_credential_id: str :ivar blob_endpoint: BlobEndpoint of Storage Account. :vartype blob_endpoint: str :ivar container_count: The Container Count. Present only for Storage Accounts with DataPolicy @@ -2830,6 +3249,19 @@ def __init__( storage_account_credential_id: Optional[str] = None, **kwargs ): + """ + :keyword description: Description for the storage Account. + :paramtype description: str + :keyword storage_account_status: Current status of the storage account. Possible values + include: "OK", "Offline", "Unknown", "Updating", "NeedsAttention". + :paramtype storage_account_status: str or + ~azure.mgmt.databoxedge.v2019_08_01.models.StorageAccountStatus + :keyword data_policy: Data policy of the storage Account. Possible values include: "Cloud", + "Local". + :paramtype data_policy: str or ~azure.mgmt.databoxedge.v2019_08_01.models.DataPolicy + :keyword storage_account_credential_id: Storage Account Credential Id. + :paramtype storage_account_credential_id: str + """ super(StorageAccount, self).__init__(**kwargs) self.description = description self.storage_account_status = storage_account_status @@ -2852,25 +3284,25 @@ class StorageAccountCredential(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param alias: Required. Alias for the storage account. - :type alias: str - :param user_name: Username for the storage account. - :type user_name: str - :param account_key: Encrypted storage key. - :type account_key: ~azure.mgmt.databoxedge.v2019_08_01.models.AsymmetricEncryptedSecret - :param connection_string: Connection string for the storage account. Use this string if - username and account key are not specified. - :type connection_string: str - :param ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible values + :ivar alias: Required. Alias for the storage account. + :vartype alias: str + :ivar user_name: Username for the storage account. + :vartype user_name: str + :ivar account_key: Encrypted storage key. + :vartype account_key: ~azure.mgmt.databoxedge.v2019_08_01.models.AsymmetricEncryptedSecret + :ivar connection_string: Connection string for the storage account. Use this string if username + and account key are not specified. + :vartype connection_string: str + :ivar ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible values include: "Enabled", "Disabled". - :type ssl_status: str or ~azure.mgmt.databoxedge.v2019_08_01.models.SSLStatus - :param blob_domain_name: Blob end point for private clouds. - :type blob_domain_name: str - :param account_type: Required. Type of storage accessed on the storage account. Possible values + :vartype ssl_status: str or ~azure.mgmt.databoxedge.v2019_08_01.models.SSLStatus + :ivar blob_domain_name: Blob end point for private clouds. + :vartype blob_domain_name: str + :ivar account_type: Required. Type of storage accessed on the storage account. Possible values include: "GeneralPurposeStorage", "BlobStorage". - :type account_type: str or ~azure.mgmt.databoxedge.v2019_08_01.models.AccountType - :param storage_account_id: Id of the storage account. - :type storage_account_id: str + :vartype account_type: str or ~azure.mgmt.databoxedge.v2019_08_01.models.AccountType + :ivar storage_account_id: Id of the storage account. + :vartype storage_account_id: str """ _validation = { @@ -2909,6 +3341,27 @@ def __init__( storage_account_id: Optional[str] = None, **kwargs ): + """ + :keyword alias: Required. Alias for the storage account. + :paramtype alias: str + :keyword user_name: Username for the storage account. + :paramtype user_name: str + :keyword account_key: Encrypted storage key. + :paramtype account_key: ~azure.mgmt.databoxedge.v2019_08_01.models.AsymmetricEncryptedSecret + :keyword connection_string: Connection string for the storage account. Use this string if + username and account key are not specified. + :paramtype connection_string: str + :keyword ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible + values include: "Enabled", "Disabled". + :paramtype ssl_status: str or ~azure.mgmt.databoxedge.v2019_08_01.models.SSLStatus + :keyword blob_domain_name: Blob end point for private clouds. + :paramtype blob_domain_name: str + :keyword account_type: Required. Type of storage accessed on the storage account. Possible + values include: "GeneralPurposeStorage", "BlobStorage". + :paramtype account_type: str or ~azure.mgmt.databoxedge.v2019_08_01.models.AccountType + :keyword storage_account_id: Id of the storage account. + :paramtype storage_account_id: str + """ super(StorageAccountCredential, self).__init__(**kwargs) self.alias = alias self.user_name = user_name @@ -2945,6 +3398,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountCredentialList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2975,6 +3430,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2983,8 +3440,9 @@ def __init__( class SymmetricKey(msrest.serialization.Model): """Symmetric key for authentication. - :param connection_string: Connection string based on the symmetric key. - :type connection_string: ~azure.mgmt.databoxedge.v2019_08_01.models.AsymmetricEncryptedSecret + :ivar connection_string: Connection string based on the symmetric key. + :vartype connection_string: + ~azure.mgmt.databoxedge.v2019_08_01.models.AsymmetricEncryptedSecret """ _attribute_map = { @@ -2997,6 +3455,11 @@ def __init__( connection_string: Optional["AsymmetricEncryptedSecret"] = None, **kwargs ): + """ + :keyword connection_string: Connection string based on the symmetric key. + :paramtype connection_string: + ~azure.mgmt.databoxedge.v2019_08_01.models.AsymmetricEncryptedSecret + """ super(SymmetricKey, self).__init__(**kwargs) self.connection_string = connection_string @@ -3004,14 +3467,14 @@ def __init__( class TrackingInfo(msrest.serialization.Model): """Tracking courier information. - :param serial_number: Serial number of the device being tracked. - :type serial_number: str - :param carrier_name: Name of the carrier used in the delivery. - :type carrier_name: str - :param tracking_id: Tracking ID of the shipment. - :type tracking_id: str - :param tracking_url: Tracking URL of the shipment. - :type tracking_url: str + :ivar serial_number: Serial number of the device being tracked. + :vartype serial_number: str + :ivar carrier_name: Name of the carrier used in the delivery. + :vartype carrier_name: str + :ivar tracking_id: Tracking ID of the shipment. + :vartype tracking_id: str + :ivar tracking_url: Tracking URL of the shipment. + :vartype tracking_url: str """ _attribute_map = { @@ -3030,6 +3493,16 @@ def __init__( tracking_url: Optional[str] = None, **kwargs ): + """ + :keyword serial_number: Serial number of the device being tracked. + :paramtype serial_number: str + :keyword carrier_name: Name of the carrier used in the delivery. + :paramtype carrier_name: str + :keyword tracking_id: Tracking ID of the shipment. + :paramtype tracking_id: str + :keyword tracking_url: Tracking URL of the shipment. + :paramtype tracking_url: str + """ super(TrackingInfo, self).__init__(**kwargs) self.serial_number = serial_number self.carrier_name = carrier_name @@ -3062,6 +3535,8 @@ def __init__( self, **kwargs ): + """ + """ super(TriggerList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3109,6 +3584,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateDownloadProgress, self).__init__(**kwargs) self.download_phase = None self.percent_complete = None @@ -3147,6 +3624,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateInstallProgress, self).__init__(**kwargs) self.percent_complete = None self.number_of_updates_to_install = None @@ -3164,15 +3643,15 @@ class UpdateSummary(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param device_version_number: The current version of the device in format: 1.2.17312.13.",. - :type device_version_number: str - :param friendly_device_version_name: The current version of the device in text format. - :type friendly_device_version_name: str - :param device_last_scanned_date_time: The last time when a scan was done on the device. - :type device_last_scanned_date_time: ~datetime.datetime - :param last_completed_scan_job_date_time: The time when the last scan job was completed + :ivar device_version_number: The current version of the device in format: 1.2.17312.13.",. + :vartype device_version_number: str + :ivar friendly_device_version_name: The current version of the device in text format. + :vartype friendly_device_version_name: str + :ivar device_last_scanned_date_time: The last time when a scan was done on the device. + :vartype device_last_scanned_date_time: ~datetime.datetime + :ivar last_completed_scan_job_date_time: The time when the last scan job was completed (success/cancelled/failed) on the appliance. - :type last_completed_scan_job_date_time: ~datetime.datetime + :vartype last_completed_scan_job_date_time: ~datetime.datetime :ivar last_completed_download_job_date_time: The time when the last Download job was completed (success/cancelled/failed) on the appliance. :vartype last_completed_download_job_date_time: ~datetime.datetime @@ -3261,6 +3740,17 @@ def __init__( last_completed_scan_job_date_time: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword device_version_number: The current version of the device in format: 1.2.17312.13.",. + :paramtype device_version_number: str + :keyword friendly_device_version_name: The current version of the device in text format. + :paramtype friendly_device_version_name: str + :keyword device_last_scanned_date_time: The last time when a scan was done on the device. + :paramtype device_last_scanned_date_time: ~datetime.datetime + :keyword last_completed_scan_job_date_time: The time when the last scan job was completed + (success/cancelled/failed) on the appliance. + :paramtype last_completed_scan_job_date_time: ~datetime.datetime + """ super(UpdateSummary, self).__init__(**kwargs) self.device_version_number = device_version_number self.friendly_device_version_name = friendly_device_version_name @@ -3286,11 +3776,12 @@ class UploadCertificateRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param authentication_type: The authentication type. Possible values include: "Invalid", + :ivar authentication_type: The authentication type. Possible values include: "Invalid", "AzureActiveDirectory". - :type authentication_type: str or ~azure.mgmt.databoxedge.v2019_08_01.models.AuthenticationType - :param certificate: Required. The base64 encoded certificate raw data. - :type certificate: str + :vartype authentication_type: str or + ~azure.mgmt.databoxedge.v2019_08_01.models.AuthenticationType + :ivar certificate: Required. The base64 encoded certificate raw data. + :vartype certificate: str """ _validation = { @@ -3309,6 +3800,14 @@ def __init__( authentication_type: Optional[Union[str, "AuthenticationType"]] = None, **kwargs ): + """ + :keyword authentication_type: The authentication type. Possible values include: "Invalid", + "AzureActiveDirectory". + :paramtype authentication_type: str or + ~azure.mgmt.databoxedge.v2019_08_01.models.AuthenticationType + :keyword certificate: Required. The base64 encoded certificate raw data. + :paramtype certificate: str + """ super(UploadCertificateRequest, self).__init__(**kwargs) self.authentication_type = authentication_type self.certificate = certificate @@ -3319,9 +3818,9 @@ class UploadCertificateResponse(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param auth_type: Specifies authentication type. Possible values include: "Invalid", + :ivar auth_type: Specifies authentication type. Possible values include: "Invalid", "AzureActiveDirectory". - :type auth_type: str or ~azure.mgmt.databoxedge.v2019_08_01.models.AuthenticationType + :vartype auth_type: str or ~azure.mgmt.databoxedge.v2019_08_01.models.AuthenticationType :ivar resource_id: The resource ID of the Data Box Edge/Gateway device. :vartype resource_id: str :ivar aad_authority: Azure Active Directory tenant authority. @@ -3366,6 +3865,11 @@ def __init__( auth_type: Optional[Union[str, "AuthenticationType"]] = None, **kwargs ): + """ + :keyword auth_type: Specifies authentication type. Possible values include: "Invalid", + "AzureActiveDirectory". + :paramtype auth_type: str or ~azure.mgmt.databoxedge.v2019_08_01.models.AuthenticationType + """ super(UploadCertificateResponse, self).__init__(**kwargs) self.auth_type = auth_type self.resource_id = None @@ -3390,14 +3894,15 @@ class User(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param encrypted_password: The password details. - :type encrypted_password: ~azure.mgmt.databoxedge.v2019_08_01.models.AsymmetricEncryptedSecret - :param share_access_rights: List of shares that the user has rights on. This field should not - be specified during user creation. - :type share_access_rights: list[~azure.mgmt.databoxedge.v2019_08_01.models.ShareAccessRight] - :param user_type: Required. Type of the user. Possible values include: "Share", + :ivar encrypted_password: The password details. + :vartype encrypted_password: + ~azure.mgmt.databoxedge.v2019_08_01.models.AsymmetricEncryptedSecret + :ivar share_access_rights: List of shares that the user has rights on. This field should not be + specified during user creation. + :vartype share_access_rights: list[~azure.mgmt.databoxedge.v2019_08_01.models.ShareAccessRight] + :ivar user_type: Required. Type of the user. Possible values include: "Share", "LocalManagement", "ARM". - :type user_type: str or ~azure.mgmt.databoxedge.v2019_08_01.models.UserType + :vartype user_type: str or ~azure.mgmt.databoxedge.v2019_08_01.models.UserType """ _validation = { @@ -3424,6 +3929,18 @@ def __init__( share_access_rights: Optional[List["ShareAccessRight"]] = None, **kwargs ): + """ + :keyword encrypted_password: The password details. + :paramtype encrypted_password: + ~azure.mgmt.databoxedge.v2019_08_01.models.AsymmetricEncryptedSecret + :keyword share_access_rights: List of shares that the user has rights on. This field should not + be specified during user creation. + :paramtype share_access_rights: + list[~azure.mgmt.databoxedge.v2019_08_01.models.ShareAccessRight] + :keyword user_type: Required. Type of the user. Possible values include: "Share", + "LocalManagement", "ARM". + :paramtype user_type: str or ~azure.mgmt.databoxedge.v2019_08_01.models.UserType + """ super(User, self).__init__(**kwargs) self.encrypted_password = encrypted_password self.share_access_rights = share_access_rights @@ -3435,11 +3952,11 @@ class UserAccessRight(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param user_id: Required. User ID (already existing in the device). - :type user_id: str - :param access_type: Required. Type of access to be allowed for the user. Possible values + :ivar user_id: Required. User ID (already existing in the device). + :vartype user_id: str + :ivar access_type: Required. Type of access to be allowed for the user. Possible values include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2019_08_01.models.ShareAccessType + :vartype access_type: str or ~azure.mgmt.databoxedge.v2019_08_01.models.ShareAccessType """ _validation = { @@ -3459,6 +3976,13 @@ def __init__( access_type: Union[str, "ShareAccessType"], **kwargs ): + """ + :keyword user_id: Required. User ID (already existing in the device). + :paramtype user_id: str + :keyword access_type: Required. Type of access to be allowed for the user. Possible values + include: "Change", "Read", "Custom". + :paramtype access_type: str or ~azure.mgmt.databoxedge.v2019_08_01.models.ShareAccessType + """ super(UserAccessRight, self).__init__(**kwargs) self.user_id = user_id self.access_type = access_type @@ -3489,6 +4013,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserList, self).__init__(**kwargs) self.value = None self.next_link = None diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_alerts_operations.py index c43d0a79ad7a..258bc3f937c4 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_alerts_operations.py @@ -5,23 +5,97 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AlertsOperations(object): """AlertsOperations operations. @@ -45,13 +119,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AlertList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.AlertList"]: """Gets all the alerts for a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -68,36 +142,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AlertList', pipeline_response) + deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,19 +186,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Alert" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Alert": """Gets an alert by name. Gets an alert by name. @@ -148,28 +220,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,4 +245,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_bandwidth_schedules_operations.py index c865d71791de..86424a7f6929 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_bandwidth_schedules_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class BandwidthSchedulesOperations(object): """BandwidthSchedulesOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BandwidthSchedulesList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.BandwidthSchedulesList"]: """Gets all the bandwidth schedules for a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -61,8 +219,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BandwidthSchedulesList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.BandwidthSchedulesList] + :return: An iterator like instance of either BandwidthSchedulesList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.BandwidthSchedulesList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedulesList"] @@ -70,36 +230,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BandwidthSchedulesList', pipeline_response) + deserialized = self._deserialize("BandwidthSchedulesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,19 +274,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BandwidthSchedule" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.BandwidthSchedule": """Gets the properties of the specified bandwidth schedule. :param device_name: The device name. @@ -148,28 +306,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,49 +331,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.BandwidthSchedule" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.BandwidthSchedule"] + device_name: str, + name: str, + resource_group_name: str, + parameters: "_models.BandwidthSchedule", + **kwargs: Any + ) -> Optional["_models.BandwidthSchedule"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BandwidthSchedule"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BandwidthSchedule') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BandwidthSchedule') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -241,17 +380,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.BandwidthSchedule" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BandwidthSchedule"] + device_name: str, + name: str, + resource_group_name: str, + parameters: "_models.BandwidthSchedule", + **kwargs: Any + ) -> LROPoller["_models.BandwidthSchedule"]: """Creates or updates a bandwidth schedule. :param device_name: The device name. @@ -264,15 +405,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.databoxedge.v2019_08_01.models.BandwidthSchedule :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either BandwidthSchedule or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_08_01.models.BandwidthSchedule] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BandwidthSchedule or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_08_01.models.BandwidthSchedule] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedule"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +431,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BandwidthSchedule', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -318,43 +457,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -367,14 +496,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the specified bandwidth schedule. :param device_name: The device name. @@ -385,15 +515,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -408,22 +540,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -435,4 +559,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_containers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_containers_operations.py index a02b4fcefa85..39f6e796c11e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_containers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_containers_operations.py @@ -5,25 +5,230 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_storage_account_request( + device_name: str, + storage_account_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + storage_account_name: str, + container_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + storage_account_name: str, + container_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + storage_account_name: str, + container_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_refresh_request_initial( + device_name: str, + storage_account_name: str, + container_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ContainersOperations(object): """ContainersOperations operations. @@ -47,14 +252,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_storage_account( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ContainerList"] + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ContainerList"]: """Lists all the containers of a storage Account in a Data Box Edge/Data Box Gateway device. Lists all the containers of a storage Account in a Data Box Edge/Data Box Gateway device. @@ -75,37 +280,35 @@ def list_by_storage_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_storage_account.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_account_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_storage_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_account_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ContainerList', pipeline_response) + deserialized = self._deserialize("ContainerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -123,20 +326,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_storage_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Container" + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Container": """Gets a container by name. Gets a container by name. @@ -159,29 +363,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -195,51 +389,42 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - container, # type: "_models.Container" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Container"] + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + container: "_models.Container", + **kwargs: Any + ) -> Optional["_models.Container"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Container"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(container, 'Container') + + request = build_create_or_update_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(container, 'Container') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -255,18 +440,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - container, # type: "_models.Container" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Container"] + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + container: "_models.Container", + **kwargs: Any + ) -> LROPoller["_models.Container"]: """Creates a new container or updates an existing container on the device. Creates a new container or updates an existing container on the device. @@ -283,15 +470,18 @@ def begin_create_or_update( :type container: ~azure.mgmt.databoxedge.v2019_08_01.models.Container :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Container or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_08_01.models.Container] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Container"] lro_delay = kwargs.pop( 'polling_interval', @@ -305,29 +495,21 @@ def begin_create_or_update( container_name=container_name, resource_group_name=resource_group_name, container=container, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Container', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -339,45 +521,35 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore def _delete_initial( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -390,15 +562,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the container on the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -411,15 +584,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -435,23 +610,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -463,45 +629,35 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore def _refresh_initial( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -514,15 +670,16 @@ def _refresh_initial( _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh'} # type: ignore + + @distributed_trace def begin_refresh( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Refreshes the container metadata with the data from the cloud. Refreshes the container metadata with the data from the cloud. @@ -537,15 +694,17 @@ def begin_refresh( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -561,23 +720,14 @@ def begin_refresh( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -589,4 +739,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_devices_operations.py index 1dcf6c0a0e5d..abfe34e4d8fd 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_devices_operations.py @@ -5,25 +5,556 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_subscription_request( + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_download_updates_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_extended_information_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_install_updates_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_network_settings_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/networkSettings/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_scan_for_updates_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_security_settings_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_update_summary_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_upload_certificate_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/uploadCertificate') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class DevicesOperations(object): """DevicesOperations operations. @@ -47,20 +578,22 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DataBoxEdgeDeviceList"] + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.DataBoxEdgeDeviceList"]: """Gets all the Data Box Edge/Data Box Gateway devices in a subscription. :param expand: Specify $expand=details to populate additional fields related to the resource or Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -68,36 +601,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,18 +643,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DataBoxEdgeDeviceList"] + resource_group_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.DataBoxEdgeDeviceList"]: """Gets all the Data Box Edge/Data Box Gateway devices in a resource group. :param resource_group_name: The resource group name. @@ -135,8 +664,10 @@ def list_by_resource_group( Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -144,37 +675,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -192,18 +719,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDevice" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DataBoxEdgeDevice": """Gets the properties of the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -220,27 +748,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -254,47 +772,38 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - resource_group_name, # type: str - data_box_edge_device, # type: "_models.DataBoxEdgeDevice" - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDevice" + device_name: str, + resource_group_name: str, + data_box_edge_device: "_models.DataBoxEdgeDevice", + **kwargs: Any + ) -> "_models.DataBoxEdgeDevice": cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -308,16 +817,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - resource_group_name, # type: str - data_box_edge_device, # type: "_models.DataBoxEdgeDevice" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DataBoxEdgeDevice"] + device_name: str, + resource_group_name: str, + data_box_edge_device: "_models.DataBoxEdgeDevice", + **kwargs: Any + ) -> LROPoller["_models.DataBoxEdgeDevice"]: """Creates or updates a Data Box Edge/Data Box Gateway resource. :param device_name: The device name. @@ -328,15 +839,20 @@ def begin_create_or_update( :type data_box_edge_device: ~azure.mgmt.databoxedge.v2019_08_01.models.DataBoxEdgeDevice :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DataBoxEdgeDevice or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_08_01.models.DataBoxEdgeDevice] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DataBoxEdgeDevice or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_08_01.models.DataBoxEdgeDevice] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] lro_delay = kwargs.pop( 'polling_interval', @@ -348,27 +864,21 @@ def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, data_box_edge_device=data_box_edge_device, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DataBoxEdgeDevice', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -380,41 +890,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore def _delete_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -427,13 +927,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -442,15 +943,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -464,21 +967,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -490,16 +986,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + @distributed_trace def update( self, - device_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.DataBoxEdgeDevicePatch" - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDevice" + device_name: str, + resource_group_name: str, + parameters: "_models.DataBoxEdgeDevicePatch", + **kwargs: Any + ) -> "_models.DataBoxEdgeDevice": """Modifies a Data Box Edge/Data Box Gateway resource. :param device_name: The device name. @@ -518,32 +1015,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') + + request = build_update_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -557,41 +1044,32 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + def _download_updates_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self._download_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_download_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._download_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -604,13 +1082,14 @@ def _download_updates_initial( _download_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + + @distributed_trace def begin_download_updates( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Downloads the updates on a Data Box Edge/Data Box Gateway device. Downloads the updates on a Data Box Edge/Data Box Gateway device. @@ -621,15 +1100,17 @@ def begin_download_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -643,21 +1124,14 @@ def begin_download_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -669,15 +1143,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_download_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + @distributed_trace def get_extended_information( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDeviceExtendedInfo" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DataBoxEdgeDeviceExtendedInfo": """Gets additional information for the specified Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -694,27 +1169,17 @@ def get_extended_information( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get_extended_information.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_extended_information_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_extended_information.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -728,41 +1193,32 @@ def get_extended_information( return cls(pipeline_response, deserialized, {}) return deserialized + get_extended_information.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation'} # type: ignore + def _install_updates_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self._install_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_install_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._install_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -775,13 +1231,14 @@ def _install_updates_initial( _install_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + + @distributed_trace def begin_install_updates( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Installs the updates on the Data Box Edge/Data Box Gateway device. Installs the updates on the Data Box Edge/Data Box Gateway device. @@ -792,15 +1249,17 @@ def begin_install_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -814,21 +1273,14 @@ def begin_install_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -840,15 +1292,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_install_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + @distributed_trace def get_network_settings( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.NetworkSettings" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.NetworkSettings": """Gets the network settings of the specified Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -865,27 +1318,17 @@ def get_network_settings( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get_network_settings.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_network_settings_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_network_settings.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -899,41 +1342,32 @@ def get_network_settings( return cls(pipeline_response, deserialized, {}) return deserialized + get_network_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/networkSettings/default'} # type: ignore + def _scan_for_updates_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self._scan_for_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_scan_for_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._scan_for_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -946,13 +1380,14 @@ def _scan_for_updates_initial( _scan_for_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore + + @distributed_trace def begin_scan_for_updates( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Scans for updates on a Data Box Edge/Data Box Gateway device. Scans for updates on a Data Box Edge/Data Box Gateway device. @@ -963,15 +1398,17 @@ def begin_scan_for_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -985,21 +1422,14 @@ def begin_scan_for_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1011,47 +1441,37 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_scan_for_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore def _create_or_update_security_settings_initial( self, - device_name, # type: str - resource_group_name, # type: str - security_settings, # type: "_models.SecuritySettings" - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + security_settings: "_models.SecuritySettings", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_security_settings_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(security_settings, 'SecuritySettings') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_security_settings_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_security_settings_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(security_settings, 'SecuritySettings') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1064,14 +1484,15 @@ def _create_or_update_security_settings_initial( _create_or_update_security_settings_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + + @distributed_trace def begin_create_or_update_security_settings( self, - device_name, # type: str - resource_group_name, # type: str - security_settings, # type: "_models.SecuritySettings" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + security_settings: "_models.SecuritySettings", + **kwargs: Any + ) -> LROPoller[None]: """Updates the security settings on a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -1082,15 +1503,18 @@ def begin_create_or_update_security_settings( :type security_settings: ~azure.mgmt.databoxedge.v2019_08_01.models.SecuritySettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1102,24 +1526,18 @@ def begin_create_or_update_security_settings( device_name=device_name, resource_group_name=resource_group_name, security_settings=security_settings, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1131,16 +1549,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_security_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + @distributed_trace def get_update_summary( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.UpdateSummary" - """Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.UpdateSummary": + """Gets information about the availability of updates based on the last scan of the device. It + also gets information about any ongoing download or install jobs on the device. Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. @@ -1159,27 +1579,17 @@ def get_update_summary( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get_update_summary.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_update_summary_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_update_summary.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1193,16 +1603,18 @@ def get_update_summary( return cls(pipeline_response, deserialized, {}) return deserialized + get_update_summary.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default'} # type: ignore + + @distributed_trace def upload_certificate( self, - device_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.UploadCertificateRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.UploadCertificateResponse" + device_name: str, + resource_group_name: str, + parameters: "_models.UploadCertificateRequest", + **kwargs: Any + ) -> "_models.UploadCertificateResponse": """Uploads registration certificate for the device. :param device_name: The device name. @@ -1221,32 +1633,22 @@ def upload_certificate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.upload_certificate.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'UploadCertificateRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_upload_certificate_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.upload_certificate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'UploadCertificateRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1260,4 +1662,6 @@ def upload_certificate( return cls(pipeline_response, deserialized, {}) return deserialized + upload_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/uploadCertificate'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_jobs_operations.py index ae64fe0e955b..34ef3afb2c5c 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_jobs_operations.py @@ -5,22 +5,61 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class JobsOperations(object): """JobsOperations operations. @@ -44,14 +83,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Job" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Job": """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. @@ -72,28 +111,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -107,4 +136,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_nodes_operations.py index c5a09a62691f..2a89d74dded2 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_nodes_operations.py @@ -5,23 +5,60 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/nodes') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class NodesOperations(object): """NodesOperations operations. @@ -45,13 +82,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.NodeList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.NodeList"]: """Gets all the nodes currently configured under this Data Box Edge device. :param device_name: The device name. @@ -68,36 +105,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('NodeList', pipeline_response) + deserialized = self._deserialize("NodeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,6 +149,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_operations.py index 60e166c69f05..69bc75f5ad3d 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.DataBoxEdge/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,11 +72,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationsList"] + **kwargs: Any + ) -> Iterable["_models.OperationsList"]: """List all the supported operations. List all the supported operations. @@ -64,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationsList', pipeline_response) + deserialized = self._deserialize("OperationsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -105,6 +129,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_operations_status_operations.py index a30d82757482..44457ff94c61 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_operations_status_operations.py @@ -5,22 +5,61 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/operationsStatus/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class OperationsStatusOperations(object): """OperationsStatusOperations operations. @@ -44,14 +83,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Job" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Job": """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. @@ -72,28 +111,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -107,4 +136,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/operationsStatus/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_orders_operations.py index 52461cd4e254..a654f62d5051 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_orders_operations.py @@ -5,25 +5,177 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class OrdersOperations(object): """OrdersOperations operations. @@ -47,13 +199,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OrderList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.OrderList"]: """Lists all the orders related to a Data Box Edge/Data Box Gateway device. Lists all the orders related to a Data Box Edge/Data Box Gateway device. @@ -72,36 +224,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OrderList', pipeline_response) + deserialized = self._deserialize("OrderList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,18 +268,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Order" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Order": """Gets a specific order by name. Gets a specific order by name. @@ -149,27 +299,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,47 +323,38 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - resource_group_name, # type: str - order, # type: "_models.Order" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Order"] + device_name: str, + resource_group_name: str, + order: "_models.Order", + **kwargs: Any + ) -> Optional["_models.Order"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Order"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(order, 'Order') + + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(order, 'Order') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,16 +370,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - resource_group_name, # type: str - order, # type: "_models.Order" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Order"] + device_name: str, + resource_group_name: str, + order: "_models.Order", + **kwargs: Any + ) -> LROPoller["_models.Order"]: """Creates or updates an order. Creates or updates an order. @@ -261,15 +394,18 @@ def begin_create_or_update( :type order: ~azure.mgmt.databoxedge.v2019_08_01.models.Order :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Order or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_08_01.models.Order] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Order"] lro_delay = kwargs.pop( 'polling_interval', @@ -281,27 +417,21 @@ def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, order=order, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Order', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -313,41 +443,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore def _delete_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -360,13 +480,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the order related to the device. Deletes the order related to the device. @@ -377,15 +498,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -399,21 +522,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -425,4 +541,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_roles_operations.py index 23cab2b31e98..56363ecc2061 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_roles_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class RolesOperations(object): """RolesOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RoleList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.RoleList"]: """Lists all the roles configured in a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -70,36 +228,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RoleList', pipeline_response) + deserialized = self._deserialize("RoleList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,19 +272,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Role" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Role": """Gets a specific role by name. :param device_name: The device name. @@ -148,28 +304,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,49 +329,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - role, # type: "_models.Role" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Role"] + device_name: str, + name: str, + resource_group_name: str, + role: "_models.Role", + **kwargs: Any + ) -> Optional["_models.Role"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Role"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(role, 'Role') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(role, 'Role') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -241,17 +378,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - role, # type: "_models.Role" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Role"] + device_name: str, + name: str, + resource_group_name: str, + role: "_models.Role", + **kwargs: Any + ) -> LROPoller["_models.Role"]: """Create or update a role. :param device_name: The device name. @@ -264,15 +403,18 @@ def begin_create_or_update( :type role: ~azure.mgmt.databoxedge.v2019_08_01.models.Role :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Role or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_08_01.models.Role] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Role"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +427,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, role=role, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Role', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -318,43 +453,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -367,14 +492,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the role on the device. :param device_name: The device name. @@ -385,15 +511,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -408,22 +536,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -435,4 +555,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_shares_operations.py index d654bbcb61f5..50dbc298b8b2 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_shares_operations.py @@ -5,25 +5,220 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_refresh_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SharesOperations(object): """SharesOperations operations. @@ -47,13 +242,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ShareList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ShareList"]: """Lists all the shares in a Data Box Edge/Data Box Gateway device. Lists all the shares in a Data Box Edge/Data Box Gateway device. @@ -72,36 +267,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ShareList', pipeline_response) + deserialized = self._deserialize("ShareList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +311,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Share" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Share": """Gets a share by name. Gets a share by name. @@ -152,28 +345,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -187,49 +370,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - share, # type: "_models.Share" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Share"] + device_name: str, + name: str, + resource_group_name: str, + share: "_models.Share", + **kwargs: Any + ) -> Optional["_models.Share"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Share"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(share, 'Share') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(share, 'Share') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,17 +419,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - share, # type: "_models.Share" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Share"] + device_name: str, + name: str, + resource_group_name: str, + share: "_models.Share", + **kwargs: Any + ) -> LROPoller["_models.Share"]: """Creates a new share or updates an existing share on the device. Creates a new share or updates an existing share on the device. @@ -270,15 +446,18 @@ def begin_create_or_update( :type share: ~azure.mgmt.databoxedge.v2019_08_01.models.Share :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Share or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_08_01.models.Share] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Share"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +470,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, share=share, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Share', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -324,43 +496,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,14 +535,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the share on the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -391,15 +554,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -414,22 +579,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -441,43 +598,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore def _refresh_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -490,14 +637,15 @@ def _refresh_initial( _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore + + @distributed_trace def begin_refresh( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Refreshes the share metadata with the data from the cloud. Refreshes the share metadata with the data from the cloud. @@ -510,15 +658,17 @@ def begin_refresh( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -533,22 +683,14 @@ def begin_refresh( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -560,4 +702,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_skus_operations.py index 1676918728c2..62463cf685c6 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_skus_operations.py @@ -5,23 +5,60 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/skus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SkusOperations(object): """SkusOperations operations. @@ -45,12 +82,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SkuInformationList"] + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.SkuInformationList"]: """List all the available Skus in the region and information related to them. List all the available Skus in the region and information related to them. @@ -59,7 +96,8 @@ def list( :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SkuInformationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.SkuInformationList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.SkuInformationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SkuInformationList"] @@ -67,36 +105,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SkuInformationList', pipeline_response) + deserialized = self._deserialize("SkuInformationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,6 +147,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_storage_account_credentials_operations.py index 137137688679..4886659f43fc 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_storage_account_credentials_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class StorageAccountCredentialsOperations(object): """StorageAccountCredentialsOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountCredentialList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountCredentialList"]: """Gets all the storage account credentials in a Data Box Edge/Data Box Gateway device. Gets all the storage account credentials in a Data Box Edge/Data Box Gateway device. @@ -63,8 +221,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountCredentialList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.StorageAccountCredentialList] + :return: An iterator like instance of either StorageAccountCredentialList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.StorageAccountCredentialList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredentialList"] @@ -72,36 +232,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('StorageAccountCredentialList', pipeline_response) + deserialized = self._deserialize("StorageAccountCredentialList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +276,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountCredential" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.StorageAccountCredential": """Gets the properties of the specified storage account credential. :param device_name: The device name. @@ -150,28 +308,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,49 +333,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - storage_account_credential, # type: "_models.StorageAccountCredential" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageAccountCredential"] + device_name: str, + name: str, + resource_group_name: str, + storage_account_credential: "_models.StorageAccountCredential", + **kwargs: Any + ) -> Optional["_models.StorageAccountCredential"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccountCredential"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(storage_account_credential, 'StorageAccountCredential') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_account_credential, 'StorageAccountCredential') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -243,17 +382,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - storage_account_credential, # type: "_models.StorageAccountCredential" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageAccountCredential"] + device_name: str, + name: str, + resource_group_name: str, + storage_account_credential: "_models.StorageAccountCredential", + **kwargs: Any + ) -> LROPoller["_models.StorageAccountCredential"]: """Creates or updates the storage account credential. :param device_name: The device name. @@ -263,18 +404,24 @@ def begin_create_or_update( :param resource_group_name: The resource group name. :type resource_group_name: str :param storage_account_credential: The storage account credential. - :type storage_account_credential: ~azure.mgmt.databoxedge.v2019_08_01.models.StorageAccountCredential + :type storage_account_credential: + ~azure.mgmt.databoxedge.v2019_08_01.models.StorageAccountCredential :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either StorageAccountCredential or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_08_01.models.StorageAccountCredential] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either StorageAccountCredential or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_08_01.models.StorageAccountCredential] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredential"] lro_delay = kwargs.pop( 'polling_interval', @@ -287,28 +434,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, storage_account_credential=storage_account_credential, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccountCredential', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -320,43 +460,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -369,14 +499,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the storage account credential. :param device_name: The device name. @@ -387,15 +518,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -410,22 +543,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -437,4 +562,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_storage_accounts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_storage_accounts_operations.py index 2cfe010aaaf3..d520597dd73a 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_storage_accounts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_storage_accounts_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + storage_account_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + storage_account_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + storage_account_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountList"]: """Lists all the storage accounts in a Data Box Edge/Data Box Gateway device. Lists all the storage accounts in a Data Box Edge/Data Box Gateway device. @@ -64,7 +222,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either StorageAccountList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.StorageAccountList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2019_08_01.models.StorageAccountList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountList"] @@ -72,36 +231,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('StorageAccountList', pipeline_response) + deserialized = self._deserialize("StorageAccountList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +275,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.StorageAccount": """Gets a StorageAccount by name. Gets a StorageAccount by name. @@ -152,28 +309,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -187,49 +334,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - storage_account, # type: "_models.StorageAccount" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageAccount"] + device_name: str, + storage_account_name: str, + resource_group_name: str, + storage_account: "_models.StorageAccount", + **kwargs: Any + ) -> Optional["_models.StorageAccount"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(storage_account, 'StorageAccount') + + request = build_create_or_update_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_account, 'StorageAccount') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,17 +383,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - storage_account, # type: "_models.StorageAccount" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageAccount"] + device_name: str, + storage_account_name: str, + resource_group_name: str, + storage_account: "_models.StorageAccount", + **kwargs: Any + ) -> LROPoller["_models.StorageAccount"]: """Creates a new StorageAccount or updates an existing StorageAccount on the device. Creates a new StorageAccount or updates an existing StorageAccount on the device. @@ -270,15 +410,20 @@ def begin_create_or_update( :type storage_account: ~azure.mgmt.databoxedge.v2019_08_01.models.StorageAccount :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either StorageAccount or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_08_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_08_01.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +436,21 @@ def begin_create_or_update( storage_account_name=storage_account_name, resource_group_name=resource_group_name, storage_account=storage_account, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -324,43 +462,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore def _delete_initial( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,14 +501,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the StorageAccount on the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -391,15 +520,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -414,22 +545,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -441,4 +564,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_triggers_operations.py index 4c849f643f23..fdfbb1b2be07 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_triggers_operations.py @@ -5,25 +5,187 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class TriggersOperations(object): """TriggersOperations operations. @@ -47,14 +209,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.TriggerList"] + device_name: str, + resource_group_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.TriggerList"]: """Lists all the triggers configured in the device. :param device_name: The device name. @@ -74,38 +236,35 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TriggerList', pipeline_response) + deserialized = self._deserialize("TriggerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -123,19 +282,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Trigger" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Trigger": """Get a specific trigger by name. :param device_name: The device name. @@ -154,28 +314,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -189,49 +339,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - trigger, # type: "_models.Trigger" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Trigger"] + device_name: str, + name: str, + resource_group_name: str, + trigger: "_models.Trigger", + **kwargs: Any + ) -> Optional["_models.Trigger"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Trigger"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(trigger, 'Trigger') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(trigger, 'Trigger') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,17 +388,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - trigger, # type: "_models.Trigger" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Trigger"] + device_name: str, + name: str, + resource_group_name: str, + trigger: "_models.Trigger", + **kwargs: Any + ) -> LROPoller["_models.Trigger"]: """Creates or updates a trigger. :param device_name: Creates or updates a trigger. @@ -270,15 +413,18 @@ def begin_create_or_update( :type trigger: ~azure.mgmt.databoxedge.v2019_08_01.models.Trigger :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Trigger or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_08_01.models.Trigger] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Trigger"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +437,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, trigger=trigger, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Trigger', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -324,43 +463,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,14 +502,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the trigger on the gateway device. :param device_name: The device name. @@ -391,15 +521,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -414,22 +546,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -441,4 +565,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_users_operations.py index 2a8deed319aa..3e5bdb396bcc 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_users_operations.py @@ -5,25 +5,187 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class UsersOperations(object): """UsersOperations operations. @@ -47,14 +209,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UserList"] + device_name: str, + resource_group_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.UserList"]: """Gets all the users registered on a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -73,38 +235,35 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('UserList', pipeline_response) + deserialized = self._deserialize("UserList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -122,19 +281,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.User" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.User": """Gets the properties of the specified user. :param device_name: The device name. @@ -153,28 +313,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -188,49 +338,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - user, # type: "_models.User" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.User"] + device_name: str, + name: str, + resource_group_name: str, + user: "_models.User", + **kwargs: Any + ) -> Optional["_models.User"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.User"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(user, 'User') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(user, 'User') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -246,17 +387,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - user, # type: "_models.User" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.User"] + device_name: str, + name: str, + resource_group_name: str, + user: "_models.User", + **kwargs: Any + ) -> LROPoller["_models.User"]: """Creates a new user or updates an existing user's information on a Data Box Edge/Data Box Gateway device. @@ -270,15 +413,18 @@ def begin_create_or_update( :type user: ~azure.mgmt.databoxedge.v2019_08_01.models.User :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either User or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2019_08_01.models.User] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.User"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +437,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, user=user, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('User', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -324,43 +463,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-08-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,14 +502,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the user on a databox edge/gateway device. :param device_name: The device name. @@ -391,15 +521,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -414,22 +546,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -441,4 +565,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/__init__.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/__init__.py index e63196b6b98f..577ebf317c02 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/__init__.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/__init__.py @@ -7,10 +7,12 @@ # -------------------------------------------------------------------------- from ._data_box_edge_management_client import DataBoxEdgeManagementClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['DataBoxEdgeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_configuration.py index be5da99674c4..0099ec62ae76 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_configuration.py @@ -6,19 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential -VERSION = "unknown" class DataBoxEdgeManagementClientConfiguration(Configuration): """Configuration for DataBoxEdgeManagementClient. @@ -34,16 +33,15 @@ class DataBoxEdgeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -67,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_data_box_edge_management_client.py index 8cbea50f1d6a..57e204912c27 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_data_box_edge_management_client.py @@ -6,58 +6,43 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import DataBoxEdgeManagementClientConfiguration +from .operations import AlertsOperations, AvailableSkusOperations, BandwidthSchedulesOperations, ContainersOperations, DevicesOperations, JobsOperations, NodesOperations, Operations, OperationsStatusOperations, OrdersOperations, RolesOperations, SharesOperations, SkusOperations, StorageAccountCredentialsOperations, StorageAccountsOperations, TriggersOperations, UsersOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import DataBoxEdgeManagementClientConfiguration -from .operations import Operations -from .operations import AvailableSkusOperations -from .operations import DevicesOperations -from .operations import AlertsOperations -from .operations import BandwidthSchedulesOperations -from .operations import JobsOperations -from .operations import NodesOperations -from .operations import OperationsStatusOperations -from .operations import OrdersOperations -from .operations import RolesOperations -from .operations import SharesOperations -from .operations import StorageAccountCredentialsOperations -from .operations import StorageAccountsOperations -from .operations import ContainersOperations -from .operations import TriggersOperations -from .operations import UsersOperations -from .operations import SkusOperations -from . import models - -class DataBoxEdgeManagementClient(object): +class DataBoxEdgeManagementClient: """The DataBoxEdge Client. :ivar operations: Operations operations :vartype operations: azure.mgmt.databoxedge.v2020_05_01_preview.operations.Operations :ivar available_skus: AvailableSkusOperations operations - :vartype available_skus: azure.mgmt.databoxedge.v2020_05_01_preview.operations.AvailableSkusOperations + :vartype available_skus: + azure.mgmt.databoxedge.v2020_05_01_preview.operations.AvailableSkusOperations :ivar devices: DevicesOperations operations :vartype devices: azure.mgmt.databoxedge.v2020_05_01_preview.operations.DevicesOperations :ivar alerts: AlertsOperations operations :vartype alerts: azure.mgmt.databoxedge.v2020_05_01_preview.operations.AlertsOperations :ivar bandwidth_schedules: BandwidthSchedulesOperations operations - :vartype bandwidth_schedules: azure.mgmt.databoxedge.v2020_05_01_preview.operations.BandwidthSchedulesOperations + :vartype bandwidth_schedules: + azure.mgmt.databoxedge.v2020_05_01_preview.operations.BandwidthSchedulesOperations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.databoxedge.v2020_05_01_preview.operations.JobsOperations :ivar nodes: NodesOperations operations :vartype nodes: azure.mgmt.databoxedge.v2020_05_01_preview.operations.NodesOperations :ivar operations_status: OperationsStatusOperations operations - :vartype operations_status: azure.mgmt.databoxedge.v2020_05_01_preview.operations.OperationsStatusOperations + :vartype operations_status: + azure.mgmt.databoxedge.v2020_05_01_preview.operations.OperationsStatusOperations :ivar orders: OrdersOperations operations :vartype orders: azure.mgmt.databoxedge.v2020_05_01_preview.operations.OrdersOperations :ivar roles: RolesOperations operations @@ -65,9 +50,11 @@ class DataBoxEdgeManagementClient(object): :ivar shares: SharesOperations operations :vartype shares: azure.mgmt.databoxedge.v2020_05_01_preview.operations.SharesOperations :ivar storage_account_credentials: StorageAccountCredentialsOperations operations - :vartype storage_account_credentials: azure.mgmt.databoxedge.v2020_05_01_preview.operations.StorageAccountCredentialsOperations + :vartype storage_account_credentials: + azure.mgmt.databoxedge.v2020_05_01_preview.operations.StorageAccountCredentialsOperations :ivar storage_accounts: StorageAccountsOperations operations - :vartype storage_accounts: azure.mgmt.databoxedge.v2020_05_01_preview.operations.StorageAccountsOperations + :vartype storage_accounts: + azure.mgmt.databoxedge.v2020_05_01_preview.operations.StorageAccountsOperations :ivar containers: ContainersOperations operations :vartype containers: azure.mgmt.databoxedge.v2020_05_01_preview.operations.ContainersOperations :ivar triggers: TriggersOperations operations @@ -80,80 +67,70 @@ class DataBoxEdgeManagementClient(object): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = DataBoxEdgeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = DataBoxEdgeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.available_skus = AvailableSkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.orders = OrdersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.shares = SharesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.containers = ContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.available_skus = AvailableSkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bandwidth_schedules = BandwidthSchedulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations_status = OperationsStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_account_credentials = StorageAccountCredentialsOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_metadata.json b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_metadata.json index f54cc3d6befb..ed9474f049e8 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_metadata.json +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_metadata.json @@ -5,13 +5,13 @@ "name": "DataBoxEdgeManagementClient", "filename": "_data_box_edge_management_client", "description": "The DataBoxEdge Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "operations": "Operations", diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_patch.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_vendor.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_version.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/__init__.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/__init__.py index c33d46ee91d8..f33cac1fd9b0 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/__init__.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._data_box_edge_management_client import DataBoxEdgeManagementClient __all__ = ['DataBoxEdgeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/_configuration.py index 4f2e69f832d1..8ff70c0593ed 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/_configuration.py @@ -10,13 +10,14 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class DataBoxEdgeManagementClientConfiguration(Configuration): """Configuration for DataBoxEdgeManagementClient. @@ -36,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -63,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/_data_box_edge_management_client.py index a7fbbc2ca877..d88fa229b49a 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/_data_box_edge_management_client.py @@ -6,56 +6,43 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import DataBoxEdgeManagementClientConfiguration +from .operations import AlertsOperations, AvailableSkusOperations, BandwidthSchedulesOperations, ContainersOperations, DevicesOperations, JobsOperations, NodesOperations, Operations, OperationsStatusOperations, OrdersOperations, RolesOperations, SharesOperations, SkusOperations, StorageAccountCredentialsOperations, StorageAccountsOperations, TriggersOperations, UsersOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import DataBoxEdgeManagementClientConfiguration -from .operations import Operations -from .operations import AvailableSkusOperations -from .operations import DevicesOperations -from .operations import AlertsOperations -from .operations import BandwidthSchedulesOperations -from .operations import JobsOperations -from .operations import NodesOperations -from .operations import OperationsStatusOperations -from .operations import OrdersOperations -from .operations import RolesOperations -from .operations import SharesOperations -from .operations import StorageAccountCredentialsOperations -from .operations import StorageAccountsOperations -from .operations import ContainersOperations -from .operations import TriggersOperations -from .operations import UsersOperations -from .operations import SkusOperations -from .. import models - - -class DataBoxEdgeManagementClient(object): +class DataBoxEdgeManagementClient: """The DataBoxEdge Client. :ivar operations: Operations operations :vartype operations: azure.mgmt.databoxedge.v2020_05_01_preview.aio.operations.Operations :ivar available_skus: AvailableSkusOperations operations - :vartype available_skus: azure.mgmt.databoxedge.v2020_05_01_preview.aio.operations.AvailableSkusOperations + :vartype available_skus: + azure.mgmt.databoxedge.v2020_05_01_preview.aio.operations.AvailableSkusOperations :ivar devices: DevicesOperations operations :vartype devices: azure.mgmt.databoxedge.v2020_05_01_preview.aio.operations.DevicesOperations :ivar alerts: AlertsOperations operations :vartype alerts: azure.mgmt.databoxedge.v2020_05_01_preview.aio.operations.AlertsOperations :ivar bandwidth_schedules: BandwidthSchedulesOperations operations - :vartype bandwidth_schedules: azure.mgmt.databoxedge.v2020_05_01_preview.aio.operations.BandwidthSchedulesOperations + :vartype bandwidth_schedules: + azure.mgmt.databoxedge.v2020_05_01_preview.aio.operations.BandwidthSchedulesOperations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.databoxedge.v2020_05_01_preview.aio.operations.JobsOperations :ivar nodes: NodesOperations operations :vartype nodes: azure.mgmt.databoxedge.v2020_05_01_preview.aio.operations.NodesOperations :ivar operations_status: OperationsStatusOperations operations - :vartype operations_status: azure.mgmt.databoxedge.v2020_05_01_preview.aio.operations.OperationsStatusOperations + :vartype operations_status: + azure.mgmt.databoxedge.v2020_05_01_preview.aio.operations.OperationsStatusOperations :ivar orders: OrdersOperations operations :vartype orders: azure.mgmt.databoxedge.v2020_05_01_preview.aio.operations.OrdersOperations :ivar roles: RolesOperations operations @@ -63,11 +50,14 @@ class DataBoxEdgeManagementClient(object): :ivar shares: SharesOperations operations :vartype shares: azure.mgmt.databoxedge.v2020_05_01_preview.aio.operations.SharesOperations :ivar storage_account_credentials: StorageAccountCredentialsOperations operations - :vartype storage_account_credentials: azure.mgmt.databoxedge.v2020_05_01_preview.aio.operations.StorageAccountCredentialsOperations + :vartype storage_account_credentials: + azure.mgmt.databoxedge.v2020_05_01_preview.aio.operations.StorageAccountCredentialsOperations :ivar storage_accounts: StorageAccountsOperations operations - :vartype storage_accounts: azure.mgmt.databoxedge.v2020_05_01_preview.aio.operations.StorageAccountsOperations + :vartype storage_accounts: + azure.mgmt.databoxedge.v2020_05_01_preview.aio.operations.StorageAccountsOperations :ivar containers: ContainersOperations operations - :vartype containers: azure.mgmt.databoxedge.v2020_05_01_preview.aio.operations.ContainersOperations + :vartype containers: + azure.mgmt.databoxedge.v2020_05_01_preview.aio.operations.ContainersOperations :ivar triggers: TriggersOperations operations :vartype triggers: azure.mgmt.databoxedge.v2020_05_01_preview.aio.operations.TriggersOperations :ivar users: UsersOperations operations @@ -78,78 +68,70 @@ class DataBoxEdgeManagementClient(object): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = DataBoxEdgeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = DataBoxEdgeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.available_skus = AvailableSkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bandwidth_schedules = BandwidthSchedulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations_status = OperationsStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_account_credentials = StorageAccountCredentialsOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.available_skus = AvailableSkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.orders = OrdersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.shares = SharesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.containers = ContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/_patch.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_alerts_operations.py index 9cc9132e3f68..61f21fb47b2a 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_alerts_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._alerts_operations import build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,11 +46,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.AlertList"]: """Gets all the alerts for a Data Box Edge/Data Box Gateway device. @@ -55,7 +61,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AlertList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.AlertList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.AlertList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertList"] @@ -63,36 +70,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AlertList', pipeline_response) + deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,17 +114,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Alert": """Gets an alert by name. @@ -142,28 +148,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,4 +173,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_available_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_available_skus_operations.py index 3c1e56b6a241..3ead1c2a69fb 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_available_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_available_skus_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._available_skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,9 +46,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.DataBoxEdgeSkuList"]: """List all the available Skus and information related to them. @@ -51,7 +57,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DataBoxEdgeSkuList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataBoxEdgeSkuList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataBoxEdgeSkuList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeSkuList"] @@ -59,34 +66,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeSkuList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeSkuList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -104,6 +106,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_bandwidth_schedules_operations.py index 462909541584..0cc0c7e4d610 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_bandwidth_schedules_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._bandwidth_schedules_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.BandwidthSchedulesList"]: """Gets all the bandwidth schedules for a Data Box Edge/Data Box Gateway device. @@ -56,8 +62,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BandwidthSchedulesList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.BandwidthSchedulesList] + :return: An iterator like instance of either BandwidthSchedulesList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.BandwidthSchedulesList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedulesList"] @@ -65,36 +73,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BandwidthSchedulesList', pipeline_response) + deserialized = self._deserialize("BandwidthSchedulesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,17 +117,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.BandwidthSchedule": """Gets the properties of the specified bandwidth schedule. @@ -142,28 +149,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,48 +174,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, parameters: "_models.BandwidthSchedule", - **kwargs + **kwargs: Any ) -> Optional["_models.BandwidthSchedule"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BandwidthSchedule"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BandwidthSchedule') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BandwidthSchedule') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -234,15 +223,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, parameters: "_models.BandwidthSchedule", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.BandwidthSchedule"]: """Creates or updates a bandwidth schedule. @@ -256,15 +248,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.BandwidthSchedule :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BandwidthSchedule or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.BandwidthSchedule] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BandwidthSchedule or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.BandwidthSchedule] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedule"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,28 +274,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BandwidthSchedule', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -310,6 +300,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore async def _delete_initial( @@ -317,35 +308,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -358,12 +339,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the specified bandwidth schedule. @@ -375,15 +358,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -398,22 +383,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -425,4 +402,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_containers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_containers_operations.py index 5db7070e2ddc..6d38e119b928 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_containers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_containers_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._containers_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_storage_account_request, build_refresh_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_storage_account( self, device_name: str, storage_account_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ContainerList"]: """Lists all the containers of a storage Account in a Data Box Edge/Data Box Gateway device. @@ -62,7 +68,8 @@ def list_by_storage_account( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ContainerList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.ContainerList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.ContainerList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerList"] @@ -70,37 +77,35 @@ def list_by_storage_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_storage_account.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_account_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_storage_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_account_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ContainerList', pipeline_response) + deserialized = self._deserialize("ContainerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,18 +123,20 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_storage_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, storage_account_name: str, container_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Container": """Gets a container by name. @@ -153,29 +160,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -189,8 +186,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, @@ -198,41 +197,31 @@ async def _create_or_update_initial( container_name: str, resource_group_name: str, container: "_models.Container", - **kwargs + **kwargs: Any ) -> Optional["_models.Container"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Container"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(container, 'Container') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(container, 'Container') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -248,8 +237,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, @@ -257,7 +249,7 @@ async def begin_create_or_update( container_name: str, resource_group_name: str, container: "_models.Container", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Container"]: """Creates a new container or updates an existing container on the device. @@ -275,15 +267,20 @@ async def begin_create_or_update( :type container: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.Container :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Container or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.Container] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Container or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.Container] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Container"] lro_delay = kwargs.pop( 'polling_interval', @@ -297,29 +294,21 @@ async def begin_create_or_update( container_name=container_name, resource_group_name=resource_group_name, container=container, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Container', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -331,6 +320,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore async def _delete_initial( @@ -339,36 +329,26 @@ async def _delete_initial( storage_account_name: str, container_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -381,13 +361,15 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, storage_account_name: str, container_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the container on the Data Box Edge/Data Box Gateway device. @@ -401,15 +383,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -425,23 +409,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -453,6 +428,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore async def _refresh_initial( @@ -461,36 +437,26 @@ async def _refresh_initial( storage_account_name: str, container_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -503,13 +469,15 @@ async def _refresh_initial( _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh'} # type: ignore + + @distributed_trace_async async def begin_refresh( self, device_name: str, storage_account_name: str, container_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Refreshes the container metadata with the data from the cloud. @@ -525,15 +493,17 @@ async def begin_refresh( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -549,23 +519,14 @@ async def begin_refresh( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -577,4 +538,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_devices_operations.py index 0d9c4106ed4f..456ed0933320 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_devices_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._devices_operations import build_create_or_update_request_initial, build_create_or_update_security_settings_request_initial, build_delete_request_initial, build_download_updates_request_initial, build_get_extended_information_request, build_get_network_settings_request, build_get_request, build_get_update_summary_request, build_install_updates_request_initial, build_list_by_resource_group_request, build_list_by_subscription_request, build_scan_for_updates_request_initial, build_update_request, build_upload_certificate_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,10 +48,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, expand: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.DataBoxEdgeDeviceList"]: """Gets all the Data Box Edge/Data Box Gateway devices in a subscription. @@ -54,8 +60,10 @@ def list_by_subscription( Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -63,36 +71,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,16 +113,18 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, expand: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.DataBoxEdgeDeviceList"]: """Gets all the Data Box Edge/Data Box Gateway devices in a resource group. @@ -129,8 +134,10 @@ def list_by_resource_group( Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -138,37 +145,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -186,16 +189,18 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDevice": """Gets the properties of the Data Box Edge/Data Box Gateway device. @@ -213,27 +218,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,46 +242,38 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, resource_group_name: str, data_box_edge_device: "_models.DataBoxEdgeDevice", - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDevice": cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') + + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -300,14 +287,17 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, resource_group_name: str, data_box_edge_device: "_models.DataBoxEdgeDevice", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.DataBoxEdgeDevice"]: """Creates or updates a Data Box Edge/Data Box Gateway resource. @@ -316,18 +306,24 @@ async def begin_create_or_update( :param resource_group_name: The resource group name. :type resource_group_name: str :param data_box_edge_device: The resource object. - :type data_box_edge_device: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataBoxEdgeDevice + :type data_box_edge_device: + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataBoxEdgeDevice :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DataBoxEdgeDevice or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataBoxEdgeDevice] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DataBoxEdgeDevice or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataBoxEdgeDevice] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] lro_delay = kwargs.pop( 'polling_interval', @@ -339,27 +335,21 @@ async def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, data_box_edge_device=data_box_edge_device, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DataBoxEdgeDevice', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -371,40 +361,31 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore async def _delete_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -417,11 +398,13 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the Data Box Edge/Data Box Gateway device. @@ -431,15 +414,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -453,21 +438,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -479,14 +457,16 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + @distributed_trace_async async def update( self, device_name: str, resource_group_name: str, parameters: "_models.DataBoxEdgeDevicePatch", - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDevice": """Modifies a Data Box Edge/Data Box Gateway resource. @@ -506,32 +486,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') + + request = build_update_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -545,40 +515,32 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + async def _download_updates_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._download_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_download_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._download_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -591,11 +553,13 @@ async def _download_updates_initial( _download_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + + @distributed_trace_async async def begin_download_updates( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Downloads the updates on a Data Box Edge/Data Box Gateway device. @@ -607,15 +571,17 @@ async def begin_download_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -629,21 +595,14 @@ async def begin_download_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -655,13 +614,15 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_download_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + @distributed_trace_async async def get_extended_information( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDeviceExtendedInfo": """Gets additional information for the specified Data Box Edge/Data Box Gateway device. @@ -679,27 +640,17 @@ async def get_extended_information( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_extended_information.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_extended_information_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_extended_information.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -713,40 +664,32 @@ async def get_extended_information( return cls(pipeline_response, deserialized, {}) return deserialized + get_extended_information.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation'} # type: ignore + async def _install_updates_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._install_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_install_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._install_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -759,11 +702,13 @@ async def _install_updates_initial( _install_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + + @distributed_trace_async async def begin_install_updates( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Installs the updates on the Data Box Edge/Data Box Gateway device. @@ -775,15 +720,17 @@ async def begin_install_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -797,21 +744,14 @@ async def begin_install_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -823,13 +763,15 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_install_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + @distributed_trace_async async def get_network_settings( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.NetworkSettings": """Gets the network settings of the specified Data Box Edge/Data Box Gateway device. @@ -847,27 +789,17 @@ async def get_network_settings( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_network_settings.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_network_settings_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_network_settings.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -881,40 +813,32 @@ async def get_network_settings( return cls(pipeline_response, deserialized, {}) return deserialized + get_network_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/networkSettings/default'} # type: ignore + async def _scan_for_updates_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._scan_for_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_scan_for_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._scan_for_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -927,11 +851,13 @@ async def _scan_for_updates_initial( _scan_for_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore + + @distributed_trace_async async def begin_scan_for_updates( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Scans for updates on a Data Box Edge/Data Box Gateway device. @@ -943,15 +869,17 @@ async def begin_scan_for_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -965,21 +893,14 @@ async def begin_scan_for_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -991,6 +912,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_scan_for_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore async def _create_or_update_security_settings_initial( @@ -998,39 +920,29 @@ async def _create_or_update_security_settings_initial( device_name: str, resource_group_name: str, security_settings: "_models.SecuritySettings", - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_security_settings_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(security_settings, 'SecuritySettings') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_security_settings_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_security_settings_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(security_settings, 'SecuritySettings') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1043,12 +955,14 @@ async def _create_or_update_security_settings_initial( _create_or_update_security_settings_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + + @distributed_trace_async async def begin_create_or_update_security_settings( self, device_name: str, resource_group_name: str, security_settings: "_models.SecuritySettings", - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Updates the security settings on a Data Box Edge/Data Box Gateway device. @@ -1060,15 +974,18 @@ async def begin_create_or_update_security_settings( :type security_settings: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.SecuritySettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1080,24 +997,18 @@ async def begin_create_or_update_security_settings( device_name=device_name, resource_group_name=resource_group_name, security_settings=security_settings, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1109,15 +1020,18 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_security_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + @distributed_trace_async async def get_update_summary( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.UpdateSummary": - """Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. + """Gets information about the availability of updates based on the last scan of the device. It + also gets information about any ongoing download or install jobs on the device. Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. @@ -1136,27 +1050,17 @@ async def get_update_summary( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_update_summary.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_update_summary_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_update_summary.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1170,14 +1074,17 @@ async def get_update_summary( return cls(pipeline_response, deserialized, {}) return deserialized + get_update_summary.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default'} # type: ignore + + @distributed_trace_async async def upload_certificate( self, device_name: str, resource_group_name: str, parameters: "_models.UploadCertificateRequest", - **kwargs + **kwargs: Any ) -> "_models.UploadCertificateResponse": """Uploads registration certificate for the device. @@ -1197,32 +1104,22 @@ async def upload_certificate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.upload_certificate.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'UploadCertificateRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_upload_certificate_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.upload_certificate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'UploadCertificateRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1236,4 +1133,6 @@ async def upload_certificate( return cls(pipeline_response, deserialized, {}) return deserialized + upload_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/uploadCertificate'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_jobs_operations.py index 3a746f7e258a..6f006d1daf5c 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_jobs_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._jobs_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,12 +44,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Job": """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. @@ -67,28 +72,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -102,4 +97,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_nodes_operations.py index 7a91dc86646b..cee5039c4b57 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_nodes_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._nodes_operations import build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,11 +46,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.NodeList"]: """Gets all the nodes currently configured under this Data Box Edge device. @@ -55,7 +61,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either NodeList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.NodeList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.NodeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeList"] @@ -63,36 +70,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('NodeList', pipeline_response) + deserialized = self._deserialize("NodeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,6 +114,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_operations.py index 93b421dea3fc..620fc3f295f5 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,9 +46,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OperationsList"]: """List all the supported operations. @@ -51,7 +57,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.OperationsList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.OperationsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationsList"] @@ -59,30 +66,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationsList', pipeline_response) + deserialized = self._deserialize("OperationsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -100,6 +104,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_operations_status_operations.py index 9057292e9c95..8727370b1773 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_operations_status_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations_status_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,12 +44,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Job": """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. @@ -67,28 +72,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -102,4 +97,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/operationsStatus/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_orders_operations.py index 565453e7585c..bf4f198f5ed5 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_orders_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._orders_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OrderList"]: """Lists all the orders related to a Data Box Edge/Data Box Gateway device. @@ -59,7 +65,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OrderList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.OrderList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.OrderList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OrderList"] @@ -67,36 +74,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OrderList', pipeline_response) + deserialized = self._deserialize("OrderList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,16 +118,18 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Order": """Gets a specific order by name. @@ -143,27 +149,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,46 +173,38 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + async def _create_or_update_initial( self, device_name: str, resource_group_name: str, order: "_models.Order", - **kwargs + **kwargs: Any ) -> Optional["_models.Order"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Order"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(order, 'Order') + + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(order, 'Order') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -232,14 +220,17 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, resource_group_name: str, order: "_models.Order", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Order"]: """Creates or updates an order. @@ -253,15 +244,19 @@ async def begin_create_or_update( :type order: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.Order :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Order or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.Order] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.Order] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Order"] lro_delay = kwargs.pop( 'polling_interval', @@ -273,27 +268,21 @@ async def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, order=order, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Order', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -305,40 +294,31 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore async def _delete_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -351,11 +331,13 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the order related to the device. @@ -367,15 +349,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -389,21 +373,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -415,4 +392,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_roles_operations.py index adc1ae3c4fb4..707f7c063749 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_roles_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._roles_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.RoleList"]: """Lists all the roles configured in a Data Box Edge/Data Box Gateway device. @@ -57,7 +63,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RoleList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.RoleList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.RoleList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleList"] @@ -65,36 +72,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RoleList', pipeline_response) + deserialized = self._deserialize("RoleList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,17 +116,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Role": """Gets a specific role by name. @@ -142,28 +148,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,48 +173,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, role: "_models.Role", - **kwargs + **kwargs: Any ) -> Optional["_models.Role"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Role"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(role, 'Role') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(role, 'Role') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -234,15 +222,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, role: "_models.Role", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Role"]: """Create or update a role. @@ -256,15 +247,19 @@ async def begin_create_or_update( :type role: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.Role :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Role or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.Role] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.Role] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Role"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,28 +272,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, role=role, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Role', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -310,6 +298,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore async def _delete_initial( @@ -317,35 +306,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -358,12 +337,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the role on the device. @@ -375,15 +356,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -398,22 +381,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -425,4 +400,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_shares_operations.py index 1771708a1408..59693281a184 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_shares_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._shares_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request, build_refresh_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ShareList"]: """Lists all the shares in a Data Box Edge/Data Box Gateway device. @@ -59,7 +65,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ShareList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.ShareList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.ShareList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ShareList"] @@ -67,36 +74,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ShareList', pipeline_response) + deserialized = self._deserialize("ShareList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,17 +118,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Share": """Gets a share by name. @@ -146,28 +152,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -181,48 +177,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, share: "_models.Share", - **kwargs + **kwargs: Any ) -> Optional["_models.Share"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Share"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(share, 'Share') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(share, 'Share') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -238,15 +226,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, share: "_models.Share", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Share"]: """Creates a new share or updates an existing share on the device. @@ -262,15 +253,19 @@ async def begin_create_or_update( :type share: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.Share :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Share or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.Share] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.Share] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Share"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,28 +278,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, share=share, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Share', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -316,6 +304,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore async def _delete_initial( @@ -323,35 +312,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,12 +343,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the share on the Data Box Edge/Data Box Gateway device. @@ -381,15 +362,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -404,22 +387,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -431,6 +406,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore async def _refresh_initial( @@ -438,35 +414,25 @@ async def _refresh_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -479,12 +445,14 @@ async def _refresh_initial( _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore + + @distributed_trace_async async def begin_refresh( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Refreshes the share metadata with the data from the cloud. @@ -498,15 +466,17 @@ async def begin_refresh( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -521,22 +491,14 @@ async def begin_refresh( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -548,4 +510,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_skus_operations.py index 228a2c7841be..b01a9a815df7 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_skus_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,10 +46,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, filter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.SkuInformationList"]: """List all the available Skus in the region and information related to them. @@ -54,7 +60,8 @@ def list( :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SkuInformationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.SkuInformationList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.SkuInformationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SkuInformationList"] @@ -62,36 +69,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SkuInformationList', pipeline_response) + deserialized = self._deserialize("SkuInformationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -109,6 +111,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_storage_account_credentials_operations.py index 02f5294dfcc7..8dd5e1021867 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_storage_account_credentials_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._storage_account_credentials_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.StorageAccountCredentialList"]: """Gets all the storage account credentials in a Data Box Edge/Data Box Gateway device. @@ -58,8 +64,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountCredentialList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.StorageAccountCredentialList] + :return: An iterator like instance of either StorageAccountCredentialList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.StorageAccountCredentialList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredentialList"] @@ -67,36 +75,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('StorageAccountCredentialList', pipeline_response) + deserialized = self._deserialize("StorageAccountCredentialList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,17 +119,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.StorageAccountCredential": """Gets the properties of the specified storage account credential. @@ -144,28 +151,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -179,48 +176,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, storage_account_credential: "_models.StorageAccountCredential", - **kwargs + **kwargs: Any ) -> Optional["_models.StorageAccountCredential"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccountCredential"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(storage_account_credential, 'StorageAccountCredential') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_account_credential, 'StorageAccountCredential') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -236,15 +225,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, storage_account_credential: "_models.StorageAccountCredential", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.StorageAccountCredential"]: """Creates or updates the storage account credential. @@ -255,18 +247,24 @@ async def begin_create_or_update( :param resource_group_name: The resource group name. :type resource_group_name: str :param storage_account_credential: The storage account credential. - :type storage_account_credential: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.StorageAccountCredential + :type storage_account_credential: + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.StorageAccountCredential :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either StorageAccountCredential or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.StorageAccountCredential] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageAccountCredential or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.StorageAccountCredential] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredential"] lro_delay = kwargs.pop( 'polling_interval', @@ -279,28 +277,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, storage_account_credential=storage_account_credential, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccountCredential', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -312,6 +303,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore async def _delete_initial( @@ -319,35 +311,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -360,12 +342,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the storage account credential. @@ -377,15 +361,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -400,22 +386,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -427,4 +405,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_storage_accounts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_storage_accounts_operations.py index 86a4c0757ba9..eb945a943332 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_storage_accounts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_storage_accounts_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._storage_accounts_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.StorageAccountList"]: """Lists all the storage accounts in a Data Box Edge/Data Box Gateway device. @@ -59,7 +65,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either StorageAccountList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.StorageAccountList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.StorageAccountList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountList"] @@ -67,36 +74,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('StorageAccountList', pipeline_response) + deserialized = self._deserialize("StorageAccountList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,17 +118,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, storage_account_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.StorageAccount": """Gets a StorageAccount by name. @@ -146,28 +152,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -181,48 +177,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, storage_account_name: str, resource_group_name: str, storage_account: "_models.StorageAccount", - **kwargs + **kwargs: Any ) -> Optional["_models.StorageAccount"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(storage_account, 'StorageAccount') + + request = build_create_or_update_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_account, 'StorageAccount') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -238,15 +226,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, storage_account_name: str, resource_group_name: str, storage_account: "_models.StorageAccount", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.StorageAccount"]: """Creates a new StorageAccount or updates an existing StorageAccount on the device. @@ -262,15 +253,20 @@ async def begin_create_or_update( :type storage_account: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.StorageAccount :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either StorageAccount or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,28 +279,21 @@ async def begin_create_or_update( storage_account_name=storage_account_name, resource_group_name=resource_group_name, storage_account=storage_account, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -316,6 +305,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore async def _delete_initial( @@ -323,35 +313,25 @@ async def _delete_initial( device_name: str, storage_account_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,12 +344,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, storage_account_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the StorageAccount on the Data Box Edge/Data Box Gateway device. @@ -381,15 +363,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -404,22 +388,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -431,4 +407,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_triggers_operations.py index def269de6448..0ce512c38020 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_triggers_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._triggers_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, filter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.TriggerList"]: """Lists all the triggers configured in the device. @@ -61,7 +67,8 @@ def list_by_data_box_edge_device( :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TriggerList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.TriggerList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.TriggerList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TriggerList"] @@ -69,38 +76,35 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TriggerList', pipeline_response) + deserialized = self._deserialize("TriggerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,17 +122,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Trigger": """Get a specific trigger by name. @@ -148,28 +154,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,48 +179,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, trigger: "_models.Trigger", - **kwargs + **kwargs: Any ) -> Optional["_models.Trigger"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Trigger"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(trigger, 'Trigger') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(trigger, 'Trigger') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,15 +228,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, trigger: "_models.Trigger", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Trigger"]: """Creates or updates a trigger. @@ -262,15 +253,20 @@ async def begin_create_or_update( :type trigger: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.Trigger :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Trigger or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.Trigger] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Trigger or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.Trigger] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Trigger"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,28 +279,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, trigger=trigger, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Trigger', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -316,6 +305,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore async def _delete_initial( @@ -323,35 +313,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,12 +344,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the trigger on the gateway device. @@ -381,15 +363,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -404,22 +388,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -431,4 +407,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_users_operations.py index b839c9783245..e64a3ec11b4a 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_users_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._users_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, filter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.UserList"]: """Gets all the users registered on a Data Box Edge/Data Box Gateway device. @@ -60,7 +66,8 @@ def list_by_data_box_edge_device( :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.UserList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.UserList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UserList"] @@ -68,38 +75,35 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('UserList', pipeline_response) + deserialized = self._deserialize("UserList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,17 +121,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.User": """Gets the properties of the specified user. @@ -147,28 +153,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -182,48 +178,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, user: "_models.User", - **kwargs + **kwargs: Any ) -> Optional["_models.User"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.User"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(user, 'User') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(user, 'User') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,15 +227,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, user: "_models.User", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.User"]: """Creates a new user or updates an existing user's information on a Data Box Edge/Data Box Gateway device. @@ -262,15 +253,19 @@ async def begin_create_or_update( :type user: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.User :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either User or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.User] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.User] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.User"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,28 +278,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, user=user, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('User', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -316,6 +304,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore async def _delete_initial( @@ -323,35 +312,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,12 +343,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the user on a databox edge/gateway device. @@ -381,15 +362,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -404,22 +387,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -431,4 +406,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/models/__init__.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/models/__init__.py index 2d4899f0eba8..995511019b65 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/models/__init__.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/models/__init__.py @@ -6,172 +6,89 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ARMBaseModel - from ._models_py3 import Address - from ._models_py3 import Alert - from ._models_py3 import AlertErrorDetails - from ._models_py3 import AlertList - from ._models_py3 import AsymmetricEncryptedSecret - from ._models_py3 import Authentication - from ._models_py3 import AzureContainerInfo - from ._models_py3 import BandwidthSchedule - from ._models_py3 import BandwidthSchedulesList - from ._models_py3 import ClientAccessRight - from ._models_py3 import CloudErrorBody - from ._models_py3 import ContactDetails - from ._models_py3 import Container - from ._models_py3 import ContainerList - from ._models_py3 import DataBoxEdgeDevice - from ._models_py3 import DataBoxEdgeDeviceExtendedInfo - from ._models_py3 import DataBoxEdgeDeviceList - from ._models_py3 import DataBoxEdgeDevicePatch - from ._models_py3 import DataBoxEdgeSku - from ._models_py3 import DataBoxEdgeSkuList - from ._models_py3 import FileEventTrigger - from ._models_py3 import FileSourceInfo - from ._models_py3 import ImageRepositoryCredential - from ._models_py3 import IoTDeviceInfo - from ._models_py3 import IoTEdgeAgentInfo - from ._models_py3 import IoTRole - from ._models_py3 import Ipv4Config - from ._models_py3 import Ipv6Config - from ._models_py3 import Job - from ._models_py3 import JobErrorDetails - from ._models_py3 import JobErrorItem - from ._models_py3 import MetricDimensionV1 - from ._models_py3 import MetricSpecificationV1 - from ._models_py3 import MountPointMap - from ._models_py3 import NetworkAdapter - from ._models_py3 import NetworkAdapterPosition - from ._models_py3 import NetworkSettings - from ._models_py3 import Node - from ._models_py3 import NodeList - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationsList - from ._models_py3 import Order - from ._models_py3 import OrderList - from ._models_py3 import OrderStatus - from ._models_py3 import PeriodicTimerEventTrigger - from ._models_py3 import PeriodicTimerSourceInfo - from ._models_py3 import RefreshDetails - from ._models_py3 import ResourceTypeSku - from ._models_py3 import Role - from ._models_py3 import RoleList - from ._models_py3 import RoleSinkInfo - from ._models_py3 import SKUCapability - from ._models_py3 import SecuritySettings - from ._models_py3 import ServiceSpecification - from ._models_py3 import Share - from ._models_py3 import ShareAccessRight - from ._models_py3 import ShareList - from ._models_py3 import Sku - from ._models_py3 import SkuCost - from ._models_py3 import SkuInformation - from ._models_py3 import SkuInformationList - from ._models_py3 import SkuLocationInfo - from ._models_py3 import SkuRestriction - from ._models_py3 import SkuRestrictionInfo - from ._models_py3 import StorageAccount - from ._models_py3 import StorageAccountCredential - from ._models_py3 import StorageAccountCredentialList - from ._models_py3 import StorageAccountList - from ._models_py3 import SymmetricKey - from ._models_py3 import TrackingInfo - from ._models_py3 import Trigger - from ._models_py3 import TriggerList - from ._models_py3 import UpdateDownloadProgress - from ._models_py3 import UpdateInstallProgress - from ._models_py3 import UpdateSummary - from ._models_py3 import UploadCertificateRequest - from ._models_py3 import UploadCertificateResponse - from ._models_py3 import User - from ._models_py3 import UserAccessRight - from ._models_py3 import UserList -except (SyntaxError, ImportError): - from ._models import ARMBaseModel # type: ignore - from ._models import Address # type: ignore - from ._models import Alert # type: ignore - from ._models import AlertErrorDetails # type: ignore - from ._models import AlertList # type: ignore - from ._models import AsymmetricEncryptedSecret # type: ignore - from ._models import Authentication # type: ignore - from ._models import AzureContainerInfo # type: ignore - from ._models import BandwidthSchedule # type: ignore - from ._models import BandwidthSchedulesList # type: ignore - from ._models import ClientAccessRight # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import ContactDetails # type: ignore - from ._models import Container # type: ignore - from ._models import ContainerList # type: ignore - from ._models import DataBoxEdgeDevice # type: ignore - from ._models import DataBoxEdgeDeviceExtendedInfo # type: ignore - from ._models import DataBoxEdgeDeviceList # type: ignore - from ._models import DataBoxEdgeDevicePatch # type: ignore - from ._models import DataBoxEdgeSku # type: ignore - from ._models import DataBoxEdgeSkuList # type: ignore - from ._models import FileEventTrigger # type: ignore - from ._models import FileSourceInfo # type: ignore - from ._models import ImageRepositoryCredential # type: ignore - from ._models import IoTDeviceInfo # type: ignore - from ._models import IoTEdgeAgentInfo # type: ignore - from ._models import IoTRole # type: ignore - from ._models import Ipv4Config # type: ignore - from ._models import Ipv6Config # type: ignore - from ._models import Job # type: ignore - from ._models import JobErrorDetails # type: ignore - from ._models import JobErrorItem # type: ignore - from ._models import MetricDimensionV1 # type: ignore - from ._models import MetricSpecificationV1 # type: ignore - from ._models import MountPointMap # type: ignore - from ._models import NetworkAdapter # type: ignore - from ._models import NetworkAdapterPosition # type: ignore - from ._models import NetworkSettings # type: ignore - from ._models import Node # type: ignore - from ._models import NodeList # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationsList # type: ignore - from ._models import Order # type: ignore - from ._models import OrderList # type: ignore - from ._models import OrderStatus # type: ignore - from ._models import PeriodicTimerEventTrigger # type: ignore - from ._models import PeriodicTimerSourceInfo # type: ignore - from ._models import RefreshDetails # type: ignore - from ._models import ResourceTypeSku # type: ignore - from ._models import Role # type: ignore - from ._models import RoleList # type: ignore - from ._models import RoleSinkInfo # type: ignore - from ._models import SKUCapability # type: ignore - from ._models import SecuritySettings # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Share # type: ignore - from ._models import ShareAccessRight # type: ignore - from ._models import ShareList # type: ignore - from ._models import Sku # type: ignore - from ._models import SkuCost # type: ignore - from ._models import SkuInformation # type: ignore - from ._models import SkuInformationList # type: ignore - from ._models import SkuLocationInfo # type: ignore - from ._models import SkuRestriction # type: ignore - from ._models import SkuRestrictionInfo # type: ignore - from ._models import StorageAccount # type: ignore - from ._models import StorageAccountCredential # type: ignore - from ._models import StorageAccountCredentialList # type: ignore - from ._models import StorageAccountList # type: ignore - from ._models import SymmetricKey # type: ignore - from ._models import TrackingInfo # type: ignore - from ._models import Trigger # type: ignore - from ._models import TriggerList # type: ignore - from ._models import UpdateDownloadProgress # type: ignore - from ._models import UpdateInstallProgress # type: ignore - from ._models import UpdateSummary # type: ignore - from ._models import UploadCertificateRequest # type: ignore - from ._models import UploadCertificateResponse # type: ignore - from ._models import User # type: ignore - from ._models import UserAccessRight # type: ignore - from ._models import UserList # type: ignore +from ._models_py3 import ARMBaseModel +from ._models_py3 import Address +from ._models_py3 import Alert +from ._models_py3 import AlertErrorDetails +from ._models_py3 import AlertList +from ._models_py3 import AsymmetricEncryptedSecret +from ._models_py3 import Authentication +from ._models_py3 import AzureContainerInfo +from ._models_py3 import BandwidthSchedule +from ._models_py3 import BandwidthSchedulesList +from ._models_py3 import ClientAccessRight +from ._models_py3 import CloudErrorBody +from ._models_py3 import ContactDetails +from ._models_py3 import Container +from ._models_py3 import ContainerList +from ._models_py3 import DataBoxEdgeDevice +from ._models_py3 import DataBoxEdgeDeviceExtendedInfo +from ._models_py3 import DataBoxEdgeDeviceList +from ._models_py3 import DataBoxEdgeDevicePatch +from ._models_py3 import DataBoxEdgeSku +from ._models_py3 import DataBoxEdgeSkuList +from ._models_py3 import FileEventTrigger +from ._models_py3 import FileSourceInfo +from ._models_py3 import ImageRepositoryCredential +from ._models_py3 import IoTDeviceInfo +from ._models_py3 import IoTEdgeAgentInfo +from ._models_py3 import IoTRole +from ._models_py3 import Ipv4Config +from ._models_py3 import Ipv6Config +from ._models_py3 import Job +from ._models_py3 import JobErrorDetails +from ._models_py3 import JobErrorItem +from ._models_py3 import MetricDimensionV1 +from ._models_py3 import MetricSpecificationV1 +from ._models_py3 import MountPointMap +from ._models_py3 import NetworkAdapter +from ._models_py3 import NetworkAdapterPosition +from ._models_py3 import NetworkSettings +from ._models_py3 import Node +from ._models_py3 import NodeList +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationsList +from ._models_py3 import Order +from ._models_py3 import OrderList +from ._models_py3 import OrderStatus +from ._models_py3 import PeriodicTimerEventTrigger +from ._models_py3 import PeriodicTimerSourceInfo +from ._models_py3 import RefreshDetails +from ._models_py3 import ResourceTypeSku +from ._models_py3 import Role +from ._models_py3 import RoleList +from ._models_py3 import RoleSinkInfo +from ._models_py3 import SKUCapability +from ._models_py3 import SecuritySettings +from ._models_py3 import ServiceSpecification +from ._models_py3 import Share +from ._models_py3 import ShareAccessRight +from ._models_py3 import ShareList +from ._models_py3 import Sku +from ._models_py3 import SkuCost +from ._models_py3 import SkuInformation +from ._models_py3 import SkuInformationList +from ._models_py3 import SkuLocationInfo +from ._models_py3 import SkuRestriction +from ._models_py3 import SkuRestrictionInfo +from ._models_py3 import StorageAccount +from ._models_py3 import StorageAccountCredential +from ._models_py3 import StorageAccountCredentialList +from ._models_py3 import StorageAccountList +from ._models_py3 import SymmetricKey +from ._models_py3 import TrackingInfo +from ._models_py3 import Trigger +from ._models_py3 import TriggerList +from ._models_py3 import UpdateDownloadProgress +from ._models_py3 import UpdateInstallProgress +from ._models_py3 import UpdateSummary +from ._models_py3 import UploadCertificateRequest +from ._models_py3 import UploadCertificateResponse +from ._models_py3 import User +from ._models_py3 import UserAccessRight +from ._models_py3 import UserList + from ._data_box_edge_management_client_enums import ( AccountType, diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/models/_data_box_edge_management_client_enums.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/models/_data_box_edge_management_client_enums.py index cef0587a6c20..d907a831a3af 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/models/_data_box_edge_management_client_enums.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/models/_data_box_edge_management_client_enums.py @@ -6,34 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccountType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of storage accessed on the storage account. """ GENERAL_PURPOSE_STORAGE = "GeneralPurposeStorage" BLOB_STORAGE = "BlobStorage" -class AlertSeverity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AlertSeverity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Severity of the alert. """ @@ -41,14 +26,14 @@ class AlertSeverity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" CRITICAL = "Critical" -class AuthenticationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AuthenticationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The authentication type. """ INVALID = "Invalid" AZURE_ACTIVE_DIRECTORY = "AzureActiveDirectory" -class AzureContainerDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AzureContainerDataFormat(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Storage format used for the file represented by the share. """ @@ -56,7 +41,7 @@ class AzureContainerDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu PAGE_BLOB = "PageBlob" AZURE_FILE = "AzureFile" -class ClientPermissionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ClientPermissionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of access to be allowed for the client. """ @@ -64,7 +49,7 @@ class ClientPermissionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ_ONLY = "ReadOnly" READ_WRITE = "ReadWrite" -class ContainerStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ContainerStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current status of the container. """ @@ -74,7 +59,7 @@ class ContainerStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UPDATING = "Updating" NEEDS_ATTENTION = "NeedsAttention" -class DataBoxEdgeDeviceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DataBoxEdgeDeviceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the Data Box Edge/Gateway device. """ @@ -86,14 +71,14 @@ class DataBoxEdgeDeviceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum PARTIALLY_DISCONNECTED = "PartiallyDisconnected" MAINTENANCE = "Maintenance" -class DataPolicy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DataPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Data policy of the share. """ CLOUD = "Cloud" LOCAL = "Local" -class DayOfWeek(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DayOfWeek(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SUNDAY = "Sunday" MONDAY = "Monday" @@ -103,13 +88,13 @@ class DayOfWeek(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FRIDAY = "Friday" SATURDAY = "Saturday" -class DeviceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeviceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the Data Box Edge/Gateway device. """ DATA_BOX_EDGE_DEVICE = "DataBoxEdgeDevice" -class DownloadPhase(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DownloadPhase(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The download phase. """ @@ -118,7 +103,7 @@ class DownloadPhase(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DOWNLOADING = "Downloading" VERIFYING = "Verifying" -class EncryptionAlgorithm(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The algorithm used to encrypt "Value". """ @@ -126,14 +111,14 @@ class EncryptionAlgorithm(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AES256 = "AES256" RSAES_PKCS1_V1_5 = "RSAES_PKCS1_v_1_5" -class HostPlatformType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HostPlatformType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Platform where the Iot runtime is hosted. """ KUBERNETES_CLUSTER = "KubernetesCluster" LINUX_VM = "LinuxVM" -class InstallRebootBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InstallRebootBehavior(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates if updates are available and at least one of the updates needs a reboot. """ @@ -141,7 +126,7 @@ class InstallRebootBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) REQUIRES_REBOOT = "RequiresReboot" REQUEST_REBOOT = "RequestReboot" -class JobStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JobStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current status of the job. """ @@ -153,7 +138,7 @@ class JobStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PAUSED = "Paused" SCHEDULED = "Scheduled" -class JobType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JobType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the job. """ @@ -164,7 +149,7 @@ class JobType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): REFRESH_SHARE = "RefreshShare" REFRESH_CONTAINER = "RefreshContainer" -class MetricAggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricAggregationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Metric aggregation type. """ @@ -176,14 +161,14 @@ class MetricAggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) TOTAL = "Total" COUNT = "Count" -class MetricCategory(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricCategory(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Metric category. """ CAPACITY = "Capacity" TRANSACTION = "Transaction" -class MetricUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Metric units. """ @@ -196,42 +181,42 @@ class MetricUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BYTES_PER_SECOND = "BytesPerSecond" COUNT_PER_SECOND = "CountPerSecond" -class MonitoringStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MonitoringStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current monitoring status of the share. """ ENABLED = "Enabled" DISABLED = "Disabled" -class MountType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MountType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Mounting type. """ VOLUME = "Volume" HOST_PATH = "HostPath" -class NetworkAdapterDHCPStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkAdapterDHCPStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Value indicating whether this adapter has DHCP enabled. """ DISABLED = "Disabled" ENABLED = "Enabled" -class NetworkAdapterRDMAStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkAdapterRDMAStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Value indicating whether this adapter is RDMA capable. """ INCAPABLE = "Incapable" CAPABLE = "Capable" -class NetworkAdapterStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkAdapterStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Value indicating whether this adapter is valid. """ INACTIVE = "Inactive" ACTIVE = "Active" -class NetworkGroup(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkGroup(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The network group. """ @@ -239,7 +224,7 @@ class NetworkGroup(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): NON_RDMA = "NonRDMA" RDMA = "RDMA" -class NodeStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NodeStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current status of the individual node """ @@ -249,7 +234,7 @@ class NodeStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): REBOOTING = "Rebooting" SHUTTING_DOWN = "ShuttingDown" -class OrderState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OrderState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the order as per the allowed status types. """ @@ -268,35 +253,35 @@ class OrderState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SHIPPED_BACK = "ShippedBack" COLLECTED_AT_MICROSOFT = "CollectedAtMicrosoft" -class PlatformType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PlatformType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Host OS supported by the IoT role. """ WINDOWS = "Windows" LINUX = "Linux" -class RoleStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RoleStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Role status. """ ENABLED = "Enabled" DISABLED = "Disabled" -class RoleTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RoleTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): IOT = "IOT" ASA = "ASA" FUNCTIONS = "Functions" COGNITIVE = "Cognitive" -class ShareAccessProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareAccessProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Access protocol to be used by the share. """ SMB = "SMB" NFS = "NFS" -class ShareAccessType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareAccessType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of access to be allowed on the share for this user. """ @@ -304,7 +289,7 @@ class ShareAccessType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ = "Read" CUSTOM = "Custom" -class ShareStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current status of the share. """ @@ -314,14 +299,14 @@ class ShareStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UPDATING = "Updating" NEEDS_ATTENTION = "NeedsAttention" -class SkuAvailability(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuAvailability(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Is SKU available """ AVAILABLE = "Available" UNAVAILABLE = "Unavailable" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Sku name. """ @@ -339,41 +324,41 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): TCA_SMALL = "TCA_Small" GPU = "GPU" -class SkuRestrictionReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuRestrictionReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SKU restriction reason. """ NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" QUOTA_ID = "QuotaId" -class SkuSignupOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuSignupOption(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Can the SKU be signed up.. """ NONE = "None" AVAILABLE = "Available" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Sku tier. """ STANDARD = "Standard" -class SkuVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Sku version. """ STABLE = "Stable" PREVIEW = "Preview" -class SSLStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SSLStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Signifies whether SSL needs to be enabled or not. """ ENABLED = "Enabled" DISABLED = "Disabled" -class StorageAccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current status of the storage account """ @@ -383,7 +368,7 @@ class StorageAccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UPDATING = "Updating" NEEDS_ATTENTION = "NeedsAttention" -class TimeGrain(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TimeGrain(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PT1_M = "PT1M" PT5_M = "PT5M" @@ -394,14 +379,14 @@ class TimeGrain(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PT12_H = "PT12H" PT1_D = "PT1D" -class TriggerEventType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TriggerEventType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Trigger Kind. """ FILE_EVENT = "FileEvent" PERIODIC_TIMER_EVENT = "PeriodicTimerEvent" -class UpdateOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpdateOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current update operation. """ @@ -410,7 +395,7 @@ class UpdateOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DOWNLOAD = "Download" INSTALL = "Install" -class UpdateOperationStage(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpdateOperationStage(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current stage of the update operation. """ @@ -432,7 +417,7 @@ class UpdateOperationStage(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESCAN_COMPLETE = "RescanComplete" RESCAN_FAILED = "RescanFailed" -class UserType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UserType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the user. """ diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/models/_models.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/models/_models.py deleted file mode 100644 index 030d1bdf21d8..000000000000 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/models/_models.py +++ /dev/null @@ -1,3657 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class Address(msrest.serialization.Model): - """The shipping address of the customer. - - All required parameters must be populated in order to send to Azure. - - :param address_line1: Required. The address line1. - :type address_line1: str - :param address_line2: The address line2. - :type address_line2: str - :param address_line3: The address line3. - :type address_line3: str - :param postal_code: Required. The postal code. - :type postal_code: str - :param city: Required. The city name. - :type city: str - :param state: Required. The state name. - :type state: str - :param country: Required. The country name. - :type country: str - """ - - _validation = { - 'address_line1': {'required': True}, - 'postal_code': {'required': True}, - 'city': {'required': True}, - 'state': {'required': True}, - 'country': {'required': True}, - } - - _attribute_map = { - 'address_line1': {'key': 'addressLine1', 'type': 'str'}, - 'address_line2': {'key': 'addressLine2', 'type': 'str'}, - 'address_line3': {'key': 'addressLine3', 'type': 'str'}, - 'postal_code': {'key': 'postalCode', 'type': 'str'}, - 'city': {'key': 'city', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'country': {'key': 'country', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Address, self).__init__(**kwargs) - self.address_line1 = kwargs['address_line1'] - self.address_line2 = kwargs.get('address_line2', None) - self.address_line3 = kwargs.get('address_line3', None) - self.postal_code = kwargs['postal_code'] - self.city = kwargs['city'] - self.state = kwargs['state'] - self.country = kwargs['country'] - - -class ARMBaseModel(msrest.serialization.Model): - """Represents the base class for all object models. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ARMBaseModel, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class Alert(ARMBaseModel): - """Alert on the data box edge/gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar title: Alert title. - :vartype title: str - :ivar alert_type: Alert type. - :vartype alert_type: str - :ivar appeared_at_date_time: UTC time when the alert appeared. - :vartype appeared_at_date_time: ~datetime.datetime - :ivar recommendation: Alert recommendation. - :vartype recommendation: str - :ivar severity: Severity of the alert. Possible values include: "Informational", "Warning", - "Critical". - :vartype severity: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AlertSeverity - :ivar error_details: Error details of the alert. - :vartype error_details: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AlertErrorDetails - :ivar detailed_information: Alert details. - :vartype detailed_information: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'title': {'readonly': True}, - 'alert_type': {'readonly': True}, - 'appeared_at_date_time': {'readonly': True}, - 'recommendation': {'readonly': True}, - 'severity': {'readonly': True}, - 'error_details': {'readonly': True}, - 'detailed_information': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'title': {'key': 'properties.title', 'type': 'str'}, - 'alert_type': {'key': 'properties.alertType', 'type': 'str'}, - 'appeared_at_date_time': {'key': 'properties.appearedAtDateTime', 'type': 'iso-8601'}, - 'recommendation': {'key': 'properties.recommendation', 'type': 'str'}, - 'severity': {'key': 'properties.severity', 'type': 'str'}, - 'error_details': {'key': 'properties.errorDetails', 'type': 'AlertErrorDetails'}, - 'detailed_information': {'key': 'properties.detailedInformation', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(Alert, self).__init__(**kwargs) - self.title = None - self.alert_type = None - self.appeared_at_date_time = None - self.recommendation = None - self.severity = None - self.error_details = None - self.detailed_information = None - - -class AlertErrorDetails(msrest.serialization.Model): - """Error details for the alert. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error_code: Error code. - :vartype error_code: str - :ivar error_message: Error Message. - :vartype error_message: str - :ivar occurrences: Number of occurrences. - :vartype occurrences: int - """ - - _validation = { - 'error_code': {'readonly': True}, - 'error_message': {'readonly': True}, - 'occurrences': {'readonly': True}, - } - - _attribute_map = { - 'error_code': {'key': 'errorCode', 'type': 'str'}, - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - 'occurrences': {'key': 'occurrences', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(AlertErrorDetails, self).__init__(**kwargs) - self.error_code = None - self.error_message = None - self.occurrences = None - - -class AlertList(msrest.serialization.Model): - """Collection of alerts. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The value. - :vartype value: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.Alert] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Alert]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AlertList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class AsymmetricEncryptedSecret(msrest.serialization.Model): - """Represent the secrets intended for encryption with asymmetric key pair. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The value of the secret. - :type value: str - :param encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the - value is unencrypted, it will be null. - :type encryption_cert_thumbprint: str - :param encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values - include: "None", "AES256", "RSAES_PKCS1_v_1_5". - :type encryption_algorithm: str or - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.EncryptionAlgorithm - """ - - _validation = { - 'value': {'required': True}, - 'encryption_algorithm': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'encryption_cert_thumbprint': {'key': 'encryptionCertThumbprint', 'type': 'str'}, - 'encryption_algorithm': {'key': 'encryptionAlgorithm', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AsymmetricEncryptedSecret, self).__init__(**kwargs) - self.value = kwargs['value'] - self.encryption_cert_thumbprint = kwargs.get('encryption_cert_thumbprint', None) - self.encryption_algorithm = kwargs['encryption_algorithm'] - - -class Authentication(msrest.serialization.Model): - """Authentication mechanism for IoT devices. - - :param symmetric_key: Symmetric key for authentication. - :type symmetric_key: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.SymmetricKey - """ - - _attribute_map = { - 'symmetric_key': {'key': 'symmetricKey', 'type': 'SymmetricKey'}, - } - - def __init__( - self, - **kwargs - ): - super(Authentication, self).__init__(**kwargs) - self.symmetric_key = kwargs.get('symmetric_key', None) - - -class AzureContainerInfo(msrest.serialization.Model): - """Azure container mapping of the endpoint. - - All required parameters must be populated in order to send to Azure. - - :param storage_account_credential_id: Required. ID of the storage account credential used to - access storage. - :type storage_account_credential_id: str - :param container_name: Required. Container name (Based on the data format specified, this - represents the name of Azure Files/Page blob/Block blob). - :type container_name: str - :param data_format: Required. Storage format used for the file represented by the share. - Possible values include: "BlockBlob", "PageBlob", "AzureFile". - :type data_format: str or - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AzureContainerDataFormat - """ - - _validation = { - 'storage_account_credential_id': {'required': True}, - 'container_name': {'required': True}, - 'data_format': {'required': True}, - } - - _attribute_map = { - 'storage_account_credential_id': {'key': 'storageAccountCredentialId', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'data_format': {'key': 'dataFormat', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureContainerInfo, self).__init__(**kwargs) - self.storage_account_credential_id = kwargs['storage_account_credential_id'] - self.container_name = kwargs['container_name'] - self.data_format = kwargs['data_format'] - - -class BandwidthSchedule(ARMBaseModel): - """The bandwidth schedule details. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param start: Required. The start time of the schedule in UTC. - :type start: str - :param stop: Required. The stop time of the schedule in UTC. - :type stop: str - :param rate_in_mbps: Required. The bandwidth rate in Mbps. - :type rate_in_mbps: int - :param days: Required. The days of the week when this schedule is applicable. - :type days: list[str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.DayOfWeek] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'start': {'required': True}, - 'stop': {'required': True}, - 'rate_in_mbps': {'required': True}, - 'days': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'start': {'key': 'properties.start', 'type': 'str'}, - 'stop': {'key': 'properties.stop', 'type': 'str'}, - 'rate_in_mbps': {'key': 'properties.rateInMbps', 'type': 'int'}, - 'days': {'key': 'properties.days', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(BandwidthSchedule, self).__init__(**kwargs) - self.start = kwargs['start'] - self.stop = kwargs['stop'] - self.rate_in_mbps = kwargs['rate_in_mbps'] - self.days = kwargs['days'] - - -class BandwidthSchedulesList(msrest.serialization.Model): - """The collection of bandwidth schedules. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of bandwidth schedules. - :vartype value: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.BandwidthSchedule] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BandwidthSchedule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BandwidthSchedulesList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ClientAccessRight(msrest.serialization.Model): - """The mapping between a particular client IP and the type of access client has on the NFS share. - - All required parameters must be populated in order to send to Azure. - - :param client: Required. IP of the client. - :type client: str - :param access_permission: Required. Type of access to be allowed for the client. Possible - values include: "NoAccess", "ReadOnly", "ReadWrite". - :type access_permission: str or - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.ClientPermissionType - """ - - _validation = { - 'client': {'required': True}, - 'access_permission': {'required': True}, - } - - _attribute_map = { - 'client': {'key': 'client', 'type': 'str'}, - 'access_permission': {'key': 'accessPermission', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClientAccessRight, self).__init__(**kwargs) - self.client = kwargs['client'] - self.access_permission = kwargs['access_permission'] - - -class CloudErrorBody(msrest.serialization.Model): - """An error response from the service. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.CloudErrorBody] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudErrorBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.details = kwargs.get('details', None) - - -class ContactDetails(msrest.serialization.Model): - """Contains all the contact details of the customer. - - All required parameters must be populated in order to send to Azure. - - :param contact_person: Required. The contact person name. - :type contact_person: str - :param company_name: Required. The name of the company. - :type company_name: str - :param phone: Required. The phone number. - :type phone: str - :param email_list: Required. The email list. - :type email_list: list[str] - """ - - _validation = { - 'contact_person': {'required': True}, - 'company_name': {'required': True}, - 'phone': {'required': True}, - 'email_list': {'required': True}, - } - - _attribute_map = { - 'contact_person': {'key': 'contactPerson', 'type': 'str'}, - 'company_name': {'key': 'companyName', 'type': 'str'}, - 'phone': {'key': 'phone', 'type': 'str'}, - 'email_list': {'key': 'emailList', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ContactDetails, self).__init__(**kwargs) - self.contact_person = kwargs['contact_person'] - self.company_name = kwargs['company_name'] - self.phone = kwargs['phone'] - self.email_list = kwargs['email_list'] - - -class Container(ARMBaseModel): - """Represents a container on the Data Box Edge/Gateway device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar container_status: Current status of the container. Possible values include: "OK", - "Offline", "Unknown", "Updating", "NeedsAttention". - :vartype container_status: str or - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.ContainerStatus - :param data_format: Required. DataFormat for Container. Possible values include: "BlockBlob", - "PageBlob", "AzureFile". - :type data_format: str or - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AzureContainerDataFormat - :ivar refresh_details: Details of the refresh job on this container. - :vartype refresh_details: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.RefreshDetails - :ivar created_date_time: The UTC time when container got created. - :vartype created_date_time: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'container_status': {'readonly': True}, - 'data_format': {'required': True}, - 'refresh_details': {'readonly': True}, - 'created_date_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'container_status': {'key': 'properties.containerStatus', 'type': 'str'}, - 'data_format': {'key': 'properties.dataFormat', 'type': 'str'}, - 'refresh_details': {'key': 'properties.refreshDetails', 'type': 'RefreshDetails'}, - 'created_date_time': {'key': 'properties.createdDateTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(Container, self).__init__(**kwargs) - self.container_status = None - self.data_format = kwargs['data_format'] - self.refresh_details = None - self.created_date_time = None - - -class ContainerList(msrest.serialization.Model): - """Collection of all the containers on the Data Box Edge/Gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of containers. - :vartype value: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.Container] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Container]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContainerList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class DataBoxEdgeDevice(ARMBaseModel): - """The Data Box Edge/Gateway device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param location: Required. The location of the device. This is a supported and registered Azure - geographical region (for example, West US, East US, or Southeast Asia). The geographical region - of a device cannot be changed once it is created, but if an identical geographical region is - specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. The list of tags that describe the device. These tags can be used - to view and group this device (across resource groups). - :type tags: dict[str, str] - :param sku: The SKU type. - :type sku: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.Sku - :param etag: The etag for the devices. - :type etag: str - :param data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible - values include: "ReadyToSetup", "Online", "Offline", "NeedsAttention", "Disconnected", - "PartiallyDisconnected", "Maintenance". - :type data_box_edge_device_status: str or - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataBoxEdgeDeviceStatus - :ivar serial_number: The Serial Number of Data Box Edge/Gateway device. - :vartype serial_number: str - :param description: The Description of the Data Box Edge/Gateway device. - :type description: str - :param model_description: The description of the Data Box Edge/Gateway device model. - :type model_description: str - :ivar device_type: The type of the Data Box Edge/Gateway device. Possible values include: - "DataBoxEdgeDevice". - :vartype device_type: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.DeviceType - :param friendly_name: The Data Box Edge/Gateway device name. - :type friendly_name: str - :ivar culture: The Data Box Edge/Gateway device culture. - :vartype culture: str - :ivar device_model: The Data Box Edge/Gateway device model. - :vartype device_model: str - :ivar device_software_version: The Data Box Edge/Gateway device software version. - :vartype device_software_version: str - :ivar device_local_capacity: The Data Box Edge/Gateway device local capacity in MB. - :vartype device_local_capacity: long - :ivar time_zone: The Data Box Edge/Gateway device timezone. - :vartype time_zone: str - :ivar device_hcs_version: The device software version number of the device (eg: 1.2.18105.6). - :vartype device_hcs_version: str - :ivar configured_role_types: Type of compute roles configured. - :vartype configured_role_types: list[str or - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.RoleTypes] - :ivar node_count: The number of nodes in the cluster. - :vartype node_count: int - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'serial_number': {'readonly': True}, - 'device_type': {'readonly': True}, - 'culture': {'readonly': True}, - 'device_model': {'readonly': True}, - 'device_software_version': {'readonly': True}, - 'device_local_capacity': {'readonly': True}, - 'time_zone': {'readonly': True}, - 'device_hcs_version': {'readonly': True}, - 'configured_role_types': {'readonly': True}, - 'node_count': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'data_box_edge_device_status': {'key': 'properties.dataBoxEdgeDeviceStatus', 'type': 'str'}, - 'serial_number': {'key': 'properties.serialNumber', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'model_description': {'key': 'properties.modelDescription', 'type': 'str'}, - 'device_type': {'key': 'properties.deviceType', 'type': 'str'}, - 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, - 'culture': {'key': 'properties.culture', 'type': 'str'}, - 'device_model': {'key': 'properties.deviceModel', 'type': 'str'}, - 'device_software_version': {'key': 'properties.deviceSoftwareVersion', 'type': 'str'}, - 'device_local_capacity': {'key': 'properties.deviceLocalCapacity', 'type': 'long'}, - 'time_zone': {'key': 'properties.timeZone', 'type': 'str'}, - 'device_hcs_version': {'key': 'properties.deviceHcsVersion', 'type': 'str'}, - 'configured_role_types': {'key': 'properties.configuredRoleTypes', 'type': '[str]'}, - 'node_count': {'key': 'properties.nodeCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeDevice, self).__init__(**kwargs) - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.etag = kwargs.get('etag', None) - self.data_box_edge_device_status = kwargs.get('data_box_edge_device_status', None) - self.serial_number = None - self.description = kwargs.get('description', None) - self.model_description = kwargs.get('model_description', None) - self.device_type = None - self.friendly_name = kwargs.get('friendly_name', None) - self.culture = None - self.device_model = None - self.device_software_version = None - self.device_local_capacity = None - self.time_zone = None - self.device_hcs_version = None - self.configured_role_types = None - self.node_count = None - - -class DataBoxEdgeDeviceExtendedInfo(ARMBaseModel): - """The extended Info of the Data Box Edge/Gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param encryption_key_thumbprint: The digital signature of encrypted certificate. - :type encryption_key_thumbprint: str - :param encryption_key: The public part of the encryption certificate. Client uses this to - encrypt any secret. - :type encryption_key: str - :ivar resource_key: The Resource ID of the Resource. - :vartype resource_key: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'resource_key': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'encryption_key_thumbprint': {'key': 'properties.encryptionKeyThumbprint', 'type': 'str'}, - 'encryption_key': {'key': 'properties.encryptionKey', 'type': 'str'}, - 'resource_key': {'key': 'properties.resourceKey', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeDeviceExtendedInfo, self).__init__(**kwargs) - self.encryption_key_thumbprint = kwargs.get('encryption_key_thumbprint', None) - self.encryption_key = kwargs.get('encryption_key', None) - self.resource_key = None - - -class DataBoxEdgeDeviceList(msrest.serialization.Model): - """The collection of Data Box Edge/Gateway devices. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of Data Box Edge/Gateway devices. - :vartype value: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataBoxEdgeDevice] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DataBoxEdgeDevice]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeDeviceList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class DataBoxEdgeDevicePatch(msrest.serialization.Model): - """The Data Box Edge/Gateway device patch. - - :param tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeDevicePatch, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class DataBoxEdgeSku(msrest.serialization.Model): - """The Sku information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar resource_type: The type of the resource. - :vartype resource_type: str - :ivar name: The Sku name. Possible values include: "Gateway", "Edge", "TEA_1Node", - "TEA_1Node_UPS", "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", - "TEA_4Node_UPS_Heater", "TMA", "TDC", "TCA_Large", "TCA_Small", "GPU". - :vartype name: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.SkuName - :ivar kind: The Sku kind. - :vartype kind: str - :ivar tier: The Sku tier. Possible values include: "Standard". - :vartype tier: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.SkuTier - :ivar size: The Sku kind. - :vartype size: str - :ivar family: The Sku family. - :vartype family: str - :ivar locations: Availability of the Sku for the region. - :vartype locations: list[str] - :ivar api_versions: The API versions in which Sku is available. - :vartype api_versions: list[str] - :ivar location_info: Availability of the Sku for the location/zone/site. - :vartype location_info: - list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.SkuLocationInfo] - :ivar costs: The pricing info of the Sku. - :vartype costs: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.SkuCost] - :ivar restrictions: Restriction info of the SKU. - :vartype restrictions: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.SkuRestriction] - :ivar signup_option: Can the SKU be signed up.. Possible values include: "None", "Available". - :vartype signup_option: str or - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.SkuSignupOption - :ivar version: Sku version. Possible values include: "Stable", "Preview". - :vartype version: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.SkuVersion - :ivar availability: Is SKU available. Possible values include: "Available", "Unavailable". - :vartype availability: str or - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.SkuAvailability - """ - - _validation = { - 'resource_type': {'readonly': True}, - 'name': {'readonly': True}, - 'kind': {'readonly': True}, - 'tier': {'readonly': True}, - 'size': {'readonly': True}, - 'family': {'readonly': True}, - 'locations': {'readonly': True}, - 'api_versions': {'readonly': True}, - 'location_info': {'readonly': True}, - 'costs': {'readonly': True}, - 'restrictions': {'readonly': True}, - 'signup_option': {'readonly': True}, - 'version': {'readonly': True}, - 'availability': {'readonly': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'str'}, - 'family': {'key': 'family', 'type': 'str'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'api_versions': {'key': 'apiVersions', 'type': '[str]'}, - 'location_info': {'key': 'locationInfo', 'type': '[SkuLocationInfo]'}, - 'costs': {'key': 'costs', 'type': '[SkuCost]'}, - 'restrictions': {'key': 'restrictions', 'type': '[SkuRestriction]'}, - 'signup_option': {'key': 'signupOption', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'availability': {'key': 'availability', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeSku, self).__init__(**kwargs) - self.resource_type = None - self.name = None - self.kind = None - self.tier = None - self.size = None - self.family = None - self.locations = None - self.api_versions = None - self.location_info = None - self.costs = None - self.restrictions = None - self.signup_option = None - self.version = None - self.availability = None - - -class DataBoxEdgeSkuList(msrest.serialization.Model): - """List of SKU Information objects. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of ResourceType Sku. - :vartype value: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataBoxEdgeSku] - :ivar next_link: Links to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DataBoxEdgeSku]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeSkuList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class Trigger(ARMBaseModel): - """Trigger details. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: FileEventTrigger, PeriodicTimerEventTrigger. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: - "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.TriggerEventType - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - } - - _subtype_map = { - 'kind': {'FileEvent': 'FileEventTrigger', 'PeriodicTimerEvent': 'PeriodicTimerEventTrigger'} - } - - def __init__( - self, - **kwargs - ): - super(Trigger, self).__init__(**kwargs) - self.kind = 'Trigger' # type: str - - -class FileEventTrigger(Trigger): - """Trigger details. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: - "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.TriggerEventType - :param source_info: Required. File event source details. - :type source_info: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.FileSourceInfo - :param sink_info: Required. Role sink info. - :type sink_info: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against - its usage. For example, if a periodic timer trigger is intended for certain specific IoT - modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'source_info': {'required': True}, - 'sink_info': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'source_info': {'key': 'properties.sourceInfo', 'type': 'FileSourceInfo'}, - 'sink_info': {'key': 'properties.sinkInfo', 'type': 'RoleSinkInfo'}, - 'custom_context_tag': {'key': 'properties.customContextTag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FileEventTrigger, self).__init__(**kwargs) - self.kind = 'FileEvent' # type: str - self.source_info = kwargs['source_info'] - self.sink_info = kwargs['sink_info'] - self.custom_context_tag = kwargs.get('custom_context_tag', None) - - -class FileSourceInfo(msrest.serialization.Model): - """File source details. - - All required parameters must be populated in order to send to Azure. - - :param share_id: Required. File share ID. - :type share_id: str - """ - - _validation = { - 'share_id': {'required': True}, - } - - _attribute_map = { - 'share_id': {'key': 'shareId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FileSourceInfo, self).__init__(**kwargs) - self.share_id = kwargs['share_id'] - - -class ImageRepositoryCredential(msrest.serialization.Model): - """Image repository credential. - - All required parameters must be populated in order to send to Azure. - - :param image_repository_url: Required. Image repository url (e.g.: mcr.microsoft.com). - :type image_repository_url: str - :param user_name: Required. Repository user name. - :type user_name: str - :param password: Repository user password. - :type password: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AsymmetricEncryptedSecret - """ - - _validation = { - 'image_repository_url': {'required': True}, - 'user_name': {'required': True}, - } - - _attribute_map = { - 'image_repository_url': {'key': 'imageRepositoryUrl', 'type': 'str'}, - 'user_name': {'key': 'userName', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'AsymmetricEncryptedSecret'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageRepositoryCredential, self).__init__(**kwargs) - self.image_repository_url = kwargs['image_repository_url'] - self.user_name = kwargs['user_name'] - self.password = kwargs.get('password', None) - - -class IoTDeviceInfo(msrest.serialization.Model): - """Metadata of IoT device/IoT Edge device to be configured. - - All required parameters must be populated in order to send to Azure. - - :param device_id: Required. ID of the IoT device/edge device. - :type device_id: str - :param io_t_host_hub: Required. Host name for the IoT hub associated to the device. - :type io_t_host_hub: str - :param io_t_host_hub_id: Id for the IoT hub associated to the device. - :type io_t_host_hub_id: str - :param authentication: Encrypted IoT device/IoT edge device connection string. - :type authentication: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.Authentication - """ - - _validation = { - 'device_id': {'required': True}, - 'io_t_host_hub': {'required': True}, - } - - _attribute_map = { - 'device_id': {'key': 'deviceId', 'type': 'str'}, - 'io_t_host_hub': {'key': 'ioTHostHub', 'type': 'str'}, - 'io_t_host_hub_id': {'key': 'ioTHostHubId', 'type': 'str'}, - 'authentication': {'key': 'authentication', 'type': 'Authentication'}, - } - - def __init__( - self, - **kwargs - ): - super(IoTDeviceInfo, self).__init__(**kwargs) - self.device_id = kwargs['device_id'] - self.io_t_host_hub = kwargs['io_t_host_hub'] - self.io_t_host_hub_id = kwargs.get('io_t_host_hub_id', None) - self.authentication = kwargs.get('authentication', None) - - -class IoTEdgeAgentInfo(msrest.serialization.Model): - """IoT edge agent details is optional, this will be used for download system Agent module while bootstrapping IoT Role if specified. - - All required parameters must be populated in order to send to Azure. - - :param image_name: Required. Name of the IoT edge agent image. - :type image_name: str - :param tag: Required. Image Tag. - :type tag: str - :param image_repository: Image repository details. - :type image_repository: - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.ImageRepositoryCredential - """ - - _validation = { - 'image_name': {'required': True}, - 'tag': {'required': True}, - } - - _attribute_map = { - 'image_name': {'key': 'imageName', 'type': 'str'}, - 'tag': {'key': 'tag', 'type': 'str'}, - 'image_repository': {'key': 'imageRepository', 'type': 'ImageRepositoryCredential'}, - } - - def __init__( - self, - **kwargs - ): - super(IoTEdgeAgentInfo, self).__init__(**kwargs) - self.image_name = kwargs['image_name'] - self.tag = kwargs['tag'] - self.image_repository = kwargs.get('image_repository', None) - - -class Role(ARMBaseModel): - """Compute role. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: IoTRole. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", - "ASA", "Functions", "Cognitive". - :type kind: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.RoleTypes - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - } - - _subtype_map = { - 'kind': {'IOT': 'IoTRole'} - } - - def __init__( - self, - **kwargs - ): - super(Role, self).__init__(**kwargs) - self.kind = 'Role' # type: str - - -class IoTRole(Role): - """Compute role. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", - "ASA", "Functions", "Cognitive". - :type kind: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.RoleTypes - :param host_platform: Host OS supported by the IoT role. Possible values include: "Windows", - "Linux". - :type host_platform: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.PlatformType - :param io_t_device_details: IoT device metadata to which data box edge device needs to be - connected. - :type io_t_device_details: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.IoTDeviceInfo - :param io_t_edge_device_details: IoT edge device to which the IoT role needs to be configured. - :type io_t_edge_device_details: - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.IoTDeviceInfo - :param share_mappings: Mount points of shares in role(s). - :type share_mappings: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.MountPointMap] - :param io_t_edge_agent_info: Iot edge agent details to download the agent and bootstrap iot - runtime. - :type io_t_edge_agent_info: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.IoTEdgeAgentInfo - :ivar host_platform_type: Platform where the Iot runtime is hosted. Possible values include: - "KubernetesCluster", "LinuxVM". - :vartype host_platform_type: str or - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.HostPlatformType - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.RoleStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'host_platform_type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'host_platform': {'key': 'properties.hostPlatform', 'type': 'str'}, - 'io_t_device_details': {'key': 'properties.ioTDeviceDetails', 'type': 'IoTDeviceInfo'}, - 'io_t_edge_device_details': {'key': 'properties.ioTEdgeDeviceDetails', 'type': 'IoTDeviceInfo'}, - 'share_mappings': {'key': 'properties.shareMappings', 'type': '[MountPointMap]'}, - 'io_t_edge_agent_info': {'key': 'properties.ioTEdgeAgentInfo', 'type': 'IoTEdgeAgentInfo'}, - 'host_platform_type': {'key': 'properties.hostPlatformType', 'type': 'str'}, - 'role_status': {'key': 'properties.roleStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IoTRole, self).__init__(**kwargs) - self.kind = 'IOT' # type: str - self.host_platform = kwargs.get('host_platform', None) - self.io_t_device_details = kwargs.get('io_t_device_details', None) - self.io_t_edge_device_details = kwargs.get('io_t_edge_device_details', None) - self.share_mappings = kwargs.get('share_mappings', None) - self.io_t_edge_agent_info = kwargs.get('io_t_edge_agent_info', None) - self.host_platform_type = None - self.role_status = kwargs.get('role_status', None) - - -class Ipv4Config(msrest.serialization.Model): - """Details related to the IPv4 address configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar ip_address: The IPv4 address of the network adapter. - :vartype ip_address: str - :ivar subnet: The IPv4 subnet of the network adapter. - :vartype subnet: str - :ivar gateway: The IPv4 gateway of the network adapter. - :vartype gateway: str - """ - - _validation = { - 'ip_address': {'readonly': True}, - 'subnet': {'readonly': True}, - 'gateway': {'readonly': True}, - } - - _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'subnet': {'key': 'subnet', 'type': 'str'}, - 'gateway': {'key': 'gateway', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Ipv4Config, self).__init__(**kwargs) - self.ip_address = None - self.subnet = None - self.gateway = None - - -class Ipv6Config(msrest.serialization.Model): - """Details related to the IPv6 address configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar ip_address: The IPv6 address of the network adapter. - :vartype ip_address: str - :ivar prefix_length: The IPv6 prefix of the network adapter. - :vartype prefix_length: int - :ivar gateway: The IPv6 gateway of the network adapter. - :vartype gateway: str - """ - - _validation = { - 'ip_address': {'readonly': True}, - 'prefix_length': {'readonly': True}, - 'gateway': {'readonly': True}, - } - - _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'prefix_length': {'key': 'prefixLength', 'type': 'int'}, - 'gateway': {'key': 'gateway', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Ipv6Config, self).__init__(**kwargs) - self.ip_address = None - self.prefix_length = None - self.gateway = None - - -class Job(msrest.serialization.Model): - """A device job. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The name of the object. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar status: The current status of the job. Possible values include: "Invalid", "Running", - "Succeeded", "Failed", "Canceled", "Paused", "Scheduled". - :vartype status: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.JobStatus - :ivar start_time: The UTC date and time at which the job started. - :vartype start_time: ~datetime.datetime - :ivar end_time: The UTC date and time at which the job completed. - :vartype end_time: ~datetime.datetime - :ivar percent_complete: The percentage of the job that is complete. - :vartype percent_complete: int - :ivar error: The error details. - :vartype error: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.JobErrorDetails - :ivar job_type: The type of the job. Possible values include: "Invalid", "ScanForUpdates", - "DownloadUpdates", "InstallUpdates", "RefreshShare", "RefreshContainer". - :vartype job_type: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.JobType - :ivar current_stage: Current stage of the update operation. Possible values include: "Unknown", - "Initial", "ScanStarted", "ScanComplete", "ScanFailed", "DownloadStarted", "DownloadComplete", - "DownloadFailed", "InstallStarted", "InstallComplete", "InstallFailed", "RebootInitiated", - "Success", "Failure", "RescanStarted", "RescanComplete", "RescanFailed". - :vartype current_stage: str or - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.UpdateOperationStage - :ivar download_progress: The download progress. - :vartype download_progress: - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.UpdateDownloadProgress - :ivar install_progress: The install progress. - :vartype install_progress: - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.UpdateInstallProgress - :ivar total_refresh_errors: Total number of errors encountered during the refresh process. - :vartype total_refresh_errors: int - :ivar error_manifest_file: Local share/remote container relative path to the error manifest - file of the refresh. - :vartype error_manifest_file: str - :ivar refreshed_entity_id: ARM ID of the entity that was refreshed. - :vartype refreshed_entity_id: str - :param folder: If only subfolders need to be refreshed, then the subfolder path inside the - share or container. (The path is empty if there are no subfolders.). - :type folder: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'status': {'readonly': True}, - 'start_time': {'readonly': True}, - 'end_time': {'readonly': True}, - 'percent_complete': {'readonly': True}, - 'error': {'readonly': True}, - 'job_type': {'readonly': True}, - 'current_stage': {'readonly': True}, - 'download_progress': {'readonly': True}, - 'install_progress': {'readonly': True}, - 'total_refresh_errors': {'readonly': True}, - 'error_manifest_file': {'readonly': True}, - 'refreshed_entity_id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'percent_complete': {'key': 'percentComplete', 'type': 'int'}, - 'error': {'key': 'error', 'type': 'JobErrorDetails'}, - 'job_type': {'key': 'properties.jobType', 'type': 'str'}, - 'current_stage': {'key': 'properties.currentStage', 'type': 'str'}, - 'download_progress': {'key': 'properties.downloadProgress', 'type': 'UpdateDownloadProgress'}, - 'install_progress': {'key': 'properties.installProgress', 'type': 'UpdateInstallProgress'}, - 'total_refresh_errors': {'key': 'properties.totalRefreshErrors', 'type': 'int'}, - 'error_manifest_file': {'key': 'properties.errorManifestFile', 'type': 'str'}, - 'refreshed_entity_id': {'key': 'properties.refreshedEntityId', 'type': 'str'}, - 'folder': {'key': 'properties.folder', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Job, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.status = None - self.start_time = None - self.end_time = None - self.percent_complete = None - self.error = None - self.job_type = None - self.current_stage = None - self.download_progress = None - self.install_progress = None - self.total_refresh_errors = None - self.error_manifest_file = None - self.refreshed_entity_id = None - self.folder = kwargs.get('folder', None) - - -class JobErrorDetails(msrest.serialization.Model): - """The job error information containing the list of job errors. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error_details: The error details. - :vartype error_details: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.JobErrorItem] - :ivar code: The code intended for programmatic access. - :vartype code: str - :ivar message: The message that describes the error in detail. - :vartype message: str - """ - - _validation = { - 'error_details': {'readonly': True}, - 'code': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'error_details': {'key': 'errorDetails', 'type': '[JobErrorItem]'}, - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(JobErrorDetails, self).__init__(**kwargs) - self.error_details = None - self.code = None - self.message = None - - -class JobErrorItem(msrest.serialization.Model): - """The job error items. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar recommendations: The recommended actions. - :vartype recommendations: list[str] - :ivar code: The code intended for programmatic access. - :vartype code: str - :ivar message: The message that describes the error in detail. - :vartype message: str - """ - - _validation = { - 'recommendations': {'readonly': True}, - 'code': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'recommendations': {'key': 'recommendations', 'type': '[str]'}, - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(JobErrorItem, self).__init__(**kwargs) - self.recommendations = None - self.code = None - self.message = None - - -class MetricDimensionV1(msrest.serialization.Model): - """Metric Dimension v1. - - :param name: Name of the metrics dimension. - :type name: str - :param display_name: Display name of the metrics dimension. - :type display_name: str - :param to_be_exported_for_shoebox: To be exported to shoe box. - :type to_be_exported_for_shoebox: bool - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricDimensionV1, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) - - -class MetricSpecificationV1(msrest.serialization.Model): - """Metric specification version 1. - - :param name: Name of the metric. - :type name: str - :param display_name: Display name of the metric. - :type display_name: str - :param display_description: Description of the metric to be displayed. - :type display_description: str - :param unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", - "Seconds", "Milliseconds", "Bytes", "BytesPerSecond", "CountPerSecond". - :type unit: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.MetricUnit - :param aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", - "None", "Average", "Minimum", "Maximum", "Total", "Count". - :type aggregation_type: str or - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.MetricAggregationType - :param dimensions: Metric dimensions, other than default dimension which is resource. - :type dimensions: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.MetricDimensionV1] - :param fill_gap_with_zero: Set true to fill the gaps with zero. - :type fill_gap_with_zero: bool - :param category: Metric category. Possible values include: "Capacity", "Transaction". - :type category: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.MetricCategory - :param resource_id_dimension_name_override: Resource name override. - :type resource_id_dimension_name_override: str - :param supported_time_grain_types: Support granularity of metrics. - :type supported_time_grain_types: list[str or - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.TimeGrain] - :param supported_aggregation_types: Support metric aggregation type. - :type supported_aggregation_types: list[str or - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.MetricAggregationType] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[MetricDimensionV1]'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'category': {'key': 'category', 'type': 'str'}, - 'resource_id_dimension_name_override': {'key': 'resourceIdDimensionNameOverride', 'type': 'str'}, - 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, - 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricSpecificationV1, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.dimensions = kwargs.get('dimensions', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.category = kwargs.get('category', None) - self.resource_id_dimension_name_override = kwargs.get('resource_id_dimension_name_override', None) - self.supported_time_grain_types = kwargs.get('supported_time_grain_types', None) - self.supported_aggregation_types = kwargs.get('supported_aggregation_types', None) - - -class MountPointMap(msrest.serialization.Model): - """The share mount point. - - 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 share_id: Required. ID of the share mounted to the role VM. - :type share_id: str - :ivar role_id: ID of the role to which share is mounted. - :vartype role_id: str - :ivar mount_point: Mount point for the share. - :vartype mount_point: str - :ivar mount_type: Mounting type. Possible values include: "Volume", "HostPath". - :vartype mount_type: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.MountType - :ivar role_type: Role type. Possible values include: "IOT", "ASA", "Functions", "Cognitive". - :vartype role_type: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.RoleTypes - """ - - _validation = { - 'share_id': {'required': True}, - 'role_id': {'readonly': True}, - 'mount_point': {'readonly': True}, - 'mount_type': {'readonly': True}, - 'role_type': {'readonly': True}, - } - - _attribute_map = { - 'share_id': {'key': 'shareId', 'type': 'str'}, - 'role_id': {'key': 'roleId', 'type': 'str'}, - 'mount_point': {'key': 'mountPoint', 'type': 'str'}, - 'mount_type': {'key': 'mountType', 'type': 'str'}, - 'role_type': {'key': 'roleType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MountPointMap, self).__init__(**kwargs) - self.share_id = kwargs['share_id'] - self.role_id = None - self.mount_point = None - self.mount_type = None - self.role_type = None - - -class NetworkAdapter(msrest.serialization.Model): - """Represents the networkAdapter on a device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar adapter_id: Instance ID of network adapter. - :vartype adapter_id: str - :ivar adapter_position: Hardware position of network adapter. - :vartype adapter_position: - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.NetworkAdapterPosition - :ivar index: Logical index of the adapter. - :vartype index: int - :ivar node_id: Node ID of the network adapter. - :vartype node_id: str - :ivar network_adapter_name: Network adapter name. - :vartype network_adapter_name: str - :ivar label: Hardware label for the adapter. - :vartype label: str - :ivar mac_address: MAC address. - :vartype mac_address: str - :ivar link_speed: Link speed. - :vartype link_speed: long - :ivar status: Value indicating whether this adapter is valid. Possible values include: - "Inactive", "Active". - :vartype status: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.NetworkAdapterStatus - :param rdma_status: Value indicating whether this adapter is RDMA capable. Possible values - include: "Incapable", "Capable". - :type rdma_status: str or - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.NetworkAdapterRDMAStatus - :param dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values - include: "Disabled", "Enabled". - :type dhcp_status: str or - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.NetworkAdapterDHCPStatus - :ivar ipv4_configuration: The IPv4 configuration of the network adapter. - :vartype ipv4_configuration: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.Ipv4Config - :ivar ipv6_configuration: The IPv6 configuration of the network adapter. - :vartype ipv6_configuration: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.Ipv6Config - :ivar ipv6_link_local_address: The IPv6 local address. - :vartype ipv6_link_local_address: str - :ivar dns_servers: The list of DNS Servers of the device. - :vartype dns_servers: list[str] - """ - - _validation = { - 'adapter_id': {'readonly': True}, - 'adapter_position': {'readonly': True}, - 'index': {'readonly': True}, - 'node_id': {'readonly': True}, - 'network_adapter_name': {'readonly': True}, - 'label': {'readonly': True}, - 'mac_address': {'readonly': True}, - 'link_speed': {'readonly': True}, - 'status': {'readonly': True}, - 'ipv4_configuration': {'readonly': True}, - 'ipv6_configuration': {'readonly': True}, - 'ipv6_link_local_address': {'readonly': True}, - 'dns_servers': {'readonly': True}, - } - - _attribute_map = { - 'adapter_id': {'key': 'adapterId', 'type': 'str'}, - 'adapter_position': {'key': 'adapterPosition', 'type': 'NetworkAdapterPosition'}, - 'index': {'key': 'index', 'type': 'int'}, - 'node_id': {'key': 'nodeId', 'type': 'str'}, - 'network_adapter_name': {'key': 'networkAdapterName', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'mac_address': {'key': 'macAddress', 'type': 'str'}, - 'link_speed': {'key': 'linkSpeed', 'type': 'long'}, - 'status': {'key': 'status', 'type': 'str'}, - 'rdma_status': {'key': 'rdmaStatus', 'type': 'str'}, - 'dhcp_status': {'key': 'dhcpStatus', 'type': 'str'}, - 'ipv4_configuration': {'key': 'ipv4Configuration', 'type': 'Ipv4Config'}, - 'ipv6_configuration': {'key': 'ipv6Configuration', 'type': 'Ipv6Config'}, - 'ipv6_link_local_address': {'key': 'ipv6LinkLocalAddress', 'type': 'str'}, - 'dns_servers': {'key': 'dnsServers', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkAdapter, self).__init__(**kwargs) - self.adapter_id = None - self.adapter_position = None - self.index = None - self.node_id = None - self.network_adapter_name = None - self.label = None - self.mac_address = None - self.link_speed = None - self.status = None - self.rdma_status = kwargs.get('rdma_status', None) - self.dhcp_status = kwargs.get('dhcp_status', None) - self.ipv4_configuration = None - self.ipv6_configuration = None - self.ipv6_link_local_address = None - self.dns_servers = None - - -class NetworkAdapterPosition(msrest.serialization.Model): - """The network adapter position. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar network_group: The network group. Possible values include: "None", "NonRDMA", "RDMA". - :vartype network_group: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.NetworkGroup - :ivar port: The port. - :vartype port: int - """ - - _validation = { - 'network_group': {'readonly': True}, - 'port': {'readonly': True}, - } - - _attribute_map = { - 'network_group': {'key': 'networkGroup', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkAdapterPosition, self).__init__(**kwargs) - self.network_group = None - self.port = None - - -class NetworkSettings(ARMBaseModel): - """The network settings of a device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar network_adapters: The network adapter list on the device. - :vartype network_adapters: - list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.NetworkAdapter] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'network_adapters': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'network_adapters': {'key': 'properties.networkAdapters', 'type': '[NetworkAdapter]'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkSettings, self).__init__(**kwargs) - self.network_adapters = None - - -class Node(ARMBaseModel): - """Represents a single node in a Data box Edge/Gateway device -Gateway devices, standalone Edge devices and a single node cluster Edge device will all have 1 node -Multi-node Edge devices will have more than 1 nodes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar node_status: The current status of the individual node. Possible values include: - "Unknown", "Up", "Down", "Rebooting", "ShuttingDown". - :vartype node_status: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.NodeStatus - :ivar node_chassis_serial_number: Serial number of the Chassis. - :vartype node_chassis_serial_number: str - :ivar node_serial_number: Serial number of the individual node. - :vartype node_serial_number: str - :ivar node_display_name: Display Name of the individual node. - :vartype node_display_name: str - :ivar node_friendly_software_version: Friendly software version name that is currently - installed on the node. - :vartype node_friendly_software_version: str - :ivar node_hcs_version: HCS version that is currently installed on the node. - :vartype node_hcs_version: str - :ivar node_instance_id: Guid instance id of the node. - :vartype node_instance_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'node_status': {'readonly': True}, - 'node_chassis_serial_number': {'readonly': True}, - 'node_serial_number': {'readonly': True}, - 'node_display_name': {'readonly': True}, - 'node_friendly_software_version': {'readonly': True}, - 'node_hcs_version': {'readonly': True}, - 'node_instance_id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'node_status': {'key': 'properties.nodeStatus', 'type': 'str'}, - 'node_chassis_serial_number': {'key': 'properties.nodeChassisSerialNumber', 'type': 'str'}, - 'node_serial_number': {'key': 'properties.nodeSerialNumber', 'type': 'str'}, - 'node_display_name': {'key': 'properties.nodeDisplayName', 'type': 'str'}, - 'node_friendly_software_version': {'key': 'properties.nodeFriendlySoftwareVersion', 'type': 'str'}, - 'node_hcs_version': {'key': 'properties.nodeHcsVersion', 'type': 'str'}, - 'node_instance_id': {'key': 'properties.nodeInstanceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Node, self).__init__(**kwargs) - self.node_status = None - self.node_chassis_serial_number = None - self.node_serial_number = None - self.node_display_name = None - self.node_friendly_software_version = None - self.node_hcs_version = None - self.node_instance_id = None - - -class NodeList(msrest.serialization.Model): - """Collection of Nodes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of Nodes. - :vartype value: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.Node] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Node]'}, - } - - def __init__( - self, - **kwargs - ): - super(NodeList, self).__init__(**kwargs) - self.value = None - - -class Operation(msrest.serialization.Model): - """Operations. - - :param name: Name of the operation. - :type name: str - :param display: Properties displayed for the operation. - :type display: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.OperationDisplay - :param origin: Origin of the operation. - :type origin: str - :param service_specification: Service specification. - :type service_specification: - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.ServiceSpecification - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplay(msrest.serialization.Model): - """Operation display properties. - - :param provider: Provider name. - :type provider: str - :param resource: The type of resource in which the operation is performed. - :type resource: str - :param operation: Operation to be performed on the resource. - :type operation: str - :param description: Description of the operation to be performed. - :type description: str - """ - - _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 - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationsList(msrest.serialization.Model): - """The list of operations used for the discovery of available provider operations. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The value. - :type value: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.Operation] - :param next_link: Link to the next set of results. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationsList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class Order(ARMBaseModel): - """The order details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param contact_information: The contact details. - :type contact_information: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.ContactDetails - :param shipping_address: The shipping address. - :type shipping_address: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.Address - :param current_status: Current status of the order. - :type current_status: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.OrderStatus - :ivar order_history: List of status changes in the order. - :vartype order_history: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.OrderStatus] - :ivar serial_number: Serial number of the device. - :vartype serial_number: str - :ivar delivery_tracking_info: Tracking information for the package delivered to the customer - whether it has an original or a replacement device. - :vartype delivery_tracking_info: - list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.TrackingInfo] - :ivar return_tracking_info: Tracking information for the package returned from the customer - whether it has an original or a replacement device. - :vartype return_tracking_info: - list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.TrackingInfo] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'order_history': {'readonly': True}, - 'serial_number': {'readonly': True}, - 'delivery_tracking_info': {'readonly': True}, - 'return_tracking_info': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'contact_information': {'key': 'properties.contactInformation', 'type': 'ContactDetails'}, - 'shipping_address': {'key': 'properties.shippingAddress', 'type': 'Address'}, - 'current_status': {'key': 'properties.currentStatus', 'type': 'OrderStatus'}, - 'order_history': {'key': 'properties.orderHistory', 'type': '[OrderStatus]'}, - 'serial_number': {'key': 'properties.serialNumber', 'type': 'str'}, - 'delivery_tracking_info': {'key': 'properties.deliveryTrackingInfo', 'type': '[TrackingInfo]'}, - 'return_tracking_info': {'key': 'properties.returnTrackingInfo', 'type': '[TrackingInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(Order, self).__init__(**kwargs) - self.contact_information = kwargs.get('contact_information', None) - self.shipping_address = kwargs.get('shipping_address', None) - self.current_status = kwargs.get('current_status', None) - self.order_history = None - self.serial_number = None - self.delivery_tracking_info = None - self.return_tracking_info = None - - -class OrderList(msrest.serialization.Model): - """List of order entities. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of orders. - :vartype value: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.Order] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Order]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OrderList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class OrderStatus(msrest.serialization.Model): - """Represents a single status change. - - 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 status: Required. Status of the order as per the allowed status types. Possible values - include: "Untracked", "AwaitingFulfilment", "AwaitingPreparation", "AwaitingShipment", - "Shipped", "Arriving", "Delivered", "ReplacementRequested", "LostDevice", "Declined", - "ReturnInitiated", "AwaitingReturnShipment", "ShippedBack", "CollectedAtMicrosoft". - :type status: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.OrderState - :ivar update_date_time: Time of status update. - :vartype update_date_time: ~datetime.datetime - :param comments: Comments related to this status change. - :type comments: str - :ivar additional_order_details: Dictionary to hold generic information which is not stored - by the already existing properties. - :vartype additional_order_details: dict[str, str] - """ - - _validation = { - 'status': {'required': True}, - 'update_date_time': {'readonly': True}, - 'additional_order_details': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'update_date_time': {'key': 'updateDateTime', 'type': 'iso-8601'}, - 'comments': {'key': 'comments', 'type': 'str'}, - 'additional_order_details': {'key': 'additionalOrderDetails', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(OrderStatus, self).__init__(**kwargs) - self.status = kwargs['status'] - self.update_date_time = None - self.comments = kwargs.get('comments', None) - self.additional_order_details = None - - -class PeriodicTimerEventTrigger(Trigger): - """Trigger details. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: - "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.TriggerEventType - :param source_info: Required. Periodic timer details. - :type source_info: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.PeriodicTimerSourceInfo - :param sink_info: Required. Role Sink information. - :type sink_info: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against - its usage. For example, if a periodic timer trigger is intended for certain specific IoT - modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'source_info': {'required': True}, - 'sink_info': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'source_info': {'key': 'properties.sourceInfo', 'type': 'PeriodicTimerSourceInfo'}, - 'sink_info': {'key': 'properties.sinkInfo', 'type': 'RoleSinkInfo'}, - 'custom_context_tag': {'key': 'properties.customContextTag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PeriodicTimerEventTrigger, self).__init__(**kwargs) - self.kind = 'PeriodicTimerEvent' # type: str - self.source_info = kwargs['source_info'] - self.sink_info = kwargs['sink_info'] - self.custom_context_tag = kwargs.get('custom_context_tag', None) - - -class PeriodicTimerSourceInfo(msrest.serialization.Model): - """Periodic timer event source. - - All required parameters must be populated in order to send to Azure. - - :param start_time: Required. The time of the day that results in a valid trigger. Schedule is - computed with reference to the time specified upto seconds. If timezone is not specified the - time will considered to be in device timezone. The value will always be returned as UTC time. - :type start_time: ~datetime.datetime - :param schedule: Required. Periodic frequency at which timer event needs to be raised. Supports - daily, hourly, minutes, and seconds. - :type schedule: str - :param topic: Topic where periodic events are published to IoT device. - :type topic: str - """ - - _validation = { - 'start_time': {'required': True}, - 'schedule': {'required': True}, - } - - _attribute_map = { - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'schedule': {'key': 'schedule', 'type': 'str'}, - 'topic': {'key': 'topic', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PeriodicTimerSourceInfo, self).__init__(**kwargs) - self.start_time = kwargs['start_time'] - self.schedule = kwargs['schedule'] - self.topic = kwargs.get('topic', None) - - -class RefreshDetails(msrest.serialization.Model): - """Fields for tracking refresh job on the share or container. - - :param in_progress_refresh_job_id: If a refresh job is currently in progress on this share or - container, this field indicates the ARM resource ID of that job. The field is empty if no job - is in progress. - :type in_progress_refresh_job_id: str - :param last_completed_refresh_job_time_in_utc: Indicates the completed time for the last - refresh job on this particular share or container, if any.This could be a failed job or a - successful job. - :type last_completed_refresh_job_time_in_utc: ~datetime.datetime - :param error_manifest_file: Indicates the relative path of the error xml for the last refresh - job on this particular share or container, if any. This could be a failed job or a successful - job. - :type error_manifest_file: str - :param last_job: Indicates the id of the last refresh job on this particular share or - container,if any. This could be a failed job or a successful job. - :type last_job: str - """ - - _attribute_map = { - 'in_progress_refresh_job_id': {'key': 'inProgressRefreshJobId', 'type': 'str'}, - 'last_completed_refresh_job_time_in_utc': {'key': 'lastCompletedRefreshJobTimeInUTC', 'type': 'iso-8601'}, - 'error_manifest_file': {'key': 'errorManifestFile', 'type': 'str'}, - 'last_job': {'key': 'lastJob', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RefreshDetails, self).__init__(**kwargs) - self.in_progress_refresh_job_id = kwargs.get('in_progress_refresh_job_id', None) - self.last_completed_refresh_job_time_in_utc = kwargs.get('last_completed_refresh_job_time_in_utc', None) - self.error_manifest_file = kwargs.get('error_manifest_file', None) - self.last_job = kwargs.get('last_job', None) - - -class ResourceTypeSku(msrest.serialization.Model): - """SkuInformation object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar resource_type: The type of the resource. - :vartype resource_type: str - :ivar name: The Sku name. Possible values include: "Gateway", "Edge", "TEA_1Node", - "TEA_1Node_UPS", "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", - "TEA_4Node_UPS_Heater", "TMA", "TDC", "TCA_Large", "TCA_Small", "GPU". - :vartype name: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.SkuName - :ivar kind: The Sku kind. - :vartype kind: str - :ivar tier: The Sku tier. Possible values include: "Standard". - :vartype tier: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.SkuTier - :ivar family: The Sku family. - :vartype family: str - :ivar locations: Availability of the SKU for the region. - :vartype locations: list[str] - :ivar api_versions: The API versions in which SKU is available. - :vartype api_versions: list[str] - :ivar location_info: Availability of the SKU for the location/zone. - :vartype location_info: - list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.SkuLocationInfo] - :ivar costs: The pricing info of the Sku. - :vartype costs: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.SkuCost] - :ivar restrictions: Restrictions of the SKU availability. - :vartype restrictions: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.SkuRestriction] - """ - - _validation = { - 'resource_type': {'readonly': True}, - 'name': {'readonly': True}, - 'kind': {'readonly': True}, - 'tier': {'readonly': True}, - 'family': {'readonly': True}, - 'locations': {'readonly': True}, - 'api_versions': {'readonly': True}, - 'location_info': {'readonly': True}, - 'costs': {'readonly': True}, - 'restrictions': {'readonly': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'family': {'key': 'family', 'type': 'str'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'api_versions': {'key': 'apiVersions', 'type': '[str]'}, - 'location_info': {'key': 'locationInfo', 'type': '[SkuLocationInfo]'}, - 'costs': {'key': 'costs', 'type': '[SkuCost]'}, - 'restrictions': {'key': 'restrictions', 'type': '[SkuRestriction]'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceTypeSku, self).__init__(**kwargs) - self.resource_type = None - self.name = None - self.kind = None - self.tier = None - self.family = None - self.locations = None - self.api_versions = None - self.location_info = None - self.costs = None - self.restrictions = None - - -class RoleList(msrest.serialization.Model): - """Collection of all the roles on the Data Box Edge device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The Value. - :vartype value: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.Role] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Role]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RoleList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class RoleSinkInfo(msrest.serialization.Model): - """Compute role against which events will be raised. - - All required parameters must be populated in order to send to Azure. - - :param role_id: Required. Compute role ID. - :type role_id: str - """ - - _validation = { - 'role_id': {'required': True}, - } - - _attribute_map = { - 'role_id': {'key': 'roleId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RoleSinkInfo, self).__init__(**kwargs) - self.role_id = kwargs['role_id'] - - -class SecuritySettings(ARMBaseModel): - """The security settings of a device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param device_admin_password: Required. Device administrator password as an encrypted string - (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual - password should have at least 8 characters that are a combination of uppercase, lowercase, - numeric, and special characters. - :type device_admin_password: - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AsymmetricEncryptedSecret - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'device_admin_password': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'device_admin_password': {'key': 'properties.deviceAdminPassword', 'type': 'AsymmetricEncryptedSecret'}, - } - - def __init__( - self, - **kwargs - ): - super(SecuritySettings, self).__init__(**kwargs) - self.device_admin_password = kwargs['device_admin_password'] - - -class ServiceSpecification(msrest.serialization.Model): - """Service specification. - - :param metric_specifications: Metric specification as defined by shoebox. - :type metric_specifications: - list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.MetricSpecificationV1] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecificationV1]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class Share(ARMBaseModel): - """Represents a share on the Data Box Edge/Gateway device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param description: Description for the share. - :type description: str - :param share_status: Required. Current status of the share. Possible values include: "Offline", - "Unknown", "OK", "Updating", "NeedsAttention". - :type share_status: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.ShareStatus - :param monitoring_status: Required. Current monitoring status of the share. Possible values - include: "Enabled", "Disabled". - :type monitoring_status: str or - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.MonitoringStatus - :param azure_container_info: Azure container mapping for the share. - :type azure_container_info: - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AzureContainerInfo - :param access_protocol: Required. Access protocol to be used by the share. Possible values - include: "SMB", "NFS". - :type access_protocol: str or - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.ShareAccessProtocol - :param user_access_rights: Mapping of users and corresponding access rights on the share - (required for SMB protocol). - :type user_access_rights: - list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.UserAccessRight] - :param client_access_rights: List of IP addresses and corresponding access rights on the - share(required for NFS protocol). - :type client_access_rights: - list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.ClientAccessRight] - :param refresh_details: Details of the refresh job on this share. - :type refresh_details: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.RefreshDetails - :ivar share_mappings: Share mount point to the role. - :vartype share_mappings: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.MountPointMap] - :param data_policy: Data policy of the share. Possible values include: "Cloud", "Local". - :type data_policy: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataPolicy - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'share_status': {'required': True}, - 'monitoring_status': {'required': True}, - 'access_protocol': {'required': True}, - 'share_mappings': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'share_status': {'key': 'properties.shareStatus', 'type': 'str'}, - 'monitoring_status': {'key': 'properties.monitoringStatus', 'type': 'str'}, - 'azure_container_info': {'key': 'properties.azureContainerInfo', 'type': 'AzureContainerInfo'}, - 'access_protocol': {'key': 'properties.accessProtocol', 'type': 'str'}, - 'user_access_rights': {'key': 'properties.userAccessRights', 'type': '[UserAccessRight]'}, - 'client_access_rights': {'key': 'properties.clientAccessRights', 'type': '[ClientAccessRight]'}, - 'refresh_details': {'key': 'properties.refreshDetails', 'type': 'RefreshDetails'}, - 'share_mappings': {'key': 'properties.shareMappings', 'type': '[MountPointMap]'}, - 'data_policy': {'key': 'properties.dataPolicy', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Share, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.share_status = kwargs['share_status'] - self.monitoring_status = kwargs['monitoring_status'] - self.azure_container_info = kwargs.get('azure_container_info', None) - self.access_protocol = kwargs['access_protocol'] - self.user_access_rights = kwargs.get('user_access_rights', None) - self.client_access_rights = kwargs.get('client_access_rights', None) - self.refresh_details = kwargs.get('refresh_details', None) - self.share_mappings = None - self.data_policy = kwargs.get('data_policy', None) - - -class ShareAccessRight(msrest.serialization.Model): - """Specifies the mapping between this particular user and the type of access he has on shares on this device. - - All required parameters must be populated in order to send to Azure. - - :param share_id: Required. The share ID. - :type share_id: str - :param access_type: Required. Type of access to be allowed on the share for this user. Possible - values include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.ShareAccessType - """ - - _validation = { - 'share_id': {'required': True}, - 'access_type': {'required': True}, - } - - _attribute_map = { - 'share_id': {'key': 'shareId', 'type': 'str'}, - 'access_type': {'key': 'accessType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ShareAccessRight, self).__init__(**kwargs) - self.share_id = kwargs['share_id'] - self.access_type = kwargs['access_type'] - - -class ShareList(msrest.serialization.Model): - """Collection of all the shares on the Data Box Edge/Gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of shares. - :vartype value: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.Share] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Share]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ShareList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class Sku(msrest.serialization.Model): - """The SKU type. - - :param name: SKU name. Possible values include: "Gateway", "Edge", "TEA_1Node", - "TEA_1Node_UPS", "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", - "TEA_4Node_UPS_Heater", "TMA", "TDC", "TCA_Large", "TCA_Small", "GPU". - :type name: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.SkuName - :param tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard". - :type tier: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.SkuTier - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = kwargs.get('tier', None) - - -class SKUCapability(msrest.serialization.Model): - """The capabilities of the SKU. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The capability name. - :vartype name: str - :ivar value: The capability value. - :vartype value: str - """ - - _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SKUCapability, self).__init__(**kwargs) - self.name = None - self.value = None - - -class SkuCost(msrest.serialization.Model): - """The metadata for retrieving price info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar meter_id: Used for querying price from commerce. - :vartype meter_id: str - :ivar quantity: The cost quantity. - :vartype quantity: long - :ivar extended_unit: The extended unit. - :vartype extended_unit: str - """ - - _validation = { - 'meter_id': {'readonly': True}, - 'quantity': {'readonly': True}, - 'extended_unit': {'readonly': True}, - } - - _attribute_map = { - 'meter_id': {'key': 'meterId', 'type': 'str'}, - 'quantity': {'key': 'quantity', 'type': 'long'}, - 'extended_unit': {'key': 'extendedUnit', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuCost, self).__init__(**kwargs) - self.meter_id = None - self.quantity = None - self.extended_unit = None - - -class SkuInformation(msrest.serialization.Model): - """Sku information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar resource_type: The resource type. - :vartype resource_type: str - :ivar name: The sku name. - :vartype name: str - :ivar tier: The sku tier. - :vartype tier: str - :ivar kind: The sku kind. - :vartype kind: str - :ivar size: The sku size. - :vartype size: str - :ivar family: The sku family. - :vartype family: str - :ivar locations: The locations where Sku is available. - :vartype locations: list[str] - :ivar location_info: The locations where Sku is available with zones and sites info. - :vartype location_info: - list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.SkuLocationInfo] - :ivar required_quota_ids: The required quotaIds for the sku to be available. - :vartype required_quota_ids: list[str] - :ivar required_features: The required features for the sku to be available. - :vartype required_features: list[str] - :ivar costs: The cost of the SKU. - :vartype costs: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.SkuCost] - :ivar capabilities: The capabilities of the SKU. - :vartype capabilities: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.SKUCapability] - """ - - _validation = { - 'resource_type': {'readonly': True}, - 'name': {'readonly': True}, - 'tier': {'readonly': True}, - 'kind': {'readonly': True}, - 'size': {'readonly': True}, - 'family': {'readonly': True}, - 'locations': {'readonly': True}, - 'location_info': {'readonly': True}, - 'required_quota_ids': {'readonly': True}, - 'required_features': {'readonly': True}, - 'costs': {'readonly': True}, - 'capabilities': {'readonly': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'str'}, - 'family': {'key': 'family', 'type': 'str'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'location_info': {'key': 'locationInfo', 'type': '[SkuLocationInfo]'}, - 'required_quota_ids': {'key': 'requiredQuotaIds', 'type': '[str]'}, - 'required_features': {'key': 'requiredFeatures', 'type': '[str]'}, - 'costs': {'key': 'costs', 'type': '[SkuCost]'}, - 'capabilities': {'key': 'capabilities', 'type': '[SKUCapability]'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuInformation, self).__init__(**kwargs) - self.resource_type = None - self.name = None - self.tier = None - self.kind = None - self.size = None - self.family = None - self.locations = None - self.location_info = None - self.required_quota_ids = None - self.required_features = None - self.costs = None - self.capabilities = None - - -class SkuInformationList(msrest.serialization.Model): - """List of SKU Information objects. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of ResourceType Sku. - :vartype value: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.ResourceTypeSku] - :ivar next_link: Links to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceTypeSku]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuInformationList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SkuLocationInfo(msrest.serialization.Model): - """The location info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar location: The location. - :vartype location: str - :ivar zones: The zones. - :vartype zones: list[str] - :ivar sites: The sites. - :vartype sites: list[str] - """ - - _validation = { - 'location': {'readonly': True}, - 'zones': {'readonly': True}, - 'sites': {'readonly': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'sites': {'key': 'sites', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuLocationInfo, self).__init__(**kwargs) - self.location = None - self.zones = None - self.sites = None - - -class SkuRestriction(msrest.serialization.Model): - """The restrictions because of which SKU cannot be used. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The type of the restriction. - :vartype type: str - :ivar values: The locations where sku is restricted. - :vartype values: list[str] - :ivar reason_code: The SKU restriction reason. Possible values include: - "NotAvailableForSubscription", "QuotaId". - :vartype reason_code: str or - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.SkuRestrictionReasonCode - :ivar restriction_info: Restriction of the SKU for the location/zone. - :vartype restriction_info: - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.SkuRestrictionInfo - """ - - _validation = { - 'type': {'readonly': True}, - 'values': {'readonly': True}, - 'reason_code': {'readonly': True}, - 'restriction_info': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[str]'}, - 'reason_code': {'key': 'reasonCode', 'type': 'str'}, - 'restriction_info': {'key': 'restrictionInfo', 'type': 'SkuRestrictionInfo'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuRestriction, self).__init__(**kwargs) - self.type = None - self.values = None - self.reason_code = None - self.restriction_info = None - - -class SkuRestrictionInfo(msrest.serialization.Model): - """The restriction info with locations and zones. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar locations: The locations. - :vartype locations: list[str] - :ivar zones: The zones. - :vartype zones: list[str] - """ - - _validation = { - 'locations': {'readonly': True}, - 'zones': {'readonly': True}, - } - - _attribute_map = { - 'locations': {'key': 'locations', 'type': '[str]'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuRestrictionInfo, self).__init__(**kwargs) - self.locations = None - self.zones = None - - -class StorageAccount(ARMBaseModel): - """Represents a Storage Account on the Data Box Edge/Gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param description: Description for the storage Account. - :type description: str - :param storage_account_status: Current status of the storage account. Possible values include: - "OK", "Offline", "Unknown", "Updating", "NeedsAttention". - :type storage_account_status: str or - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.StorageAccountStatus - :param data_policy: Data policy of the storage Account. Possible values include: "Cloud", - "Local". - :type data_policy: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataPolicy - :param storage_account_credential_id: Storage Account Credential Id. - :type storage_account_credential_id: str - :ivar blob_endpoint: BlobEndpoint of Storage Account. - :vartype blob_endpoint: str - :ivar container_count: The Container Count. Present only for Storage Accounts with DataPolicy - set to Cloud. - :vartype container_count: int - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'blob_endpoint': {'readonly': True}, - 'container_count': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'storage_account_status': {'key': 'properties.storageAccountStatus', 'type': 'str'}, - 'data_policy': {'key': 'properties.dataPolicy', 'type': 'str'}, - 'storage_account_credential_id': {'key': 'properties.storageAccountCredentialId', 'type': 'str'}, - 'blob_endpoint': {'key': 'properties.blobEndpoint', 'type': 'str'}, - 'container_count': {'key': 'properties.containerCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccount, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.storage_account_status = kwargs.get('storage_account_status', None) - self.data_policy = kwargs.get('data_policy', None) - self.storage_account_credential_id = kwargs.get('storage_account_credential_id', None) - self.blob_endpoint = None - self.container_count = None - - -class StorageAccountCredential(ARMBaseModel): - """The storage account credential. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param alias: Required. Alias for the storage account. - :type alias: str - :param user_name: Username for the storage account. - :type user_name: str - :param account_key: Encrypted storage key. - :type account_key: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AsymmetricEncryptedSecret - :param connection_string: Connection string for the storage account. Use this string if - username and account key are not specified. - :type connection_string: str - :param ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible values - include: "Enabled", "Disabled". - :type ssl_status: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.SSLStatus - :param blob_domain_name: Blob end point for private clouds. - :type blob_domain_name: str - :param account_type: Required. Type of storage accessed on the storage account. Possible values - include: "GeneralPurposeStorage", "BlobStorage". - :type account_type: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AccountType - :param storage_account_id: Id of the storage account. - :type storage_account_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'alias': {'required': True}, - 'ssl_status': {'required': True}, - 'account_type': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'alias': {'key': 'properties.alias', 'type': 'str'}, - 'user_name': {'key': 'properties.userName', 'type': 'str'}, - 'account_key': {'key': 'properties.accountKey', 'type': 'AsymmetricEncryptedSecret'}, - 'connection_string': {'key': 'properties.connectionString', 'type': 'str'}, - 'ssl_status': {'key': 'properties.sslStatus', 'type': 'str'}, - 'blob_domain_name': {'key': 'properties.blobDomainName', 'type': 'str'}, - 'account_type': {'key': 'properties.accountType', 'type': 'str'}, - 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCredential, self).__init__(**kwargs) - self.alias = kwargs['alias'] - self.user_name = kwargs.get('user_name', None) - self.account_key = kwargs.get('account_key', None) - self.connection_string = kwargs.get('connection_string', None) - self.ssl_status = kwargs['ssl_status'] - self.blob_domain_name = kwargs.get('blob_domain_name', None) - self.account_type = kwargs['account_type'] - self.storage_account_id = kwargs.get('storage_account_id', None) - - -class StorageAccountCredentialList(msrest.serialization.Model): - """The collection of storage account credentials. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The value. - :vartype value: - list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.StorageAccountCredential] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccountCredential]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCredentialList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class StorageAccountList(msrest.serialization.Model): - """Collection of all the Storage Accounts on the Data Box Edge/Gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of storageAccounts. - :vartype value: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.StorageAccount] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccount]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SymmetricKey(msrest.serialization.Model): - """Symmetric key for authentication. - - :param connection_string: Connection string based on the symmetric key. - :type connection_string: - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AsymmetricEncryptedSecret - """ - - _attribute_map = { - 'connection_string': {'key': 'connectionString', 'type': 'AsymmetricEncryptedSecret'}, - } - - def __init__( - self, - **kwargs - ): - super(SymmetricKey, self).__init__(**kwargs) - self.connection_string = kwargs.get('connection_string', None) - - -class TrackingInfo(msrest.serialization.Model): - """Tracking courier information. - - :param serial_number: Serial number of the device being tracked. - :type serial_number: str - :param carrier_name: Name of the carrier used in the delivery. - :type carrier_name: str - :param tracking_id: Tracking ID of the shipment. - :type tracking_id: str - :param tracking_url: Tracking URL of the shipment. - :type tracking_url: str - """ - - _attribute_map = { - 'serial_number': {'key': 'serialNumber', 'type': 'str'}, - 'carrier_name': {'key': 'carrierName', 'type': 'str'}, - 'tracking_id': {'key': 'trackingId', 'type': 'str'}, - 'tracking_url': {'key': 'trackingUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackingInfo, self).__init__(**kwargs) - self.serial_number = kwargs.get('serial_number', None) - self.carrier_name = kwargs.get('carrier_name', None) - self.tracking_id = kwargs.get('tracking_id', None) - self.tracking_url = kwargs.get('tracking_url', None) - - -class TriggerList(msrest.serialization.Model): - """Collection of all trigger on the data box edge device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of triggers. - :vartype value: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.Trigger] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Trigger]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TriggerList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class UpdateDownloadProgress(msrest.serialization.Model): - """Details about the download progress of update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar download_phase: The download phase. Possible values include: "Unknown", "Initializing", - "Downloading", "Verifying". - :vartype download_phase: str or - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.DownloadPhase - :ivar percent_complete: Percentage of completion. - :vartype percent_complete: int - :ivar total_bytes_to_download: Total bytes to download. - :vartype total_bytes_to_download: float - :ivar total_bytes_downloaded: Total bytes downloaded. - :vartype total_bytes_downloaded: float - :ivar number_of_updates_to_download: Number of updates to download. - :vartype number_of_updates_to_download: int - :ivar number_of_updates_downloaded: Number of updates downloaded. - :vartype number_of_updates_downloaded: int - """ - - _validation = { - 'download_phase': {'readonly': True}, - 'percent_complete': {'readonly': True}, - 'total_bytes_to_download': {'readonly': True}, - 'total_bytes_downloaded': {'readonly': True}, - 'number_of_updates_to_download': {'readonly': True}, - 'number_of_updates_downloaded': {'readonly': True}, - } - - _attribute_map = { - 'download_phase': {'key': 'downloadPhase', 'type': 'str'}, - 'percent_complete': {'key': 'percentComplete', 'type': 'int'}, - 'total_bytes_to_download': {'key': 'totalBytesToDownload', 'type': 'float'}, - 'total_bytes_downloaded': {'key': 'totalBytesDownloaded', 'type': 'float'}, - 'number_of_updates_to_download': {'key': 'numberOfUpdatesToDownload', 'type': 'int'}, - 'number_of_updates_downloaded': {'key': 'numberOfUpdatesDownloaded', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateDownloadProgress, self).__init__(**kwargs) - self.download_phase = None - self.percent_complete = None - self.total_bytes_to_download = None - self.total_bytes_downloaded = None - self.number_of_updates_to_download = None - self.number_of_updates_downloaded = None - - -class UpdateInstallProgress(msrest.serialization.Model): - """Progress details during installation of updates. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar percent_complete: Percentage completed. - :vartype percent_complete: int - :ivar number_of_updates_to_install: Number of updates to install. - :vartype number_of_updates_to_install: int - :ivar number_of_updates_installed: Number of updates installed. - :vartype number_of_updates_installed: int - """ - - _validation = { - 'percent_complete': {'readonly': True}, - 'number_of_updates_to_install': {'readonly': True}, - 'number_of_updates_installed': {'readonly': True}, - } - - _attribute_map = { - 'percent_complete': {'key': 'percentComplete', 'type': 'int'}, - 'number_of_updates_to_install': {'key': 'numberOfUpdatesToInstall', 'type': 'int'}, - 'number_of_updates_installed': {'key': 'numberOfUpdatesInstalled', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateInstallProgress, self).__init__(**kwargs) - self.percent_complete = None - self.number_of_updates_to_install = None - self.number_of_updates_installed = None - - -class UpdateSummary(ARMBaseModel): - """Details about ongoing updates and availability of updates on the device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param device_version_number: The current version of the device in format: 1.2.17312.13.",. - :type device_version_number: str - :param friendly_device_version_name: The current version of the device in text format. - :type friendly_device_version_name: str - :param device_last_scanned_date_time: The last time when a scan was done on the device. - :type device_last_scanned_date_time: ~datetime.datetime - :param last_completed_scan_job_date_time: The time when the last scan job was completed - (success/cancelled/failed) on the appliance. - :type last_completed_scan_job_date_time: ~datetime.datetime - :ivar last_completed_download_job_date_time: The time when the last Download job was completed - (success/cancelled/failed) on the appliance. - :vartype last_completed_download_job_date_time: ~datetime.datetime - :ivar last_completed_install_job_date_time: The time when the last Install job was completed - (success/cancelled/failed) on the appliance. - :vartype last_completed_install_job_date_time: ~datetime.datetime - :ivar total_number_of_updates_available: The number of updates available for the current device - version as per the last device scan. - :vartype total_number_of_updates_available: int - :ivar total_number_of_updates_pending_download: The total number of items pending download. - :vartype total_number_of_updates_pending_download: int - :ivar total_number_of_updates_pending_install: The total number of items pending install. - :vartype total_number_of_updates_pending_install: int - :ivar reboot_behavior: Indicates if updates are available and at least one of the updates needs - a reboot. Possible values include: "NeverReboots", "RequiresReboot", "RequestReboot". - :vartype reboot_behavior: str or - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.InstallRebootBehavior - :ivar ongoing_update_operation: The current update operation. Possible values include: "None", - "Scan", "Download", "Install". - :vartype ongoing_update_operation: str or - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.UpdateOperation - :ivar in_progress_download_job_id: The job ID of the download job in progress. - :vartype in_progress_download_job_id: str - :ivar in_progress_install_job_id: The job ID of the install job in progress. - :vartype in_progress_install_job_id: str - :ivar in_progress_download_job_started_date_time: The time when the currently running download - (if any) started. - :vartype in_progress_download_job_started_date_time: ~datetime.datetime - :ivar in_progress_install_job_started_date_time: The time when the currently running install - (if any) started. - :vartype in_progress_install_job_started_date_time: ~datetime.datetime - :ivar update_titles: The list of updates available for install. - :vartype update_titles: list[str] - :ivar total_update_size_in_bytes: The total size of updates available for download in bytes. - :vartype total_update_size_in_bytes: float - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'last_completed_download_job_date_time': {'readonly': True}, - 'last_completed_install_job_date_time': {'readonly': True}, - 'total_number_of_updates_available': {'readonly': True}, - 'total_number_of_updates_pending_download': {'readonly': True}, - 'total_number_of_updates_pending_install': {'readonly': True}, - 'reboot_behavior': {'readonly': True}, - 'ongoing_update_operation': {'readonly': True}, - 'in_progress_download_job_id': {'readonly': True}, - 'in_progress_install_job_id': {'readonly': True}, - 'in_progress_download_job_started_date_time': {'readonly': True}, - 'in_progress_install_job_started_date_time': {'readonly': True}, - 'update_titles': {'readonly': True}, - 'total_update_size_in_bytes': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'device_version_number': {'key': 'properties.deviceVersionNumber', 'type': 'str'}, - 'friendly_device_version_name': {'key': 'properties.friendlyDeviceVersionName', 'type': 'str'}, - 'device_last_scanned_date_time': {'key': 'properties.deviceLastScannedDateTime', 'type': 'iso-8601'}, - 'last_completed_scan_job_date_time': {'key': 'properties.lastCompletedScanJobDateTime', 'type': 'iso-8601'}, - 'last_completed_download_job_date_time': {'key': 'properties.lastCompletedDownloadJobDateTime', 'type': 'iso-8601'}, - 'last_completed_install_job_date_time': {'key': 'properties.lastCompletedInstallJobDateTime', 'type': 'iso-8601'}, - 'total_number_of_updates_available': {'key': 'properties.totalNumberOfUpdatesAvailable', 'type': 'int'}, - 'total_number_of_updates_pending_download': {'key': 'properties.totalNumberOfUpdatesPendingDownload', 'type': 'int'}, - 'total_number_of_updates_pending_install': {'key': 'properties.totalNumberOfUpdatesPendingInstall', 'type': 'int'}, - 'reboot_behavior': {'key': 'properties.rebootBehavior', 'type': 'str'}, - 'ongoing_update_operation': {'key': 'properties.ongoingUpdateOperation', 'type': 'str'}, - 'in_progress_download_job_id': {'key': 'properties.inProgressDownloadJobId', 'type': 'str'}, - 'in_progress_install_job_id': {'key': 'properties.inProgressInstallJobId', 'type': 'str'}, - 'in_progress_download_job_started_date_time': {'key': 'properties.inProgressDownloadJobStartedDateTime', 'type': 'iso-8601'}, - 'in_progress_install_job_started_date_time': {'key': 'properties.inProgressInstallJobStartedDateTime', 'type': 'iso-8601'}, - 'update_titles': {'key': 'properties.updateTitles', 'type': '[str]'}, - 'total_update_size_in_bytes': {'key': 'properties.totalUpdateSizeInBytes', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateSummary, self).__init__(**kwargs) - self.device_version_number = kwargs.get('device_version_number', None) - self.friendly_device_version_name = kwargs.get('friendly_device_version_name', None) - self.device_last_scanned_date_time = kwargs.get('device_last_scanned_date_time', None) - self.last_completed_scan_job_date_time = kwargs.get('last_completed_scan_job_date_time', None) - self.last_completed_download_job_date_time = None - self.last_completed_install_job_date_time = None - self.total_number_of_updates_available = None - self.total_number_of_updates_pending_download = None - self.total_number_of_updates_pending_install = None - self.reboot_behavior = None - self.ongoing_update_operation = None - self.in_progress_download_job_id = None - self.in_progress_install_job_id = None - self.in_progress_download_job_started_date_time = None - self.in_progress_install_job_started_date_time = None - self.update_titles = None - self.total_update_size_in_bytes = None - - -class UploadCertificateRequest(msrest.serialization.Model): - """The upload certificate request. - - All required parameters must be populated in order to send to Azure. - - :param authentication_type: The authentication type. Possible values include: "Invalid", - "AzureActiveDirectory". - :type authentication_type: str or - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AuthenticationType - :param certificate: Required. The base64 encoded certificate raw data. - :type certificate: str - """ - - _validation = { - 'certificate': {'required': True}, - } - - _attribute_map = { - 'authentication_type': {'key': 'properties.authenticationType', 'type': 'str'}, - 'certificate': {'key': 'properties.certificate', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UploadCertificateRequest, self).__init__(**kwargs) - self.authentication_type = kwargs.get('authentication_type', None) - self.certificate = kwargs['certificate'] - - -class UploadCertificateResponse(msrest.serialization.Model): - """The upload registration certificate response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param auth_type: Specifies authentication type. Possible values include: "Invalid", - "AzureActiveDirectory". - :type auth_type: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AuthenticationType - :ivar resource_id: The resource ID of the Data Box Edge/Gateway device. - :vartype resource_id: str - :ivar aad_authority: Azure Active Directory tenant authority. - :vartype aad_authority: str - :ivar aad_tenant_id: Azure Active Directory tenant ID. - :vartype aad_tenant_id: str - :ivar service_principal_client_id: Azure Active Directory service principal client ID. - :vartype service_principal_client_id: str - :ivar service_principal_object_id: Azure Active Directory service principal object ID. - :vartype service_principal_object_id: str - :ivar azure_management_endpoint_audience: The azure management endpoint audience. - :vartype azure_management_endpoint_audience: str - :ivar aad_audience: Identifier of the target resource that is the recipient of the requested - token. - :vartype aad_audience: str - """ - - _validation = { - 'resource_id': {'readonly': True}, - 'aad_authority': {'readonly': True}, - 'aad_tenant_id': {'readonly': True}, - 'service_principal_client_id': {'readonly': True}, - 'service_principal_object_id': {'readonly': True}, - 'azure_management_endpoint_audience': {'readonly': True}, - 'aad_audience': {'readonly': True}, - } - - _attribute_map = { - 'auth_type': {'key': 'authType', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'aad_authority': {'key': 'aadAuthority', 'type': 'str'}, - 'aad_tenant_id': {'key': 'aadTenantId', 'type': 'str'}, - 'service_principal_client_id': {'key': 'servicePrincipalClientId', 'type': 'str'}, - 'service_principal_object_id': {'key': 'servicePrincipalObjectId', 'type': 'str'}, - 'azure_management_endpoint_audience': {'key': 'azureManagementEndpointAudience', 'type': 'str'}, - 'aad_audience': {'key': 'aadAudience', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UploadCertificateResponse, self).__init__(**kwargs) - self.auth_type = kwargs.get('auth_type', None) - self.resource_id = None - self.aad_authority = None - self.aad_tenant_id = None - self.service_principal_client_id = None - self.service_principal_object_id = None - self.azure_management_endpoint_audience = None - self.aad_audience = None - - -class User(ARMBaseModel): - """Represents a user who has access to one or more shares on the Data Box Edge/Gateway device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param encrypted_password: The password details. - :type encrypted_password: - ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AsymmetricEncryptedSecret - :ivar share_access_rights: List of shares that the user has rights on. This field should not be - specified during user creation. - :vartype share_access_rights: - list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.ShareAccessRight] - :param user_type: Required. Type of the user. Possible values include: "Share", - "LocalManagement", "ARM". - :type user_type: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.UserType - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'share_access_rights': {'readonly': True}, - 'user_type': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'encrypted_password': {'key': 'properties.encryptedPassword', 'type': 'AsymmetricEncryptedSecret'}, - 'share_access_rights': {'key': 'properties.shareAccessRights', 'type': '[ShareAccessRight]'}, - 'user_type': {'key': 'properties.userType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(User, self).__init__(**kwargs) - self.encrypted_password = kwargs.get('encrypted_password', None) - self.share_access_rights = None - self.user_type = kwargs['user_type'] - - -class UserAccessRight(msrest.serialization.Model): - """The mapping between a particular user and the access type on the SMB share. - - All required parameters must be populated in order to send to Azure. - - :param user_id: Required. User ID (already existing in the device). - :type user_id: str - :param access_type: Required. Type of access to be allowed for the user. Possible values - include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.ShareAccessType - """ - - _validation = { - 'user_id': {'required': True}, - 'access_type': {'required': True}, - } - - _attribute_map = { - 'user_id': {'key': 'userId', 'type': 'str'}, - 'access_type': {'key': 'accessType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserAccessRight, self).__init__(**kwargs) - self.user_id = kwargs['user_id'] - self.access_type = kwargs['access_type'] - - -class UserList(msrest.serialization.Model): - """Collection of users. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of users. - :vartype value: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.User] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[User]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserList, self).__init__(**kwargs) - self.value = None - self.next_link = None diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/models/_models_py3.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/models/_models_py3.py index e32e2df99e08..51037efb33dd 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/models/_models_py3.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/models/_models_py3.py @@ -19,20 +19,20 @@ class Address(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param address_line1: Required. The address line1. - :type address_line1: str - :param address_line2: The address line2. - :type address_line2: str - :param address_line3: The address line3. - :type address_line3: str - :param postal_code: Required. The postal code. - :type postal_code: str - :param city: Required. The city name. - :type city: str - :param state: Required. The state name. - :type state: str - :param country: Required. The country name. - :type country: str + :ivar address_line1: Required. The address line1. + :vartype address_line1: str + :ivar address_line2: The address line2. + :vartype address_line2: str + :ivar address_line3: The address line3. + :vartype address_line3: str + :ivar postal_code: Required. The postal code. + :vartype postal_code: str + :ivar city: Required. The city name. + :vartype city: str + :ivar state: Required. The state name. + :vartype state: str + :ivar country: Required. The country name. + :vartype country: str """ _validation = { @@ -65,6 +65,22 @@ def __init__( address_line3: Optional[str] = None, **kwargs ): + """ + :keyword address_line1: Required. The address line1. + :paramtype address_line1: str + :keyword address_line2: The address line2. + :paramtype address_line2: str + :keyword address_line3: The address line3. + :paramtype address_line3: str + :keyword postal_code: Required. The postal code. + :paramtype postal_code: str + :keyword city: Required. The city name. + :paramtype city: str + :keyword state: Required. The state name. + :paramtype state: str + :keyword country: Required. The country name. + :paramtype country: str + """ super(Address, self).__init__(**kwargs) self.address_line1 = address_line1 self.address_line2 = address_line2 @@ -104,6 +120,8 @@ def __init__( self, **kwargs ): + """ + """ super(ARMBaseModel, self).__init__(**kwargs) self.id = None self.name = None @@ -168,6 +186,8 @@ def __init__( self, **kwargs ): + """ + """ super(Alert, self).__init__(**kwargs) self.title = None self.alert_type = None @@ -207,6 +227,8 @@ def __init__( self, **kwargs ): + """ + """ super(AlertErrorDetails, self).__init__(**kwargs) self.error_code = None self.error_message = None @@ -238,6 +260,8 @@ def __init__( self, **kwargs ): + """ + """ super(AlertList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -248,14 +272,14 @@ class AsymmetricEncryptedSecret(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The value of the secret. - :type value: str - :param encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the + :ivar value: Required. The value of the secret. + :vartype value: str + :ivar encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the value is unencrypted, it will be null. - :type encryption_cert_thumbprint: str - :param encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values + :vartype encryption_cert_thumbprint: str + :ivar encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values include: "None", "AES256", "RSAES_PKCS1_v_1_5". - :type encryption_algorithm: str or + :vartype encryption_algorithm: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.EncryptionAlgorithm """ @@ -278,6 +302,17 @@ def __init__( encryption_cert_thumbprint: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The value of the secret. + :paramtype value: str + :keyword encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the + value is unencrypted, it will be null. + :paramtype encryption_cert_thumbprint: str + :keyword encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values + include: "None", "AES256", "RSAES_PKCS1_v_1_5". + :paramtype encryption_algorithm: str or + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.EncryptionAlgorithm + """ super(AsymmetricEncryptedSecret, self).__init__(**kwargs) self.value = value self.encryption_cert_thumbprint = encryption_cert_thumbprint @@ -287,8 +322,8 @@ def __init__( class Authentication(msrest.serialization.Model): """Authentication mechanism for IoT devices. - :param symmetric_key: Symmetric key for authentication. - :type symmetric_key: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.SymmetricKey + :ivar symmetric_key: Symmetric key for authentication. + :vartype symmetric_key: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.SymmetricKey """ _attribute_map = { @@ -301,6 +336,10 @@ def __init__( symmetric_key: Optional["SymmetricKey"] = None, **kwargs ): + """ + :keyword symmetric_key: Symmetric key for authentication. + :paramtype symmetric_key: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.SymmetricKey + """ super(Authentication, self).__init__(**kwargs) self.symmetric_key = symmetric_key @@ -310,15 +349,15 @@ class AzureContainerInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param storage_account_credential_id: Required. ID of the storage account credential used to + :ivar storage_account_credential_id: Required. ID of the storage account credential used to access storage. - :type storage_account_credential_id: str - :param container_name: Required. Container name (Based on the data format specified, this + :vartype storage_account_credential_id: str + :ivar container_name: Required. Container name (Based on the data format specified, this represents the name of Azure Files/Page blob/Block blob). - :type container_name: str - :param data_format: Required. Storage format used for the file represented by the share. + :vartype container_name: str + :ivar data_format: Required. Storage format used for the file represented by the share. Possible values include: "BlockBlob", "PageBlob", "AzureFile". - :type data_format: str or + :vartype data_format: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AzureContainerDataFormat """ @@ -342,6 +381,18 @@ def __init__( data_format: Union[str, "AzureContainerDataFormat"], **kwargs ): + """ + :keyword storage_account_credential_id: Required. ID of the storage account credential used to + access storage. + :paramtype storage_account_credential_id: str + :keyword container_name: Required. Container name (Based on the data format specified, this + represents the name of Azure Files/Page blob/Block blob). + :paramtype container_name: str + :keyword data_format: Required. Storage format used for the file represented by the share. + Possible values include: "BlockBlob", "PageBlob", "AzureFile". + :paramtype data_format: str or + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AzureContainerDataFormat + """ super(AzureContainerInfo, self).__init__(**kwargs) self.storage_account_credential_id = storage_account_credential_id self.container_name = container_name @@ -361,14 +412,14 @@ class BandwidthSchedule(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param start: Required. The start time of the schedule in UTC. - :type start: str - :param stop: Required. The stop time of the schedule in UTC. - :type stop: str - :param rate_in_mbps: Required. The bandwidth rate in Mbps. - :type rate_in_mbps: int - :param days: Required. The days of the week when this schedule is applicable. - :type days: list[str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.DayOfWeek] + :ivar start: Required. The start time of the schedule in UTC. + :vartype start: str + :ivar stop: Required. The stop time of the schedule in UTC. + :vartype stop: str + :ivar rate_in_mbps: Required. The bandwidth rate in Mbps. + :vartype rate_in_mbps: int + :ivar days: Required. The days of the week when this schedule is applicable. + :vartype days: list[str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.DayOfWeek] """ _validation = { @@ -400,6 +451,16 @@ def __init__( days: List[Union[str, "DayOfWeek"]], **kwargs ): + """ + :keyword start: Required. The start time of the schedule in UTC. + :paramtype start: str + :keyword stop: Required. The stop time of the schedule in UTC. + :paramtype stop: str + :keyword rate_in_mbps: Required. The bandwidth rate in Mbps. + :paramtype rate_in_mbps: int + :keyword days: Required. The days of the week when this schedule is applicable. + :paramtype days: list[str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.DayOfWeek] + """ super(BandwidthSchedule, self).__init__(**kwargs) self.start = start self.stop = stop @@ -432,6 +493,8 @@ def __init__( self, **kwargs ): + """ + """ super(BandwidthSchedulesList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -442,11 +505,11 @@ class ClientAccessRight(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param client: Required. IP of the client. - :type client: str - :param access_permission: Required. Type of access to be allowed for the client. Possible - values include: "NoAccess", "ReadOnly", "ReadWrite". - :type access_permission: str or + :ivar client: Required. IP of the client. + :vartype client: str + :ivar access_permission: Required. Type of access to be allowed for the client. Possible values + include: "NoAccess", "ReadOnly", "ReadWrite". + :vartype access_permission: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.ClientPermissionType """ @@ -467,6 +530,14 @@ def __init__( access_permission: Union[str, "ClientPermissionType"], **kwargs ): + """ + :keyword client: Required. IP of the client. + :paramtype client: str + :keyword access_permission: Required. Type of access to be allowed for the client. Possible + values include: "NoAccess", "ReadOnly", "ReadWrite". + :paramtype access_permission: str or + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.ClientPermissionType + """ super(ClientAccessRight, self).__init__(**kwargs) self.client = client self.access_permission = access_permission @@ -475,14 +546,14 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from the service. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.CloudErrorBody] + :vartype message: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.CloudErrorBody] """ _attribute_map = { @@ -499,6 +570,16 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -510,14 +591,14 @@ class ContactDetails(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param contact_person: Required. The contact person name. - :type contact_person: str - :param company_name: Required. The name of the company. - :type company_name: str - :param phone: Required. The phone number. - :type phone: str - :param email_list: Required. The email list. - :type email_list: list[str] + :ivar contact_person: Required. The contact person name. + :vartype contact_person: str + :ivar company_name: Required. The name of the company. + :vartype company_name: str + :ivar phone: Required. The phone number. + :vartype phone: str + :ivar email_list: Required. The email list. + :vartype email_list: list[str] """ _validation = { @@ -543,6 +624,16 @@ def __init__( email_list: List[str], **kwargs ): + """ + :keyword contact_person: Required. The contact person name. + :paramtype contact_person: str + :keyword company_name: Required. The name of the company. + :paramtype company_name: str + :keyword phone: Required. The phone number. + :paramtype phone: str + :keyword email_list: Required. The email list. + :paramtype email_list: list[str] + """ super(ContactDetails, self).__init__(**kwargs) self.contact_person = contact_person self.company_name = company_name @@ -567,9 +658,9 @@ class Container(ARMBaseModel): "Offline", "Unknown", "Updating", "NeedsAttention". :vartype container_status: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.ContainerStatus - :param data_format: Required. DataFormat for Container. Possible values include: "BlockBlob", + :ivar data_format: Required. DataFormat for Container. Possible values include: "BlockBlob", "PageBlob", "AzureFile". - :type data_format: str or + :vartype data_format: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AzureContainerDataFormat :ivar refresh_details: Details of the refresh job on this container. :vartype refresh_details: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.RefreshDetails @@ -603,6 +694,12 @@ def __init__( data_format: Union[str, "AzureContainerDataFormat"], **kwargs ): + """ + :keyword data_format: Required. DataFormat for Container. Possible values include: "BlockBlob", + "PageBlob", "AzureFile". + :paramtype data_format: str or + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AzureContainerDataFormat + """ super(Container, self).__init__(**kwargs) self.container_status = None self.data_format = data_format @@ -635,6 +732,8 @@ def __init__( self, **kwargs ): + """ + """ super(ContainerList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -653,34 +752,34 @@ class DataBoxEdgeDevice(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param location: Required. The location of the device. This is a supported and registered Azure + :ivar location: Required. The location of the device. This is a supported and registered Azure geographical region (for example, West US, East US, or Southeast Asia). The geographical region of a device cannot be changed once it is created, but if an identical geographical region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. The list of tags that describe the device. These tags can be used - to view and group this device (across resource groups). - :type tags: dict[str, str] - :param sku: The SKU type. - :type sku: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.Sku - :param etag: The etag for the devices. - :type etag: str - :param data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible + :vartype location: str + :ivar tags: A set of tags. The list of tags that describe the device. These tags can be used to + view and group this device (across resource groups). + :vartype tags: dict[str, str] + :ivar sku: The SKU type. + :vartype sku: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.Sku + :ivar etag: The etag for the devices. + :vartype etag: str + :ivar data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible values include: "ReadyToSetup", "Online", "Offline", "NeedsAttention", "Disconnected", "PartiallyDisconnected", "Maintenance". - :type data_box_edge_device_status: str or + :vartype data_box_edge_device_status: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataBoxEdgeDeviceStatus :ivar serial_number: The Serial Number of Data Box Edge/Gateway device. :vartype serial_number: str - :param description: The Description of the Data Box Edge/Gateway device. - :type description: str - :param model_description: The description of the Data Box Edge/Gateway device model. - :type model_description: str + :ivar description: The Description of the Data Box Edge/Gateway device. + :vartype description: str + :ivar model_description: The description of the Data Box Edge/Gateway device model. + :vartype model_description: str :ivar device_type: The type of the Data Box Edge/Gateway device. Possible values include: "DataBoxEdgeDevice". :vartype device_type: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.DeviceType - :param friendly_name: The Data Box Edge/Gateway device name. - :type friendly_name: str + :ivar friendly_name: The Data Box Edge/Gateway device name. + :vartype friendly_name: str :ivar culture: The Data Box Edge/Gateway device culture. :vartype culture: str :ivar device_model: The Data Box Edge/Gateway device model. @@ -754,6 +853,31 @@ def __init__( friendly_name: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. The location of the device. This is a supported and registered + Azure geographical region (for example, West US, East US, or Southeast Asia). The geographical + region of a device cannot be changed once it is created, but if an identical geographical + region is specified on update, the request will succeed. + :paramtype location: str + :keyword tags: A set of tags. The list of tags that describe the device. These tags can be used + to view and group this device (across resource groups). + :paramtype tags: dict[str, str] + :keyword sku: The SKU type. + :paramtype sku: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.Sku + :keyword etag: The etag for the devices. + :paramtype etag: str + :keyword data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible + values include: "ReadyToSetup", "Online", "Offline", "NeedsAttention", "Disconnected", + "PartiallyDisconnected", "Maintenance". + :paramtype data_box_edge_device_status: str or + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataBoxEdgeDeviceStatus + :keyword description: The Description of the Data Box Edge/Gateway device. + :paramtype description: str + :keyword model_description: The description of the Data Box Edge/Gateway device model. + :paramtype model_description: str + :keyword friendly_name: The Data Box Edge/Gateway device name. + :paramtype friendly_name: str + """ super(DataBoxEdgeDevice, self).__init__(**kwargs) self.location = location self.tags = tags @@ -786,11 +910,11 @@ class DataBoxEdgeDeviceExtendedInfo(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param encryption_key_thumbprint: The digital signature of encrypted certificate. - :type encryption_key_thumbprint: str - :param encryption_key: The public part of the encryption certificate. Client uses this to + :ivar encryption_key_thumbprint: The digital signature of encrypted certificate. + :vartype encryption_key_thumbprint: str + :ivar encryption_key: The public part of the encryption certificate. Client uses this to encrypt any secret. - :type encryption_key: str + :vartype encryption_key: str :ivar resource_key: The Resource ID of the Resource. :vartype resource_key: str """ @@ -818,6 +942,13 @@ def __init__( encryption_key: Optional[str] = None, **kwargs ): + """ + :keyword encryption_key_thumbprint: The digital signature of encrypted certificate. + :paramtype encryption_key_thumbprint: str + :keyword encryption_key: The public part of the encryption certificate. Client uses this to + encrypt any secret. + :paramtype encryption_key: str + """ super(DataBoxEdgeDeviceExtendedInfo, self).__init__(**kwargs) self.encryption_key_thumbprint = encryption_key_thumbprint self.encryption_key = encryption_key @@ -849,6 +980,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataBoxEdgeDeviceList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -857,8 +990,8 @@ def __init__( class DataBoxEdgeDevicePatch(msrest.serialization.Model): """The Data Box Edge/Gateway device patch. - :param tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. - :type tags: dict[str, str] + :ivar tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -871,6 +1004,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. + :paramtype tags: dict[str, str] + """ super(DataBoxEdgeDevicePatch, self).__init__(**kwargs) self.tags = tags @@ -953,6 +1090,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataBoxEdgeSku, self).__init__(**kwargs) self.resource_type = None self.name = None @@ -995,6 +1134,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataBoxEdgeSkuList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1016,9 +1157,9 @@ class Trigger(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: + :ivar kind: Required. Trigger Kind.Constant filled by server. Possible values include: "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.TriggerEventType + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.TriggerEventType """ _validation = { @@ -1043,6 +1184,8 @@ def __init__( self, **kwargs ): + """ + """ super(Trigger, self).__init__(**kwargs) self.kind = 'Trigger' # type: str @@ -1060,17 +1203,17 @@ class FileEventTrigger(Trigger): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: + :ivar kind: Required. Trigger Kind.Constant filled by server. Possible values include: "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.TriggerEventType - :param source_info: Required. File event source details. - :type source_info: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.FileSourceInfo - :param sink_info: Required. Role sink info. - :type sink_info: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.TriggerEventType + :ivar source_info: Required. File event source details. + :vartype source_info: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.FileSourceInfo + :ivar sink_info: Required. Role sink info. + :vartype sink_info: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.RoleSinkInfo + :ivar custom_context_tag: A custom context tag typically used to correlate the trigger against its usage. For example, if a periodic timer trigger is intended for certain specific IoT modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str + :vartype custom_context_tag: str """ _validation = { @@ -1100,6 +1243,16 @@ def __init__( custom_context_tag: Optional[str] = None, **kwargs ): + """ + :keyword source_info: Required. File event source details. + :paramtype source_info: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.FileSourceInfo + :keyword sink_info: Required. Role sink info. + :paramtype sink_info: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.RoleSinkInfo + :keyword custom_context_tag: A custom context tag typically used to correlate the trigger + against its usage. For example, if a periodic timer trigger is intended for certain specific + IoT modules in the device, the tag can be the name or the image URL of the module. + :paramtype custom_context_tag: str + """ super(FileEventTrigger, self).__init__(**kwargs) self.kind = 'FileEvent' # type: str self.source_info = source_info @@ -1112,8 +1265,8 @@ class FileSourceInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param share_id: Required. File share ID. - :type share_id: str + :ivar share_id: Required. File share ID. + :vartype share_id: str """ _validation = { @@ -1130,6 +1283,10 @@ def __init__( share_id: str, **kwargs ): + """ + :keyword share_id: Required. File share ID. + :paramtype share_id: str + """ super(FileSourceInfo, self).__init__(**kwargs) self.share_id = share_id @@ -1139,12 +1296,12 @@ class ImageRepositoryCredential(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param image_repository_url: Required. Image repository url (e.g.: mcr.microsoft.com). - :type image_repository_url: str - :param user_name: Required. Repository user name. - :type user_name: str - :param password: Repository user password. - :type password: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AsymmetricEncryptedSecret + :ivar image_repository_url: Required. Image repository url (e.g.: mcr.microsoft.com). + :vartype image_repository_url: str + :ivar user_name: Required. Repository user name. + :vartype user_name: str + :ivar password: Repository user password. + :vartype password: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AsymmetricEncryptedSecret """ _validation = { @@ -1166,6 +1323,15 @@ def __init__( password: Optional["AsymmetricEncryptedSecret"] = None, **kwargs ): + """ + :keyword image_repository_url: Required. Image repository url (e.g.: mcr.microsoft.com). + :paramtype image_repository_url: str + :keyword user_name: Required. Repository user name. + :paramtype user_name: str + :keyword password: Repository user password. + :paramtype password: + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AsymmetricEncryptedSecret + """ super(ImageRepositoryCredential, self).__init__(**kwargs) self.image_repository_url = image_repository_url self.user_name = user_name @@ -1177,14 +1343,14 @@ class IoTDeviceInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param device_id: Required. ID of the IoT device/edge device. - :type device_id: str - :param io_t_host_hub: Required. Host name for the IoT hub associated to the device. - :type io_t_host_hub: str - :param io_t_host_hub_id: Id for the IoT hub associated to the device. - :type io_t_host_hub_id: str - :param authentication: Encrypted IoT device/IoT edge device connection string. - :type authentication: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.Authentication + :ivar device_id: Required. ID of the IoT device/edge device. + :vartype device_id: str + :ivar io_t_host_hub: Required. Host name for the IoT hub associated to the device. + :vartype io_t_host_hub: str + :ivar io_t_host_hub_id: Id for the IoT hub associated to the device. + :vartype io_t_host_hub_id: str + :ivar authentication: Encrypted IoT device/IoT edge device connection string. + :vartype authentication: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.Authentication """ _validation = { @@ -1208,6 +1374,16 @@ def __init__( authentication: Optional["Authentication"] = None, **kwargs ): + """ + :keyword device_id: Required. ID of the IoT device/edge device. + :paramtype device_id: str + :keyword io_t_host_hub: Required. Host name for the IoT hub associated to the device. + :paramtype io_t_host_hub: str + :keyword io_t_host_hub_id: Id for the IoT hub associated to the device. + :paramtype io_t_host_hub_id: str + :keyword authentication: Encrypted IoT device/IoT edge device connection string. + :paramtype authentication: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.Authentication + """ super(IoTDeviceInfo, self).__init__(**kwargs) self.device_id = device_id self.io_t_host_hub = io_t_host_hub @@ -1220,12 +1396,12 @@ class IoTEdgeAgentInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param image_name: Required. Name of the IoT edge agent image. - :type image_name: str - :param tag: Required. Image Tag. - :type tag: str - :param image_repository: Image repository details. - :type image_repository: + :ivar image_name: Required. Name of the IoT edge agent image. + :vartype image_name: str + :ivar tag: Required. Image Tag. + :vartype tag: str + :ivar image_repository: Image repository details. + :vartype image_repository: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.ImageRepositoryCredential """ @@ -1248,6 +1424,15 @@ def __init__( image_repository: Optional["ImageRepositoryCredential"] = None, **kwargs ): + """ + :keyword image_name: Required. Name of the IoT edge agent image. + :paramtype image_name: str + :keyword tag: Required. Image Tag. + :paramtype tag: str + :keyword image_repository: Image repository details. + :paramtype image_repository: + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.ImageRepositoryCredential + """ super(IoTEdgeAgentInfo, self).__init__(**kwargs) self.image_name = image_name self.tag = tag @@ -1270,9 +1455,9 @@ class Role(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive". - :type kind: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.RoleTypes + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.RoleTypes """ _validation = { @@ -1297,6 +1482,8 @@ def __init__( self, **kwargs ): + """ + """ super(Role, self).__init__(**kwargs) self.kind = 'Role' # type: str @@ -1314,29 +1501,30 @@ class IoTRole(Role): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive". - :type kind: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.RoleTypes - :param host_platform: Host OS supported by the IoT role. Possible values include: "Windows", + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.RoleTypes + :ivar host_platform: Host OS supported by the IoT role. Possible values include: "Windows", "Linux". - :type host_platform: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.PlatformType - :param io_t_device_details: IoT device metadata to which data box edge device needs to be + :vartype host_platform: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.PlatformType + :ivar io_t_device_details: IoT device metadata to which data box edge device needs to be connected. - :type io_t_device_details: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.IoTDeviceInfo - :param io_t_edge_device_details: IoT edge device to which the IoT role needs to be configured. - :type io_t_edge_device_details: + :vartype io_t_device_details: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.IoTDeviceInfo + :ivar io_t_edge_device_details: IoT edge device to which the IoT role needs to be configured. + :vartype io_t_edge_device_details: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.IoTDeviceInfo - :param share_mappings: Mount points of shares in role(s). - :type share_mappings: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.MountPointMap] - :param io_t_edge_agent_info: Iot edge agent details to download the agent and bootstrap iot + :ivar share_mappings: Mount points of shares in role(s). + :vartype share_mappings: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.MountPointMap] + :ivar io_t_edge_agent_info: Iot edge agent details to download the agent and bootstrap iot runtime. - :type io_t_edge_agent_info: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.IoTEdgeAgentInfo + :vartype io_t_edge_agent_info: + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.IoTEdgeAgentInfo :ivar host_platform_type: Platform where the Iot runtime is hosted. Possible values include: "KubernetesCluster", "LinuxVM". :vartype host_platform_type: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.HostPlatformType - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.RoleStatus + :ivar role_status: Role status. Possible values include: "Enabled", "Disabled". + :vartype role_status: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.RoleStatus """ _validation = { @@ -1372,6 +1560,29 @@ def __init__( role_status: Optional[Union[str, "RoleStatus"]] = None, **kwargs ): + """ + :keyword host_platform: Host OS supported by the IoT role. Possible values include: "Windows", + "Linux". + :paramtype host_platform: str or + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.PlatformType + :keyword io_t_device_details: IoT device metadata to which data box edge device needs to be + connected. + :paramtype io_t_device_details: + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.IoTDeviceInfo + :keyword io_t_edge_device_details: IoT edge device to which the IoT role needs to be + configured. + :paramtype io_t_edge_device_details: + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.IoTDeviceInfo + :keyword share_mappings: Mount points of shares in role(s). + :paramtype share_mappings: + list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.MountPointMap] + :keyword io_t_edge_agent_info: Iot edge agent details to download the agent and bootstrap iot + runtime. + :paramtype io_t_edge_agent_info: + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.IoTEdgeAgentInfo + :keyword role_status: Role status. Possible values include: "Enabled", "Disabled". + :paramtype role_status: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.RoleStatus + """ super(IoTRole, self).__init__(**kwargs) self.kind = 'IOT' # type: str self.host_platform = host_platform @@ -1412,6 +1623,8 @@ def __init__( self, **kwargs ): + """ + """ super(Ipv4Config, self).__init__(**kwargs) self.ip_address = None self.subnet = None @@ -1447,6 +1660,8 @@ def __init__( self, **kwargs ): + """ + """ super(Ipv6Config, self).__init__(**kwargs) self.ip_address = None self.prefix_length = None @@ -1497,9 +1712,9 @@ class Job(msrest.serialization.Model): :vartype error_manifest_file: str :ivar refreshed_entity_id: ARM ID of the entity that was refreshed. :vartype refreshed_entity_id: str - :param folder: If only subfolders need to be refreshed, then the subfolder path inside the - share or container. (The path is empty if there are no subfolders.). - :type folder: str + :ivar folder: If only subfolders need to be refreshed, then the subfolder path inside the share + or container. (The path is empty if there are no subfolders.). + :vartype folder: str """ _validation = { @@ -1545,6 +1760,11 @@ def __init__( folder: Optional[str] = None, **kwargs ): + """ + :keyword folder: If only subfolders need to be refreshed, then the subfolder path inside the + share or container. (The path is empty if there are no subfolders.). + :paramtype folder: str + """ super(Job, self).__init__(**kwargs) self.id = None self.name = None @@ -1593,6 +1813,8 @@ def __init__( self, **kwargs ): + """ + """ super(JobErrorDetails, self).__init__(**kwargs) self.error_details = None self.code = None @@ -1628,6 +1850,8 @@ def __init__( self, **kwargs ): + """ + """ super(JobErrorItem, self).__init__(**kwargs) self.recommendations = None self.code = None @@ -1637,12 +1861,12 @@ def __init__( class MetricDimensionV1(msrest.serialization.Model): """Metric Dimension v1. - :param name: Name of the metrics dimension. - :type name: str - :param display_name: Display name of the metrics dimension. - :type display_name: str - :param to_be_exported_for_shoebox: To be exported to shoe box. - :type to_be_exported_for_shoebox: bool + :ivar name: Name of the metrics dimension. + :vartype name: str + :ivar display_name: Display name of the metrics dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: To be exported to shoe box. + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -1659,6 +1883,14 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): + """ + :keyword name: Name of the metrics dimension. + :paramtype name: str + :keyword display_name: Display name of the metrics dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: To be exported to shoe box. + :paramtype to_be_exported_for_shoebox: bool + """ super(MetricDimensionV1, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1668,32 +1900,32 @@ def __init__( class MetricSpecificationV1(msrest.serialization.Model): """Metric specification version 1. - :param name: Name of the metric. - :type name: str - :param display_name: Display name of the metric. - :type display_name: str - :param display_description: Description of the metric to be displayed. - :type display_description: str - :param unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Display name of the metric. + :vartype display_name: str + :ivar display_description: Description of the metric to be displayed. + :vartype display_description: str + :ivar unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", "Seconds", "Milliseconds", "Bytes", "BytesPerSecond", "CountPerSecond". - :type unit: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.MetricUnit - :param aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", + :vartype unit: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.MetricUnit + :ivar aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", "None", "Average", "Minimum", "Maximum", "Total", "Count". - :type aggregation_type: str or + :vartype aggregation_type: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.MetricAggregationType - :param dimensions: Metric dimensions, other than default dimension which is resource. - :type dimensions: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.MetricDimensionV1] - :param fill_gap_with_zero: Set true to fill the gaps with zero. - :type fill_gap_with_zero: bool - :param category: Metric category. Possible values include: "Capacity", "Transaction". - :type category: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.MetricCategory - :param resource_id_dimension_name_override: Resource name override. - :type resource_id_dimension_name_override: str - :param supported_time_grain_types: Support granularity of metrics. - :type supported_time_grain_types: list[str or + :ivar dimensions: Metric dimensions, other than default dimension which is resource. + :vartype dimensions: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.MetricDimensionV1] + :ivar fill_gap_with_zero: Set true to fill the gaps with zero. + :vartype fill_gap_with_zero: bool + :ivar category: Metric category. Possible values include: "Capacity", "Transaction". + :vartype category: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.MetricCategory + :ivar resource_id_dimension_name_override: Resource name override. + :vartype resource_id_dimension_name_override: str + :ivar supported_time_grain_types: Support granularity of metrics. + :vartype supported_time_grain_types: list[str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.TimeGrain] - :param supported_aggregation_types: Support metric aggregation type. - :type supported_aggregation_types: list[str or + :ivar supported_aggregation_types: Support metric aggregation type. + :vartype supported_aggregation_types: list[str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.MetricAggregationType] """ @@ -1727,6 +1959,36 @@ def __init__( supported_aggregation_types: Optional[List[Union[str, "MetricAggregationType"]]] = None, **kwargs ): + """ + :keyword name: Name of the metric. + :paramtype name: str + :keyword display_name: Display name of the metric. + :paramtype display_name: str + :keyword display_description: Description of the metric to be displayed. + :paramtype display_description: str + :keyword unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", + "Seconds", "Milliseconds", "Bytes", "BytesPerSecond", "CountPerSecond". + :paramtype unit: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.MetricUnit + :keyword aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", + "None", "Average", "Minimum", "Maximum", "Total", "Count". + :paramtype aggregation_type: str or + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.MetricAggregationType + :keyword dimensions: Metric dimensions, other than default dimension which is resource. + :paramtype dimensions: + list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.MetricDimensionV1] + :keyword fill_gap_with_zero: Set true to fill the gaps with zero. + :paramtype fill_gap_with_zero: bool + :keyword category: Metric category. Possible values include: "Capacity", "Transaction". + :paramtype category: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.MetricCategory + :keyword resource_id_dimension_name_override: Resource name override. + :paramtype resource_id_dimension_name_override: str + :keyword supported_time_grain_types: Support granularity of metrics. + :paramtype supported_time_grain_types: list[str or + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.TimeGrain] + :keyword supported_aggregation_types: Support metric aggregation type. + :paramtype supported_aggregation_types: list[str or + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.MetricAggregationType] + """ super(MetricSpecificationV1, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1748,8 +2010,8 @@ class MountPointMap(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param share_id: Required. ID of the share mounted to the role VM. - :type share_id: str + :ivar share_id: Required. ID of the share mounted to the role VM. + :vartype share_id: str :ivar role_id: ID of the role to which share is mounted. :vartype role_id: str :ivar mount_point: Mount point for the share. @@ -1782,6 +2044,10 @@ def __init__( share_id: str, **kwargs ): + """ + :keyword share_id: Required. ID of the share mounted to the role VM. + :paramtype share_id: str + """ super(MountPointMap, self).__init__(**kwargs) self.share_id = share_id self.role_id = None @@ -1815,13 +2081,13 @@ class NetworkAdapter(msrest.serialization.Model): :ivar status: Value indicating whether this adapter is valid. Possible values include: "Inactive", "Active". :vartype status: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.NetworkAdapterStatus - :param rdma_status: Value indicating whether this adapter is RDMA capable. Possible values + :ivar rdma_status: Value indicating whether this adapter is RDMA capable. Possible values include: "Incapable", "Capable". - :type rdma_status: str or + :vartype rdma_status: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.NetworkAdapterRDMAStatus - :param dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values + :ivar dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values include: "Disabled", "Enabled". - :type dhcp_status: str or + :vartype dhcp_status: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.NetworkAdapterDHCPStatus :ivar ipv4_configuration: The IPv4 configuration of the network adapter. :vartype ipv4_configuration: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.Ipv4Config @@ -1874,6 +2140,16 @@ def __init__( dhcp_status: Optional[Union[str, "NetworkAdapterDHCPStatus"]] = None, **kwargs ): + """ + :keyword rdma_status: Value indicating whether this adapter is RDMA capable. Possible values + include: "Incapable", "Capable". + :paramtype rdma_status: str or + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.NetworkAdapterRDMAStatus + :keyword dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values + include: "Disabled", "Enabled". + :paramtype dhcp_status: str or + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.NetworkAdapterDHCPStatus + """ super(NetworkAdapter, self).__init__(**kwargs) self.adapter_id = None self.adapter_position = None @@ -1917,6 +2193,8 @@ def __init__( self, **kwargs ): + """ + """ super(NetworkAdapterPosition, self).__init__(**kwargs) self.network_group = None self.port = None @@ -1956,6 +2234,8 @@ def __init__( self, **kwargs ): + """ + """ super(NetworkSettings, self).__init__(**kwargs) self.network_adapters = None @@ -2021,6 +2301,8 @@ def __init__( self, **kwargs ): + """ + """ super(Node, self).__init__(**kwargs) self.node_status = None self.node_chassis_serial_number = None @@ -2052,6 +2334,8 @@ def __init__( self, **kwargs ): + """ + """ super(NodeList, self).__init__(**kwargs) self.value = None @@ -2059,14 +2343,14 @@ def __init__( class Operation(msrest.serialization.Model): """Operations. - :param name: Name of the operation. - :type name: str - :param display: Properties displayed for the operation. - :type display: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.OperationDisplay - :param origin: Origin of the operation. - :type origin: str - :param service_specification: Service specification. - :type service_specification: + :ivar name: Name of the operation. + :vartype name: str + :ivar display: Properties displayed for the operation. + :vartype display: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.OperationDisplay + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar service_specification: Service specification. + :vartype service_specification: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.ServiceSpecification """ @@ -2086,6 +2370,17 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword name: Name of the operation. + :paramtype name: str + :keyword display: Properties displayed for the operation. + :paramtype display: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword service_specification: Service specification. + :paramtype service_specification: + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.ServiceSpecification + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -2096,14 +2391,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Operation display properties. - :param provider: Provider name. - :type provider: str - :param resource: The type of resource in which the operation is performed. - :type resource: str - :param operation: Operation to be performed on the resource. - :type operation: str - :param description: Description of the operation to be performed. - :type description: str + :ivar provider: Provider name. + :vartype provider: str + :ivar resource: The type of resource in which the operation is performed. + :vartype resource: str + :ivar operation: Operation to be performed on the resource. + :vartype operation: str + :ivar description: Description of the operation to be performed. + :vartype description: str """ _attribute_map = { @@ -2122,6 +2417,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Provider name. + :paramtype provider: str + :keyword resource: The type of resource in which the operation is performed. + :paramtype resource: str + :keyword operation: Operation to be performed on the resource. + :paramtype operation: str + :keyword description: Description of the operation to be performed. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -2134,10 +2439,10 @@ class OperationsList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The value. - :type value: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.Operation] - :param next_link: Link to the next set of results. - :type next_link: str + :ivar value: Required. The value. + :vartype value: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.Operation] + :ivar next_link: Link to the next set of results. + :vartype next_link: str """ _validation = { @@ -2156,6 +2461,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The value. + :paramtype value: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.Operation] + :keyword next_link: Link to the next set of results. + :paramtype next_link: str + """ super(OperationsList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2172,12 +2483,12 @@ class Order(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param contact_information: The contact details. - :type contact_information: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.ContactDetails - :param shipping_address: The shipping address. - :type shipping_address: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.Address - :param current_status: Current status of the order. - :type current_status: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.OrderStatus + :ivar contact_information: The contact details. + :vartype contact_information: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.ContactDetails + :ivar shipping_address: The shipping address. + :vartype shipping_address: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.Address + :ivar current_status: Current status of the order. + :vartype current_status: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.OrderStatus :ivar order_history: List of status changes in the order. :vartype order_history: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.OrderStatus] :ivar serial_number: Serial number of the device. @@ -2223,6 +2534,15 @@ def __init__( current_status: Optional["OrderStatus"] = None, **kwargs ): + """ + :keyword contact_information: The contact details. + :paramtype contact_information: + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.ContactDetails + :keyword shipping_address: The shipping address. + :paramtype shipping_address: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.Address + :keyword current_status: Current status of the order. + :paramtype current_status: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.OrderStatus + """ super(Order, self).__init__(**kwargs) self.contact_information = contact_information self.shipping_address = shipping_address @@ -2258,6 +2578,8 @@ def __init__( self, **kwargs ): + """ + """ super(OrderList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2270,15 +2592,15 @@ class OrderStatus(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param status: Required. Status of the order as per the allowed status types. Possible values + :ivar status: Required. Status of the order as per the allowed status types. Possible values include: "Untracked", "AwaitingFulfilment", "AwaitingPreparation", "AwaitingShipment", "Shipped", "Arriving", "Delivered", "ReplacementRequested", "LostDevice", "Declined", "ReturnInitiated", "AwaitingReturnShipment", "ShippedBack", "CollectedAtMicrosoft". - :type status: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.OrderState + :vartype status: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.OrderState :ivar update_date_time: Time of status update. :vartype update_date_time: ~datetime.datetime - :param comments: Comments related to this status change. - :type comments: str + :ivar comments: Comments related to this status change. + :vartype comments: str :ivar additional_order_details: Dictionary to hold generic information which is not stored by the already existing properties. :vartype additional_order_details: dict[str, str] @@ -2304,6 +2626,15 @@ def __init__( comments: Optional[str] = None, **kwargs ): + """ + :keyword status: Required. Status of the order as per the allowed status types. Possible values + include: "Untracked", "AwaitingFulfilment", "AwaitingPreparation", "AwaitingShipment", + "Shipped", "Arriving", "Delivered", "ReplacementRequested", "LostDevice", "Declined", + "ReturnInitiated", "AwaitingReturnShipment", "ShippedBack", "CollectedAtMicrosoft". + :paramtype status: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.OrderState + :keyword comments: Comments related to this status change. + :paramtype comments: str + """ super(OrderStatus, self).__init__(**kwargs) self.status = status self.update_date_time = None @@ -2324,17 +2655,18 @@ class PeriodicTimerEventTrigger(Trigger): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: + :ivar kind: Required. Trigger Kind.Constant filled by server. Possible values include: "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.TriggerEventType - :param source_info: Required. Periodic timer details. - :type source_info: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.PeriodicTimerSourceInfo - :param sink_info: Required. Role Sink information. - :type sink_info: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.TriggerEventType + :ivar source_info: Required. Periodic timer details. + :vartype source_info: + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.PeriodicTimerSourceInfo + :ivar sink_info: Required. Role Sink information. + :vartype sink_info: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.RoleSinkInfo + :ivar custom_context_tag: A custom context tag typically used to correlate the trigger against its usage. For example, if a periodic timer trigger is intended for certain specific IoT modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str + :vartype custom_context_tag: str """ _validation = { @@ -2364,6 +2696,17 @@ def __init__( custom_context_tag: Optional[str] = None, **kwargs ): + """ + :keyword source_info: Required. Periodic timer details. + :paramtype source_info: + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.PeriodicTimerSourceInfo + :keyword sink_info: Required. Role Sink information. + :paramtype sink_info: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.RoleSinkInfo + :keyword custom_context_tag: A custom context tag typically used to correlate the trigger + against its usage. For example, if a periodic timer trigger is intended for certain specific + IoT modules in the device, the tag can be the name or the image URL of the module. + :paramtype custom_context_tag: str + """ super(PeriodicTimerEventTrigger, self).__init__(**kwargs) self.kind = 'PeriodicTimerEvent' # type: str self.source_info = source_info @@ -2376,15 +2719,15 @@ class PeriodicTimerSourceInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param start_time: Required. The time of the day that results in a valid trigger. Schedule is + :ivar start_time: Required. The time of the day that results in a valid trigger. Schedule is computed with reference to the time specified upto seconds. If timezone is not specified the time will considered to be in device timezone. The value will always be returned as UTC time. - :type start_time: ~datetime.datetime - :param schedule: Required. Periodic frequency at which timer event needs to be raised. Supports + :vartype start_time: ~datetime.datetime + :ivar schedule: Required. Periodic frequency at which timer event needs to be raised. Supports daily, hourly, minutes, and seconds. - :type schedule: str - :param topic: Topic where periodic events are published to IoT device. - :type topic: str + :vartype schedule: str + :ivar topic: Topic where periodic events are published to IoT device. + :vartype topic: str """ _validation = { @@ -2406,6 +2749,17 @@ def __init__( topic: Optional[str] = None, **kwargs ): + """ + :keyword start_time: Required. The time of the day that results in a valid trigger. Schedule is + computed with reference to the time specified upto seconds. If timezone is not specified the + time will considered to be in device timezone. The value will always be returned as UTC time. + :paramtype start_time: ~datetime.datetime + :keyword schedule: Required. Periodic frequency at which timer event needs to be raised. + Supports daily, hourly, minutes, and seconds. + :paramtype schedule: str + :keyword topic: Topic where periodic events are published to IoT device. + :paramtype topic: str + """ super(PeriodicTimerSourceInfo, self).__init__(**kwargs) self.start_time = start_time self.schedule = schedule @@ -2415,21 +2769,21 @@ def __init__( class RefreshDetails(msrest.serialization.Model): """Fields for tracking refresh job on the share or container. - :param in_progress_refresh_job_id: If a refresh job is currently in progress on this share or + :ivar in_progress_refresh_job_id: If a refresh job is currently in progress on this share or container, this field indicates the ARM resource ID of that job. The field is empty if no job is in progress. - :type in_progress_refresh_job_id: str - :param last_completed_refresh_job_time_in_utc: Indicates the completed time for the last - refresh job on this particular share or container, if any.This could be a failed job or a - successful job. - :type last_completed_refresh_job_time_in_utc: ~datetime.datetime - :param error_manifest_file: Indicates the relative path of the error xml for the last refresh + :vartype in_progress_refresh_job_id: str + :ivar last_completed_refresh_job_time_in_utc: Indicates the completed time for the last refresh + job on this particular share or container, if any.This could be a failed job or a successful + job. + :vartype last_completed_refresh_job_time_in_utc: ~datetime.datetime + :ivar error_manifest_file: Indicates the relative path of the error xml for the last refresh job on this particular share or container, if any. This could be a failed job or a successful job. - :type error_manifest_file: str - :param last_job: Indicates the id of the last refresh job on this particular share or + :vartype error_manifest_file: str + :ivar last_job: Indicates the id of the last refresh job on this particular share or container,if any. This could be a failed job or a successful job. - :type last_job: str + :vartype last_job: str """ _attribute_map = { @@ -2448,6 +2802,23 @@ def __init__( last_job: Optional[str] = None, **kwargs ): + """ + :keyword in_progress_refresh_job_id: If a refresh job is currently in progress on this share or + container, this field indicates the ARM resource ID of that job. The field is empty if no job + is in progress. + :paramtype in_progress_refresh_job_id: str + :keyword last_completed_refresh_job_time_in_utc: Indicates the completed time for the last + refresh job on this particular share or container, if any.This could be a failed job or a + successful job. + :paramtype last_completed_refresh_job_time_in_utc: ~datetime.datetime + :keyword error_manifest_file: Indicates the relative path of the error xml for the last refresh + job on this particular share or container, if any. This could be a failed job or a successful + job. + :paramtype error_manifest_file: str + :keyword last_job: Indicates the id of the last refresh job on this particular share or + container,if any. This could be a failed job or a successful job. + :paramtype last_job: str + """ super(RefreshDetails, self).__init__(**kwargs) self.in_progress_refresh_job_id = in_progress_refresh_job_id self.last_completed_refresh_job_time_in_utc = last_completed_refresh_job_time_in_utc @@ -2515,6 +2886,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceTypeSku, self).__init__(**kwargs) self.resource_type = None self.name = None @@ -2553,6 +2926,8 @@ def __init__( self, **kwargs ): + """ + """ super(RoleList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2563,8 +2938,8 @@ class RoleSinkInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param role_id: Required. Compute role ID. - :type role_id: str + :ivar role_id: Required. Compute role ID. + :vartype role_id: str """ _validation = { @@ -2581,6 +2956,10 @@ def __init__( role_id: str, **kwargs ): + """ + :keyword role_id: Required. Compute role ID. + :paramtype role_id: str + """ super(RoleSinkInfo, self).__init__(**kwargs) self.role_id = role_id @@ -2598,11 +2977,11 @@ class SecuritySettings(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param device_admin_password: Required. Device administrator password as an encrypted string + :ivar device_admin_password: Required. Device administrator password as an encrypted string (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual password should have at least 8 characters that are a combination of uppercase, lowercase, numeric, and special characters. - :type device_admin_password: + :vartype device_admin_password: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AsymmetricEncryptedSecret """ @@ -2626,6 +3005,14 @@ def __init__( device_admin_password: "AsymmetricEncryptedSecret", **kwargs ): + """ + :keyword device_admin_password: Required. Device administrator password as an encrypted string + (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual + password should have at least 8 characters that are a combination of uppercase, lowercase, + numeric, and special characters. + :paramtype device_admin_password: + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AsymmetricEncryptedSecret + """ super(SecuritySettings, self).__init__(**kwargs) self.device_admin_password = device_admin_password @@ -2633,8 +3020,8 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """Service specification. - :param metric_specifications: Metric specification as defined by shoebox. - :type metric_specifications: + :ivar metric_specifications: Metric specification as defined by shoebox. + :vartype metric_specifications: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.MetricSpecificationV1] """ @@ -2648,6 +3035,11 @@ def __init__( metric_specifications: Optional[List["MetricSpecificationV1"]] = None, **kwargs ): + """ + :keyword metric_specifications: Metric specification as defined by shoebox. + :paramtype metric_specifications: + list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.MetricSpecificationV1] + """ super(ServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications @@ -2665,36 +3057,36 @@ class Share(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param description: Description for the share. - :type description: str - :param share_status: Required. Current status of the share. Possible values include: "Offline", + :ivar description: Description for the share. + :vartype description: str + :ivar share_status: Required. Current status of the share. Possible values include: "Offline", "Unknown", "OK", "Updating", "NeedsAttention". - :type share_status: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.ShareStatus - :param monitoring_status: Required. Current monitoring status of the share. Possible values + :vartype share_status: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.ShareStatus + :ivar monitoring_status: Required. Current monitoring status of the share. Possible values include: "Enabled", "Disabled". - :type monitoring_status: str or + :vartype monitoring_status: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.MonitoringStatus - :param azure_container_info: Azure container mapping for the share. - :type azure_container_info: + :ivar azure_container_info: Azure container mapping for the share. + :vartype azure_container_info: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AzureContainerInfo - :param access_protocol: Required. Access protocol to be used by the share. Possible values + :ivar access_protocol: Required. Access protocol to be used by the share. Possible values include: "SMB", "NFS". - :type access_protocol: str or + :vartype access_protocol: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.ShareAccessProtocol - :param user_access_rights: Mapping of users and corresponding access rights on the share + :ivar user_access_rights: Mapping of users and corresponding access rights on the share (required for SMB protocol). - :type user_access_rights: + :vartype user_access_rights: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.UserAccessRight] - :param client_access_rights: List of IP addresses and corresponding access rights on the + :ivar client_access_rights: List of IP addresses and corresponding access rights on the share(required for NFS protocol). - :type client_access_rights: + :vartype client_access_rights: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.ClientAccessRight] - :param refresh_details: Details of the refresh job on this share. - :type refresh_details: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.RefreshDetails + :ivar refresh_details: Details of the refresh job on this share. + :vartype refresh_details: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.RefreshDetails :ivar share_mappings: Share mount point to the role. :vartype share_mappings: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.MountPointMap] - :param data_policy: Data policy of the share. Possible values include: "Cloud", "Local". - :type data_policy: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataPolicy + :ivar data_policy: Data policy of the share. Possible values include: "Cloud", "Local". + :vartype data_policy: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataPolicy """ _validation = { @@ -2737,6 +3129,36 @@ def __init__( data_policy: Optional[Union[str, "DataPolicy"]] = None, **kwargs ): + """ + :keyword description: Description for the share. + :paramtype description: str + :keyword share_status: Required. Current status of the share. Possible values include: + "Offline", "Unknown", "OK", "Updating", "NeedsAttention". + :paramtype share_status: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.ShareStatus + :keyword monitoring_status: Required. Current monitoring status of the share. Possible values + include: "Enabled", "Disabled". + :paramtype monitoring_status: str or + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.MonitoringStatus + :keyword azure_container_info: Azure container mapping for the share. + :paramtype azure_container_info: + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AzureContainerInfo + :keyword access_protocol: Required. Access protocol to be used by the share. Possible values + include: "SMB", "NFS". + :paramtype access_protocol: str or + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.ShareAccessProtocol + :keyword user_access_rights: Mapping of users and corresponding access rights on the share + (required for SMB protocol). + :paramtype user_access_rights: + list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.UserAccessRight] + :keyword client_access_rights: List of IP addresses and corresponding access rights on the + share(required for NFS protocol). + :paramtype client_access_rights: + list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.ClientAccessRight] + :keyword refresh_details: Details of the refresh job on this share. + :paramtype refresh_details: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.RefreshDetails + :keyword data_policy: Data policy of the share. Possible values include: "Cloud", "Local". + :paramtype data_policy: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataPolicy + """ super(Share, self).__init__(**kwargs) self.description = description self.share_status = share_status @@ -2755,11 +3177,11 @@ class ShareAccessRight(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param share_id: Required. The share ID. - :type share_id: str - :param access_type: Required. Type of access to be allowed on the share for this user. Possible + :ivar share_id: Required. The share ID. + :vartype share_id: str + :ivar access_type: Required. Type of access to be allowed on the share for this user. Possible values include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.ShareAccessType + :vartype access_type: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.ShareAccessType """ _validation = { @@ -2779,6 +3201,14 @@ def __init__( access_type: Union[str, "ShareAccessType"], **kwargs ): + """ + :keyword share_id: Required. The share ID. + :paramtype share_id: str + :keyword access_type: Required. Type of access to be allowed on the share for this user. + Possible values include: "Change", "Read", "Custom". + :paramtype access_type: str or + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.ShareAccessType + """ super(ShareAccessRight, self).__init__(**kwargs) self.share_id = share_id self.access_type = access_type @@ -2809,6 +3239,8 @@ def __init__( self, **kwargs ): + """ + """ super(ShareList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2817,12 +3249,12 @@ def __init__( class Sku(msrest.serialization.Model): """The SKU type. - :param name: SKU name. Possible values include: "Gateway", "Edge", "TEA_1Node", - "TEA_1Node_UPS", "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", - "TEA_4Node_UPS_Heater", "TMA", "TDC", "TCA_Large", "TCA_Small", "GPU". - :type name: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.SkuName - :param tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard". - :type tier: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.SkuTier + :ivar name: SKU name. Possible values include: "Gateway", "Edge", "TEA_1Node", "TEA_1Node_UPS", + "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", "TEA_4Node_UPS_Heater", "TMA", + "TDC", "TCA_Large", "TCA_Small", "GPU". + :vartype name: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.SkuName + :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard". + :vartype tier: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.SkuTier """ _attribute_map = { @@ -2837,6 +3269,15 @@ def __init__( tier: Optional[Union[str, "SkuTier"]] = None, **kwargs ): + """ + :keyword name: SKU name. Possible values include: "Gateway", "Edge", "TEA_1Node", + "TEA_1Node_UPS", "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", + "TEA_4Node_UPS_Heater", "TMA", "TDC", "TCA_Large", "TCA_Small", "GPU". + :paramtype name: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.SkuName + :keyword tier: The SKU tier. This is based on the SKU name. Possible values include: + "Standard". + :paramtype tier: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.SkuTier + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -2867,6 +3308,8 @@ def __init__( self, **kwargs ): + """ + """ super(SKUCapability, self).__init__(**kwargs) self.name = None self.value = None @@ -2901,6 +3344,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuCost, self).__init__(**kwargs) self.meter_id = None self.quantity = None @@ -2973,6 +3418,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuInformation, self).__init__(**kwargs) self.resource_type = None self.name = None @@ -3013,6 +3460,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuInformationList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3047,6 +3496,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuLocationInfo, self).__init__(**kwargs) self.location = None self.zones = None @@ -3089,6 +3540,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuRestriction, self).__init__(**kwargs) self.type = None self.values = None @@ -3121,6 +3574,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuRestrictionInfo, self).__init__(**kwargs) self.locations = None self.zones = None @@ -3137,17 +3592,17 @@ class StorageAccount(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param description: Description for the storage Account. - :type description: str - :param storage_account_status: Current status of the storage account. Possible values include: + :ivar description: Description for the storage Account. + :vartype description: str + :ivar storage_account_status: Current status of the storage account. Possible values include: "OK", "Offline", "Unknown", "Updating", "NeedsAttention". - :type storage_account_status: str or + :vartype storage_account_status: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.StorageAccountStatus - :param data_policy: Data policy of the storage Account. Possible values include: "Cloud", + :ivar data_policy: Data policy of the storage Account. Possible values include: "Cloud", "Local". - :type data_policy: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataPolicy - :param storage_account_credential_id: Storage Account Credential Id. - :type storage_account_credential_id: str + :vartype data_policy: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataPolicy + :ivar storage_account_credential_id: Storage Account Credential Id. + :vartype storage_account_credential_id: str :ivar blob_endpoint: BlobEndpoint of Storage Account. :vartype blob_endpoint: str :ivar container_count: The Container Count. Present only for Storage Accounts with DataPolicy @@ -3184,6 +3639,19 @@ def __init__( storage_account_credential_id: Optional[str] = None, **kwargs ): + """ + :keyword description: Description for the storage Account. + :paramtype description: str + :keyword storage_account_status: Current status of the storage account. Possible values + include: "OK", "Offline", "Unknown", "Updating", "NeedsAttention". + :paramtype storage_account_status: str or + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.StorageAccountStatus + :keyword data_policy: Data policy of the storage Account. Possible values include: "Cloud", + "Local". + :paramtype data_policy: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataPolicy + :keyword storage_account_credential_id: Storage Account Credential Id. + :paramtype storage_account_credential_id: str + """ super(StorageAccount, self).__init__(**kwargs) self.description = description self.storage_account_status = storage_account_status @@ -3206,25 +3674,26 @@ class StorageAccountCredential(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param alias: Required. Alias for the storage account. - :type alias: str - :param user_name: Username for the storage account. - :type user_name: str - :param account_key: Encrypted storage key. - :type account_key: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AsymmetricEncryptedSecret - :param connection_string: Connection string for the storage account. Use this string if - username and account key are not specified. - :type connection_string: str - :param ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible values + :ivar alias: Required. Alias for the storage account. + :vartype alias: str + :ivar user_name: Username for the storage account. + :vartype user_name: str + :ivar account_key: Encrypted storage key. + :vartype account_key: + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AsymmetricEncryptedSecret + :ivar connection_string: Connection string for the storage account. Use this string if username + and account key are not specified. + :vartype connection_string: str + :ivar ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible values include: "Enabled", "Disabled". - :type ssl_status: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.SSLStatus - :param blob_domain_name: Blob end point for private clouds. - :type blob_domain_name: str - :param account_type: Required. Type of storage accessed on the storage account. Possible values + :vartype ssl_status: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.SSLStatus + :ivar blob_domain_name: Blob end point for private clouds. + :vartype blob_domain_name: str + :ivar account_type: Required. Type of storage accessed on the storage account. Possible values include: "GeneralPurposeStorage", "BlobStorage". - :type account_type: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AccountType - :param storage_account_id: Id of the storage account. - :type storage_account_id: str + :vartype account_type: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AccountType + :ivar storage_account_id: Id of the storage account. + :vartype storage_account_id: str """ _validation = { @@ -3263,6 +3732,28 @@ def __init__( storage_account_id: Optional[str] = None, **kwargs ): + """ + :keyword alias: Required. Alias for the storage account. + :paramtype alias: str + :keyword user_name: Username for the storage account. + :paramtype user_name: str + :keyword account_key: Encrypted storage key. + :paramtype account_key: + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AsymmetricEncryptedSecret + :keyword connection_string: Connection string for the storage account. Use this string if + username and account key are not specified. + :paramtype connection_string: str + :keyword ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible + values include: "Enabled", "Disabled". + :paramtype ssl_status: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.SSLStatus + :keyword blob_domain_name: Blob end point for private clouds. + :paramtype blob_domain_name: str + :keyword account_type: Required. Type of storage accessed on the storage account. Possible + values include: "GeneralPurposeStorage", "BlobStorage". + :paramtype account_type: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AccountType + :keyword storage_account_id: Id of the storage account. + :paramtype storage_account_id: str + """ super(StorageAccountCredential, self).__init__(**kwargs) self.alias = alias self.user_name = user_name @@ -3300,6 +3791,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountCredentialList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3330,6 +3823,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3338,8 +3833,8 @@ def __init__( class SymmetricKey(msrest.serialization.Model): """Symmetric key for authentication. - :param connection_string: Connection string based on the symmetric key. - :type connection_string: + :ivar connection_string: Connection string based on the symmetric key. + :vartype connection_string: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AsymmetricEncryptedSecret """ @@ -3353,6 +3848,11 @@ def __init__( connection_string: Optional["AsymmetricEncryptedSecret"] = None, **kwargs ): + """ + :keyword connection_string: Connection string based on the symmetric key. + :paramtype connection_string: + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AsymmetricEncryptedSecret + """ super(SymmetricKey, self).__init__(**kwargs) self.connection_string = connection_string @@ -3360,14 +3860,14 @@ def __init__( class TrackingInfo(msrest.serialization.Model): """Tracking courier information. - :param serial_number: Serial number of the device being tracked. - :type serial_number: str - :param carrier_name: Name of the carrier used in the delivery. - :type carrier_name: str - :param tracking_id: Tracking ID of the shipment. - :type tracking_id: str - :param tracking_url: Tracking URL of the shipment. - :type tracking_url: str + :ivar serial_number: Serial number of the device being tracked. + :vartype serial_number: str + :ivar carrier_name: Name of the carrier used in the delivery. + :vartype carrier_name: str + :ivar tracking_id: Tracking ID of the shipment. + :vartype tracking_id: str + :ivar tracking_url: Tracking URL of the shipment. + :vartype tracking_url: str """ _attribute_map = { @@ -3386,6 +3886,16 @@ def __init__( tracking_url: Optional[str] = None, **kwargs ): + """ + :keyword serial_number: Serial number of the device being tracked. + :paramtype serial_number: str + :keyword carrier_name: Name of the carrier used in the delivery. + :paramtype carrier_name: str + :keyword tracking_id: Tracking ID of the shipment. + :paramtype tracking_id: str + :keyword tracking_url: Tracking URL of the shipment. + :paramtype tracking_url: str + """ super(TrackingInfo, self).__init__(**kwargs) self.serial_number = serial_number self.carrier_name = carrier_name @@ -3418,6 +3928,8 @@ def __init__( self, **kwargs ): + """ + """ super(TriggerList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3466,6 +3978,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateDownloadProgress, self).__init__(**kwargs) self.download_phase = None self.percent_complete = None @@ -3504,6 +4018,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateInstallProgress, self).__init__(**kwargs) self.percent_complete = None self.number_of_updates_to_install = None @@ -3521,15 +4037,15 @@ class UpdateSummary(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param device_version_number: The current version of the device in format: 1.2.17312.13.",. - :type device_version_number: str - :param friendly_device_version_name: The current version of the device in text format. - :type friendly_device_version_name: str - :param device_last_scanned_date_time: The last time when a scan was done on the device. - :type device_last_scanned_date_time: ~datetime.datetime - :param last_completed_scan_job_date_time: The time when the last scan job was completed + :ivar device_version_number: The current version of the device in format: 1.2.17312.13.",. + :vartype device_version_number: str + :ivar friendly_device_version_name: The current version of the device in text format. + :vartype friendly_device_version_name: str + :ivar device_last_scanned_date_time: The last time when a scan was done on the device. + :vartype device_last_scanned_date_time: ~datetime.datetime + :ivar last_completed_scan_job_date_time: The time when the last scan job was completed (success/cancelled/failed) on the appliance. - :type last_completed_scan_job_date_time: ~datetime.datetime + :vartype last_completed_scan_job_date_time: ~datetime.datetime :ivar last_completed_download_job_date_time: The time when the last Download job was completed (success/cancelled/failed) on the appliance. :vartype last_completed_download_job_date_time: ~datetime.datetime @@ -3618,6 +4134,17 @@ def __init__( last_completed_scan_job_date_time: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword device_version_number: The current version of the device in format: 1.2.17312.13.",. + :paramtype device_version_number: str + :keyword friendly_device_version_name: The current version of the device in text format. + :paramtype friendly_device_version_name: str + :keyword device_last_scanned_date_time: The last time when a scan was done on the device. + :paramtype device_last_scanned_date_time: ~datetime.datetime + :keyword last_completed_scan_job_date_time: The time when the last scan job was completed + (success/cancelled/failed) on the appliance. + :paramtype last_completed_scan_job_date_time: ~datetime.datetime + """ super(UpdateSummary, self).__init__(**kwargs) self.device_version_number = device_version_number self.friendly_device_version_name = friendly_device_version_name @@ -3643,12 +4170,12 @@ class UploadCertificateRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param authentication_type: The authentication type. Possible values include: "Invalid", + :ivar authentication_type: The authentication type. Possible values include: "Invalid", "AzureActiveDirectory". - :type authentication_type: str or + :vartype authentication_type: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AuthenticationType - :param certificate: Required. The base64 encoded certificate raw data. - :type certificate: str + :ivar certificate: Required. The base64 encoded certificate raw data. + :vartype certificate: str """ _validation = { @@ -3667,6 +4194,14 @@ def __init__( authentication_type: Optional[Union[str, "AuthenticationType"]] = None, **kwargs ): + """ + :keyword authentication_type: The authentication type. Possible values include: "Invalid", + "AzureActiveDirectory". + :paramtype authentication_type: str or + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AuthenticationType + :keyword certificate: Required. The base64 encoded certificate raw data. + :paramtype certificate: str + """ super(UploadCertificateRequest, self).__init__(**kwargs) self.authentication_type = authentication_type self.certificate = certificate @@ -3677,9 +4212,10 @@ class UploadCertificateResponse(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param auth_type: Specifies authentication type. Possible values include: "Invalid", + :ivar auth_type: Specifies authentication type. Possible values include: "Invalid", "AzureActiveDirectory". - :type auth_type: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AuthenticationType + :vartype auth_type: str or + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AuthenticationType :ivar resource_id: The resource ID of the Data Box Edge/Gateway device. :vartype resource_id: str :ivar aad_authority: Azure Active Directory tenant authority. @@ -3724,6 +4260,12 @@ def __init__( auth_type: Optional[Union[str, "AuthenticationType"]] = None, **kwargs ): + """ + :keyword auth_type: Specifies authentication type. Possible values include: "Invalid", + "AzureActiveDirectory". + :paramtype auth_type: str or + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AuthenticationType + """ super(UploadCertificateResponse, self).__init__(**kwargs) self.auth_type = auth_type self.resource_id = None @@ -3748,16 +4290,16 @@ class User(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param encrypted_password: The password details. - :type encrypted_password: + :ivar encrypted_password: The password details. + :vartype encrypted_password: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AsymmetricEncryptedSecret :ivar share_access_rights: List of shares that the user has rights on. This field should not be specified during user creation. :vartype share_access_rights: list[~azure.mgmt.databoxedge.v2020_05_01_preview.models.ShareAccessRight] - :param user_type: Required. Type of the user. Possible values include: "Share", + :ivar user_type: Required. Type of the user. Possible values include: "Share", "LocalManagement", "ARM". - :type user_type: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.UserType + :vartype user_type: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.UserType """ _validation = { @@ -3784,6 +4326,14 @@ def __init__( encrypted_password: Optional["AsymmetricEncryptedSecret"] = None, **kwargs ): + """ + :keyword encrypted_password: The password details. + :paramtype encrypted_password: + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.AsymmetricEncryptedSecret + :keyword user_type: Required. Type of the user. Possible values include: "Share", + "LocalManagement", "ARM". + :paramtype user_type: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.UserType + """ super(User, self).__init__(**kwargs) self.encrypted_password = encrypted_password self.share_access_rights = None @@ -3795,11 +4345,11 @@ class UserAccessRight(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param user_id: Required. User ID (already existing in the device). - :type user_id: str - :param access_type: Required. Type of access to be allowed for the user. Possible values + :ivar user_id: Required. User ID (already existing in the device). + :vartype user_id: str + :ivar access_type: Required. Type of access to be allowed for the user. Possible values include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.ShareAccessType + :vartype access_type: str or ~azure.mgmt.databoxedge.v2020_05_01_preview.models.ShareAccessType """ _validation = { @@ -3819,6 +4369,14 @@ def __init__( access_type: Union[str, "ShareAccessType"], **kwargs ): + """ + :keyword user_id: Required. User ID (already existing in the device). + :paramtype user_id: str + :keyword access_type: Required. Type of access to be allowed for the user. Possible values + include: "Change", "Read", "Custom". + :paramtype access_type: str or + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.ShareAccessType + """ super(UserAccessRight, self).__init__(**kwargs) self.user_id = user_id self.access_type = access_type @@ -3849,6 +4407,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserList, self).__init__(**kwargs) self.value = None self.next_link = None diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_alerts_operations.py index 1c1362f56b1f..174de1691f5a 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_alerts_operations.py @@ -5,23 +5,97 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AlertsOperations(object): """AlertsOperations operations. @@ -45,13 +119,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AlertList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.AlertList"]: """Gets all the alerts for a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -60,7 +134,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AlertList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.AlertList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.AlertList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertList"] @@ -68,36 +143,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AlertList', pipeline_response) + deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,19 +187,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Alert" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Alert": """Gets an alert by name. Gets an alert by name. @@ -148,28 +221,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,4 +246,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_available_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_available_skus_operations.py index 01d14b89253e..9e176924d7f0 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_available_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_available_skus_operations.py @@ -5,23 +5,56 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/availableSkus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AvailableSkusOperations(object): """AvailableSkusOperations operations. @@ -45,18 +78,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DataBoxEdgeSkuList"] + **kwargs: Any + ) -> Iterable["_models.DataBoxEdgeSkuList"]: """List all the available Skus and information related to them. List all the available Skus and information related to them. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DataBoxEdgeSkuList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataBoxEdgeSkuList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataBoxEdgeSkuList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeSkuList"] @@ -64,34 +98,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeSkuList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeSkuList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -109,6 +138,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_bandwidth_schedules_operations.py index b827a2edab30..afca84f956f4 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_bandwidth_schedules_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class BandwidthSchedulesOperations(object): """BandwidthSchedulesOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BandwidthSchedulesList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.BandwidthSchedulesList"]: """Gets all the bandwidth schedules for a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -61,8 +219,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BandwidthSchedulesList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.BandwidthSchedulesList] + :return: An iterator like instance of either BandwidthSchedulesList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.BandwidthSchedulesList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedulesList"] @@ -70,36 +230,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BandwidthSchedulesList', pipeline_response) + deserialized = self._deserialize("BandwidthSchedulesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,19 +274,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BandwidthSchedule" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.BandwidthSchedule": """Gets the properties of the specified bandwidth schedule. :param device_name: The device name. @@ -148,28 +306,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,49 +331,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.BandwidthSchedule" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.BandwidthSchedule"] + device_name: str, + name: str, + resource_group_name: str, + parameters: "_models.BandwidthSchedule", + **kwargs: Any + ) -> Optional["_models.BandwidthSchedule"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BandwidthSchedule"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BandwidthSchedule') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BandwidthSchedule') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -241,17 +380,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.BandwidthSchedule" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BandwidthSchedule"] + device_name: str, + name: str, + resource_group_name: str, + parameters: "_models.BandwidthSchedule", + **kwargs: Any + ) -> LROPoller["_models.BandwidthSchedule"]: """Creates or updates a bandwidth schedule. :param device_name: The device name. @@ -264,15 +405,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.BandwidthSchedule :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either BandwidthSchedule or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.BandwidthSchedule] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BandwidthSchedule or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.BandwidthSchedule] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedule"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +431,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BandwidthSchedule', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -318,43 +457,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -367,14 +496,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the specified bandwidth schedule. :param device_name: The device name. @@ -385,15 +515,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -408,22 +540,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -435,4 +559,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_containers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_containers_operations.py index a73b349932d3..4df6972e6182 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_containers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_containers_operations.py @@ -5,25 +5,230 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_storage_account_request( + device_name: str, + storage_account_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + storage_account_name: str, + container_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + storage_account_name: str, + container_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + storage_account_name: str, + container_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_refresh_request_initial( + device_name: str, + storage_account_name: str, + container_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ContainersOperations(object): """ContainersOperations operations. @@ -47,14 +252,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_storage_account( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ContainerList"] + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ContainerList"]: """Lists all the containers of a storage Account in a Data Box Edge/Data Box Gateway device. Lists all the containers of a storage Account in a Data Box Edge/Data Box Gateway device. @@ -67,7 +272,8 @@ def list_by_storage_account( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ContainerList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.ContainerList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.ContainerList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerList"] @@ -75,37 +281,35 @@ def list_by_storage_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_storage_account.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_account_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_storage_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_account_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ContainerList', pipeline_response) + deserialized = self._deserialize("ContainerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -123,20 +327,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_storage_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Container" + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Container": """Gets a container by name. Gets a container by name. @@ -159,29 +364,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -195,51 +390,42 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - container, # type: "_models.Container" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Container"] + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + container: "_models.Container", + **kwargs: Any + ) -> Optional["_models.Container"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Container"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(container, 'Container') + + request = build_create_or_update_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(container, 'Container') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -255,18 +441,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - container, # type: "_models.Container" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Container"] + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + container: "_models.Container", + **kwargs: Any + ) -> LROPoller["_models.Container"]: """Creates a new container or updates an existing container on the device. Creates a new container or updates an existing container on the device. @@ -283,15 +471,19 @@ def begin_create_or_update( :type container: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.Container :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Container or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.Container] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.Container] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Container"] lro_delay = kwargs.pop( 'polling_interval', @@ -305,29 +497,21 @@ def begin_create_or_update( container_name=container_name, resource_group_name=resource_group_name, container=container, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Container', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -339,45 +523,35 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore def _delete_initial( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -390,15 +564,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the container on the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -411,15 +586,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -435,23 +612,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -463,45 +631,35 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore def _refresh_initial( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -514,15 +672,16 @@ def _refresh_initial( _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh'} # type: ignore + + @distributed_trace def begin_refresh( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Refreshes the container metadata with the data from the cloud. Refreshes the container metadata with the data from the cloud. @@ -537,15 +696,17 @@ def begin_refresh( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -561,23 +722,14 @@ def begin_refresh( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -589,4 +741,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_devices_operations.py index 884339fc563c..2afbadaebc3e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_devices_operations.py @@ -5,25 +5,556 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_subscription_request( + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_download_updates_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_extended_information_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_install_updates_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_network_settings_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/networkSettings/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_scan_for_updates_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_security_settings_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_update_summary_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_upload_certificate_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/uploadCertificate') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class DevicesOperations(object): """DevicesOperations operations. @@ -47,20 +578,22 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DataBoxEdgeDeviceList"] + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.DataBoxEdgeDeviceList"]: """Gets all the Data Box Edge/Data Box Gateway devices in a subscription. :param expand: Specify $expand=details to populate additional fields related to the resource or Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -68,36 +601,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,18 +643,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DataBoxEdgeDeviceList"] + resource_group_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.DataBoxEdgeDeviceList"]: """Gets all the Data Box Edge/Data Box Gateway devices in a resource group. :param resource_group_name: The resource group name. @@ -135,8 +664,10 @@ def list_by_resource_group( Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -144,37 +675,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -192,18 +719,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDevice" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DataBoxEdgeDevice": """Gets the properties of the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -220,27 +748,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -254,47 +772,38 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - resource_group_name, # type: str - data_box_edge_device, # type: "_models.DataBoxEdgeDevice" - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDevice" + device_name: str, + resource_group_name: str, + data_box_edge_device: "_models.DataBoxEdgeDevice", + **kwargs: Any + ) -> "_models.DataBoxEdgeDevice": cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -308,16 +817,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - resource_group_name, # type: str - data_box_edge_device, # type: "_models.DataBoxEdgeDevice" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DataBoxEdgeDevice"] + device_name: str, + resource_group_name: str, + data_box_edge_device: "_models.DataBoxEdgeDevice", + **kwargs: Any + ) -> LROPoller["_models.DataBoxEdgeDevice"]: """Creates or updates a Data Box Edge/Data Box Gateway resource. :param device_name: The device name. @@ -325,18 +836,24 @@ def begin_create_or_update( :param resource_group_name: The resource group name. :type resource_group_name: str :param data_box_edge_device: The resource object. - :type data_box_edge_device: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataBoxEdgeDevice + :type data_box_edge_device: + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataBoxEdgeDevice :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DataBoxEdgeDevice or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataBoxEdgeDevice] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DataBoxEdgeDevice or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.DataBoxEdgeDevice] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] lro_delay = kwargs.pop( 'polling_interval', @@ -348,27 +865,21 @@ def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, data_box_edge_device=data_box_edge_device, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DataBoxEdgeDevice', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -380,41 +891,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore def _delete_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -427,13 +928,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -442,15 +944,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -464,21 +968,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -490,16 +987,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + @distributed_trace def update( self, - device_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.DataBoxEdgeDevicePatch" - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDevice" + device_name: str, + resource_group_name: str, + parameters: "_models.DataBoxEdgeDevicePatch", + **kwargs: Any + ) -> "_models.DataBoxEdgeDevice": """Modifies a Data Box Edge/Data Box Gateway resource. :param device_name: The device name. @@ -518,32 +1016,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') + + request = build_update_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -557,41 +1045,32 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + def _download_updates_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._download_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_download_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._download_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -604,13 +1083,14 @@ def _download_updates_initial( _download_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + + @distributed_trace def begin_download_updates( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Downloads the updates on a Data Box Edge/Data Box Gateway device. Downloads the updates on a Data Box Edge/Data Box Gateway device. @@ -621,15 +1101,17 @@ def begin_download_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -643,21 +1125,14 @@ def begin_download_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -669,15 +1144,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_download_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + @distributed_trace def get_extended_information( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDeviceExtendedInfo" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DataBoxEdgeDeviceExtendedInfo": """Gets additional information for the specified Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -694,27 +1170,17 @@ def get_extended_information( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_extended_information.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_extended_information_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_extended_information.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -728,41 +1194,32 @@ def get_extended_information( return cls(pipeline_response, deserialized, {}) return deserialized + get_extended_information.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation'} # type: ignore + def _install_updates_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._install_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_install_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._install_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -775,13 +1232,14 @@ def _install_updates_initial( _install_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + + @distributed_trace def begin_install_updates( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Installs the updates on the Data Box Edge/Data Box Gateway device. Installs the updates on the Data Box Edge/Data Box Gateway device. @@ -792,15 +1250,17 @@ def begin_install_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -814,21 +1274,14 @@ def begin_install_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -840,15 +1293,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_install_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + @distributed_trace def get_network_settings( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.NetworkSettings" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.NetworkSettings": """Gets the network settings of the specified Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -865,27 +1319,17 @@ def get_network_settings( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_network_settings.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_network_settings_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_network_settings.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -899,41 +1343,32 @@ def get_network_settings( return cls(pipeline_response, deserialized, {}) return deserialized + get_network_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/networkSettings/default'} # type: ignore + def _scan_for_updates_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._scan_for_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_scan_for_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._scan_for_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -946,13 +1381,14 @@ def _scan_for_updates_initial( _scan_for_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore + + @distributed_trace def begin_scan_for_updates( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Scans for updates on a Data Box Edge/Data Box Gateway device. Scans for updates on a Data Box Edge/Data Box Gateway device. @@ -963,15 +1399,17 @@ def begin_scan_for_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -985,21 +1423,14 @@ def begin_scan_for_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1011,47 +1442,37 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_scan_for_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore def _create_or_update_security_settings_initial( self, - device_name, # type: str - resource_group_name, # type: str - security_settings, # type: "_models.SecuritySettings" - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + security_settings: "_models.SecuritySettings", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_security_settings_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(security_settings, 'SecuritySettings') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_security_settings_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_security_settings_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(security_settings, 'SecuritySettings') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1064,14 +1485,15 @@ def _create_or_update_security_settings_initial( _create_or_update_security_settings_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + + @distributed_trace def begin_create_or_update_security_settings( self, - device_name, # type: str - resource_group_name, # type: str - security_settings, # type: "_models.SecuritySettings" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + security_settings: "_models.SecuritySettings", + **kwargs: Any + ) -> LROPoller[None]: """Updates the security settings on a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -1082,15 +1504,18 @@ def begin_create_or_update_security_settings( :type security_settings: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.SecuritySettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1102,24 +1527,18 @@ def begin_create_or_update_security_settings( device_name=device_name, resource_group_name=resource_group_name, security_settings=security_settings, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1131,16 +1550,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_security_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + @distributed_trace def get_update_summary( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.UpdateSummary" - """Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.UpdateSummary": + """Gets information about the availability of updates based on the last scan of the device. It + also gets information about any ongoing download or install jobs on the device. Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. @@ -1159,27 +1580,17 @@ def get_update_summary( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_update_summary.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_update_summary_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_update_summary.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1193,16 +1604,18 @@ def get_update_summary( return cls(pipeline_response, deserialized, {}) return deserialized + get_update_summary.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default'} # type: ignore + + @distributed_trace def upload_certificate( self, - device_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.UploadCertificateRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.UploadCertificateResponse" + device_name: str, + resource_group_name: str, + parameters: "_models.UploadCertificateRequest", + **kwargs: Any + ) -> "_models.UploadCertificateResponse": """Uploads registration certificate for the device. :param device_name: The device name. @@ -1221,32 +1634,22 @@ def upload_certificate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.upload_certificate.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'UploadCertificateRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_upload_certificate_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.upload_certificate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'UploadCertificateRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1260,4 +1663,6 @@ def upload_certificate( return cls(pipeline_response, deserialized, {}) return deserialized + upload_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/uploadCertificate'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_jobs_operations.py index 1eac9900ad85..4b842ee297f8 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_jobs_operations.py @@ -5,22 +5,61 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class JobsOperations(object): """JobsOperations operations. @@ -44,14 +83,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Job" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Job": """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. @@ -72,28 +111,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -107,4 +136,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_nodes_operations.py index 5e672337610e..cd1bd6d2789f 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_nodes_operations.py @@ -5,23 +5,60 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/nodes') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class NodesOperations(object): """NodesOperations operations. @@ -45,13 +82,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.NodeList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.NodeList"]: """Gets all the nodes currently configured under this Data Box Edge device. :param device_name: The device name. @@ -60,7 +97,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either NodeList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.NodeList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.NodeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeList"] @@ -68,36 +106,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('NodeList', pipeline_response) + deserialized = self._deserialize("NodeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,6 +150,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_operations.py index 75fddac15261..d7274c5ac51f 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.DataBoxEdge/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,18 +72,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationsList"] + **kwargs: Any + ) -> Iterable["_models.OperationsList"]: """List all the supported operations. List all the supported operations. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationsList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.OperationsList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.OperationsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationsList"] @@ -64,30 +92,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationsList', pipeline_response) + deserialized = self._deserialize("OperationsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -105,6 +130,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_operations_status_operations.py index b0b1a13be6d9..57b49d1d11ad 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_operations_status_operations.py @@ -5,22 +5,61 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/operationsStatus/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class OperationsStatusOperations(object): """OperationsStatusOperations operations. @@ -44,14 +83,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Job" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Job": """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. @@ -72,28 +111,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -107,4 +136,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/operationsStatus/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_orders_operations.py index 367baeaac122..90dea2e1ca5f 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_orders_operations.py @@ -5,25 +5,177 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class OrdersOperations(object): """OrdersOperations operations. @@ -47,13 +199,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OrderList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.OrderList"]: """Lists all the orders related to a Data Box Edge/Data Box Gateway device. Lists all the orders related to a Data Box Edge/Data Box Gateway device. @@ -64,7 +216,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OrderList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.OrderList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.OrderList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OrderList"] @@ -72,36 +225,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OrderList', pipeline_response) + deserialized = self._deserialize("OrderList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,18 +269,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Order" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Order": """Gets a specific order by name. Gets a specific order by name. @@ -149,27 +300,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,47 +324,38 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - resource_group_name, # type: str - order, # type: "_models.Order" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Order"] + device_name: str, + resource_group_name: str, + order: "_models.Order", + **kwargs: Any + ) -> Optional["_models.Order"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Order"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(order, 'Order') + + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(order, 'Order') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,16 +371,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - resource_group_name, # type: str - order, # type: "_models.Order" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Order"] + device_name: str, + resource_group_name: str, + order: "_models.Order", + **kwargs: Any + ) -> LROPoller["_models.Order"]: """Creates or updates an order. Creates or updates an order. @@ -261,15 +395,18 @@ def begin_create_or_update( :type order: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.Order :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Order or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.Order] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Order"] lro_delay = kwargs.pop( 'polling_interval', @@ -281,27 +418,21 @@ def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, order=order, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Order', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -313,41 +444,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore def _delete_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -360,13 +481,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the order related to the device. Deletes the order related to the device. @@ -377,15 +499,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -399,21 +523,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -425,4 +542,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_roles_operations.py index 8b933caa218d..e69375514350 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_roles_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class RolesOperations(object): """RolesOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RoleList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.RoleList"]: """Lists all the roles configured in a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -62,7 +220,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RoleList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.RoleList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.RoleList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleList"] @@ -70,36 +229,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RoleList', pipeline_response) + deserialized = self._deserialize("RoleList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,19 +273,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Role" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Role": """Gets a specific role by name. :param device_name: The device name. @@ -148,28 +305,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,49 +330,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - role, # type: "_models.Role" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Role"] + device_name: str, + name: str, + resource_group_name: str, + role: "_models.Role", + **kwargs: Any + ) -> Optional["_models.Role"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Role"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(role, 'Role') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(role, 'Role') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -241,17 +379,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - role, # type: "_models.Role" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Role"] + device_name: str, + name: str, + resource_group_name: str, + role: "_models.Role", + **kwargs: Any + ) -> LROPoller["_models.Role"]: """Create or update a role. :param device_name: The device name. @@ -264,15 +404,18 @@ def begin_create_or_update( :type role: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.Role :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Role or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.Role] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Role"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +428,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, role=role, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Role', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -318,43 +454,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -367,14 +493,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the role on the device. :param device_name: The device name. @@ -385,15 +512,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -408,22 +537,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -435,4 +556,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_shares_operations.py index 3a44b369eb61..05df1e78653c 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_shares_operations.py @@ -5,25 +5,220 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_refresh_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SharesOperations(object): """SharesOperations operations. @@ -47,13 +242,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ShareList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ShareList"]: """Lists all the shares in a Data Box Edge/Data Box Gateway device. Lists all the shares in a Data Box Edge/Data Box Gateway device. @@ -64,7 +259,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ShareList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.ShareList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.ShareList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ShareList"] @@ -72,36 +268,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ShareList', pipeline_response) + deserialized = self._deserialize("ShareList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +312,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Share" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Share": """Gets a share by name. Gets a share by name. @@ -152,28 +346,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -187,49 +371,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - share, # type: "_models.Share" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Share"] + device_name: str, + name: str, + resource_group_name: str, + share: "_models.Share", + **kwargs: Any + ) -> Optional["_models.Share"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Share"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(share, 'Share') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(share, 'Share') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,17 +420,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - share, # type: "_models.Share" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Share"] + device_name: str, + name: str, + resource_group_name: str, + share: "_models.Share", + **kwargs: Any + ) -> LROPoller["_models.Share"]: """Creates a new share or updates an existing share on the device. Creates a new share or updates an existing share on the device. @@ -270,15 +447,18 @@ def begin_create_or_update( :type share: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.Share :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Share or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.Share] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Share"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +471,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, share=share, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Share', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -324,43 +497,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,14 +536,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the share on the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -391,15 +555,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -414,22 +580,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -441,43 +599,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore def _refresh_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -490,14 +638,15 @@ def _refresh_initial( _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore + + @distributed_trace def begin_refresh( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Refreshes the share metadata with the data from the cloud. Refreshes the share metadata with the data from the cloud. @@ -510,15 +659,17 @@ def begin_refresh( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -533,22 +684,14 @@ def begin_refresh( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -560,4 +703,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_skus_operations.py index ccd712a63908..3c04d6bdfd35 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_skus_operations.py @@ -5,23 +5,60 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/skus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SkusOperations(object): """SkusOperations operations. @@ -45,12 +82,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SkuInformationList"] + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.SkuInformationList"]: """List all the available Skus in the region and information related to them. List all the available Skus in the region and information related to them. @@ -59,7 +96,8 @@ def list( :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SkuInformationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.SkuInformationList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.SkuInformationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SkuInformationList"] @@ -67,36 +105,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SkuInformationList', pipeline_response) + deserialized = self._deserialize("SkuInformationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,6 +147,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_storage_account_credentials_operations.py index 1e20a36ee799..fc404caa54a2 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_storage_account_credentials_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class StorageAccountCredentialsOperations(object): """StorageAccountCredentialsOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountCredentialList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountCredentialList"]: """Gets all the storage account credentials in a Data Box Edge/Data Box Gateway device. Gets all the storage account credentials in a Data Box Edge/Data Box Gateway device. @@ -63,8 +221,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountCredentialList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.StorageAccountCredentialList] + :return: An iterator like instance of either StorageAccountCredentialList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.StorageAccountCredentialList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredentialList"] @@ -72,36 +232,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('StorageAccountCredentialList', pipeline_response) + deserialized = self._deserialize("StorageAccountCredentialList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +276,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountCredential" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.StorageAccountCredential": """Gets the properties of the specified storage account credential. :param device_name: The device name. @@ -150,28 +308,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,49 +333,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - storage_account_credential, # type: "_models.StorageAccountCredential" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageAccountCredential"] + device_name: str, + name: str, + resource_group_name: str, + storage_account_credential: "_models.StorageAccountCredential", + **kwargs: Any + ) -> Optional["_models.StorageAccountCredential"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccountCredential"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(storage_account_credential, 'StorageAccountCredential') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_account_credential, 'StorageAccountCredential') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -243,17 +382,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - storage_account_credential, # type: "_models.StorageAccountCredential" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageAccountCredential"] + device_name: str, + name: str, + resource_group_name: str, + storage_account_credential: "_models.StorageAccountCredential", + **kwargs: Any + ) -> LROPoller["_models.StorageAccountCredential"]: """Creates or updates the storage account credential. :param device_name: The device name. @@ -263,18 +404,24 @@ def begin_create_or_update( :param resource_group_name: The resource group name. :type resource_group_name: str :param storage_account_credential: The storage account credential. - :type storage_account_credential: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.StorageAccountCredential + :type storage_account_credential: + ~azure.mgmt.databoxedge.v2020_05_01_preview.models.StorageAccountCredential :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either StorageAccountCredential or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.StorageAccountCredential] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either StorageAccountCredential or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.StorageAccountCredential] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredential"] lro_delay = kwargs.pop( 'polling_interval', @@ -287,28 +434,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, storage_account_credential=storage_account_credential, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccountCredential', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -320,43 +460,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -369,14 +499,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the storage account credential. :param device_name: The device name. @@ -387,15 +518,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -410,22 +543,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -437,4 +562,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_storage_accounts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_storage_accounts_operations.py index 1c5a65220bb0..0a6c590039a0 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_storage_accounts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_storage_accounts_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + storage_account_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + storage_account_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + storage_account_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountList"]: """Lists all the storage accounts in a Data Box Edge/Data Box Gateway device. Lists all the storage accounts in a Data Box Edge/Data Box Gateway device. @@ -64,7 +222,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either StorageAccountList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.StorageAccountList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.StorageAccountList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountList"] @@ -72,36 +231,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('StorageAccountList', pipeline_response) + deserialized = self._deserialize("StorageAccountList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +275,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.StorageAccount": """Gets a StorageAccount by name. Gets a StorageAccount by name. @@ -152,28 +309,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -187,49 +334,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - storage_account, # type: "_models.StorageAccount" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageAccount"] + device_name: str, + storage_account_name: str, + resource_group_name: str, + storage_account: "_models.StorageAccount", + **kwargs: Any + ) -> Optional["_models.StorageAccount"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(storage_account, 'StorageAccount') + + request = build_create_or_update_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_account, 'StorageAccount') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,17 +383,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - storage_account, # type: "_models.StorageAccount" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageAccount"] + device_name: str, + storage_account_name: str, + resource_group_name: str, + storage_account: "_models.StorageAccount", + **kwargs: Any + ) -> LROPoller["_models.StorageAccount"]: """Creates a new StorageAccount or updates an existing StorageAccount on the device. Creates a new StorageAccount or updates an existing StorageAccount on the device. @@ -270,15 +410,20 @@ def begin_create_or_update( :type storage_account: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.StorageAccount :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either StorageAccount or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +436,21 @@ def begin_create_or_update( storage_account_name=storage_account_name, resource_group_name=resource_group_name, storage_account=storage_account, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -324,43 +462,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore def _delete_initial( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,14 +501,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the StorageAccount on the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -391,15 +520,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -414,22 +545,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -441,4 +564,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_triggers_operations.py index 52c027b9dae5..c9d8afed9681 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_triggers_operations.py @@ -5,25 +5,187 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class TriggersOperations(object): """TriggersOperations operations. @@ -47,14 +209,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.TriggerList"] + device_name: str, + resource_group_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.TriggerList"]: """Lists all the triggers configured in the device. :param device_name: The device name. @@ -66,7 +228,8 @@ def list_by_data_box_edge_device( :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TriggerList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.TriggerList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.TriggerList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TriggerList"] @@ -74,38 +237,35 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TriggerList', pipeline_response) + deserialized = self._deserialize("TriggerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -123,19 +283,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Trigger" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Trigger": """Get a specific trigger by name. :param device_name: The device name. @@ -154,28 +315,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -189,49 +340,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - trigger, # type: "_models.Trigger" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Trigger"] + device_name: str, + name: str, + resource_group_name: str, + trigger: "_models.Trigger", + **kwargs: Any + ) -> Optional["_models.Trigger"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Trigger"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(trigger, 'Trigger') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(trigger, 'Trigger') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,17 +389,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - trigger, # type: "_models.Trigger" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Trigger"] + device_name: str, + name: str, + resource_group_name: str, + trigger: "_models.Trigger", + **kwargs: Any + ) -> LROPoller["_models.Trigger"]: """Creates or updates a trigger. :param device_name: Creates or updates a trigger. @@ -270,15 +414,19 @@ def begin_create_or_update( :type trigger: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.Trigger :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Trigger or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.Trigger] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.Trigger] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Trigger"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +439,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, trigger=trigger, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Trigger', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -324,43 +465,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,14 +504,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the trigger on the gateway device. :param device_name: The device name. @@ -391,15 +523,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -414,22 +548,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -441,4 +567,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_users_operations.py index ab9302f39c18..44292a3cb792 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_users_operations.py @@ -5,25 +5,187 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class UsersOperations(object): """UsersOperations operations. @@ -47,14 +209,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UserList"] + device_name: str, + resource_group_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.UserList"]: """Gets all the users registered on a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -65,7 +227,8 @@ def list_by_data_box_edge_device( :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.UserList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_05_01_preview.models.UserList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UserList"] @@ -73,38 +236,35 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('UserList', pipeline_response) + deserialized = self._deserialize("UserList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -122,19 +282,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.User" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.User": """Gets the properties of the specified user. :param device_name: The device name. @@ -153,28 +314,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -188,49 +339,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - user, # type: "_models.User" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.User"] + device_name: str, + name: str, + resource_group_name: str, + user: "_models.User", + **kwargs: Any + ) -> Optional["_models.User"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.User"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(user, 'User') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(user, 'User') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -246,17 +388,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - user, # type: "_models.User" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.User"] + device_name: str, + name: str, + resource_group_name: str, + user: "_models.User", + **kwargs: Any + ) -> LROPoller["_models.User"]: """Creates a new user or updates an existing user's information on a Data Box Edge/Data Box Gateway device. @@ -270,15 +414,18 @@ def begin_create_or_update( :type user: ~azure.mgmt.databoxedge.v2020_05_01_preview.models.User :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either User or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_05_01_preview.models.User] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.User"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +438,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, user=user, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('User', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -324,43 +464,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,14 +503,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the user on a databox edge/gateway device. :param device_name: The device name. @@ -391,15 +522,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -414,22 +547,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -441,4 +566,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/__init__.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/__init__.py index e63196b6b98f..577ebf317c02 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/__init__.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/__init__.py @@ -7,10 +7,12 @@ # -------------------------------------------------------------------------- from ._data_box_edge_management_client import DataBoxEdgeManagementClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['DataBoxEdgeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_configuration.py index a5b47c318d7a..537eb0e27308 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_configuration.py @@ -6,19 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential -VERSION = "unknown" class DataBoxEdgeManagementClientConfiguration(Configuration): """Configuration for DataBoxEdgeManagementClient. @@ -34,16 +33,15 @@ class DataBoxEdgeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -67,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_data_box_edge_management_client.py index d17c09ae83c7..70454d7495e7 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_data_box_edge_management_client.py @@ -6,41 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import DataBoxEdgeManagementClientConfiguration +from .operations import AddonsOperations, AlertsOperations, AvailableSkusOperations, BandwidthSchedulesOperations, ContainersOperations, DevicesOperations, JobsOperations, MonitoringConfigOperations, NodesOperations, Operations, OperationsStatusOperations, OrdersOperations, RolesOperations, SharesOperations, StorageAccountCredentialsOperations, StorageAccountsOperations, TriggersOperations, UsersOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import DataBoxEdgeManagementClientConfiguration -from .operations import Operations -from .operations import AvailableSkusOperations -from .operations import DevicesOperations -from .operations import AlertsOperations -from .operations import BandwidthSchedulesOperations -from .operations import JobsOperations -from .operations import NodesOperations -from .operations import OperationsStatusOperations -from .operations import OrdersOperations -from .operations import RolesOperations -from .operations import AddonsOperations -from .operations import MonitoringConfigOperations -from .operations import SharesOperations -from .operations import StorageAccountCredentialsOperations -from .operations import StorageAccountsOperations -from .operations import ContainersOperations -from .operations import TriggersOperations -from .operations import UsersOperations -from . import models - -class DataBoxEdgeManagementClient(object): +class DataBoxEdgeManagementClient: """The DataBoxEdge Client. :ivar operations: Operations operations @@ -52,13 +33,15 @@ class DataBoxEdgeManagementClient(object): :ivar alerts: AlertsOperations operations :vartype alerts: azure.mgmt.databoxedge.v2020_09_01.operations.AlertsOperations :ivar bandwidth_schedules: BandwidthSchedulesOperations operations - :vartype bandwidth_schedules: azure.mgmt.databoxedge.v2020_09_01.operations.BandwidthSchedulesOperations + :vartype bandwidth_schedules: + azure.mgmt.databoxedge.v2020_09_01.operations.BandwidthSchedulesOperations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.databoxedge.v2020_09_01.operations.JobsOperations :ivar nodes: NodesOperations operations :vartype nodes: azure.mgmt.databoxedge.v2020_09_01.operations.NodesOperations :ivar operations_status: OperationsStatusOperations operations - :vartype operations_status: azure.mgmt.databoxedge.v2020_09_01.operations.OperationsStatusOperations + :vartype operations_status: + azure.mgmt.databoxedge.v2020_09_01.operations.OperationsStatusOperations :ivar orders: OrdersOperations operations :vartype orders: azure.mgmt.databoxedge.v2020_09_01.operations.OrdersOperations :ivar roles: RolesOperations operations @@ -66,13 +49,16 @@ class DataBoxEdgeManagementClient(object): :ivar addons: AddonsOperations operations :vartype addons: azure.mgmt.databoxedge.v2020_09_01.operations.AddonsOperations :ivar monitoring_config: MonitoringConfigOperations operations - :vartype monitoring_config: azure.mgmt.databoxedge.v2020_09_01.operations.MonitoringConfigOperations + :vartype monitoring_config: + azure.mgmt.databoxedge.v2020_09_01.operations.MonitoringConfigOperations :ivar shares: SharesOperations operations :vartype shares: azure.mgmt.databoxedge.v2020_09_01.operations.SharesOperations :ivar storage_account_credentials: StorageAccountCredentialsOperations operations - :vartype storage_account_credentials: azure.mgmt.databoxedge.v2020_09_01.operations.StorageAccountCredentialsOperations + :vartype storage_account_credentials: + azure.mgmt.databoxedge.v2020_09_01.operations.StorageAccountCredentialsOperations :ivar storage_accounts: StorageAccountsOperations operations - :vartype storage_accounts: azure.mgmt.databoxedge.v2020_09_01.operations.StorageAccountsOperations + :vartype storage_accounts: + azure.mgmt.databoxedge.v2020_09_01.operations.StorageAccountsOperations :ivar containers: ContainersOperations operations :vartype containers: azure.mgmt.databoxedge.v2020_09_01.operations.ContainersOperations :ivar triggers: TriggersOperations operations @@ -83,82 +69,71 @@ class DataBoxEdgeManagementClient(object): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = DataBoxEdgeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = DataBoxEdgeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.available_skus = AvailableSkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.orders = OrdersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.addons = AddonsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.monitoring_config = MonitoringConfigOperations( - self._client, self._config, self._serialize, self._deserialize) - self.shares = SharesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.containers = ContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.available_skus = AvailableSkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bandwidth_schedules = BandwidthSchedulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations_status = OperationsStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) + self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize) + self.monitoring_config = MonitoringConfigOperations(self._client, self._config, self._serialize, self._deserialize) + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_account_credentials = StorageAccountCredentialsOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_metadata.json b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_metadata.json index 95fd599d3039..9d6dca79fe5b 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_metadata.json +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_metadata.json @@ -5,13 +5,13 @@ "name": "DataBoxEdgeManagementClient", "filename": "_data_box_edge_management_client", "description": "The DataBoxEdge Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "operations": "Operations", diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_patch.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_vendor.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_version.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/__init__.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/__init__.py index c33d46ee91d8..f33cac1fd9b0 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/__init__.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._data_box_edge_management_client import DataBoxEdgeManagementClient __all__ = ['DataBoxEdgeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/_configuration.py index ee8f3c8f4c5e..5268e7d39570 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/_configuration.py @@ -10,13 +10,14 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class DataBoxEdgeManagementClientConfiguration(Configuration): """Configuration for DataBoxEdgeManagementClient. @@ -36,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -63,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/_data_box_edge_management_client.py index dc7f95bad1ec..5f6d2df397e0 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/_data_box_edge_management_client.py @@ -6,57 +6,43 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import DataBoxEdgeManagementClientConfiguration +from .operations import AddonsOperations, AlertsOperations, AvailableSkusOperations, BandwidthSchedulesOperations, ContainersOperations, DevicesOperations, JobsOperations, MonitoringConfigOperations, NodesOperations, Operations, OperationsStatusOperations, OrdersOperations, RolesOperations, SharesOperations, StorageAccountCredentialsOperations, StorageAccountsOperations, TriggersOperations, UsersOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import DataBoxEdgeManagementClientConfiguration -from .operations import Operations -from .operations import AvailableSkusOperations -from .operations import DevicesOperations -from .operations import AlertsOperations -from .operations import BandwidthSchedulesOperations -from .operations import JobsOperations -from .operations import NodesOperations -from .operations import OperationsStatusOperations -from .operations import OrdersOperations -from .operations import RolesOperations -from .operations import AddonsOperations -from .operations import MonitoringConfigOperations -from .operations import SharesOperations -from .operations import StorageAccountCredentialsOperations -from .operations import StorageAccountsOperations -from .operations import ContainersOperations -from .operations import TriggersOperations -from .operations import UsersOperations -from .. import models - - -class DataBoxEdgeManagementClient(object): +class DataBoxEdgeManagementClient: """The DataBoxEdge Client. :ivar operations: Operations operations :vartype operations: azure.mgmt.databoxedge.v2020_09_01.aio.operations.Operations :ivar available_skus: AvailableSkusOperations operations - :vartype available_skus: azure.mgmt.databoxedge.v2020_09_01.aio.operations.AvailableSkusOperations + :vartype available_skus: + azure.mgmt.databoxedge.v2020_09_01.aio.operations.AvailableSkusOperations :ivar devices: DevicesOperations operations :vartype devices: azure.mgmt.databoxedge.v2020_09_01.aio.operations.DevicesOperations :ivar alerts: AlertsOperations operations :vartype alerts: azure.mgmt.databoxedge.v2020_09_01.aio.operations.AlertsOperations :ivar bandwidth_schedules: BandwidthSchedulesOperations operations - :vartype bandwidth_schedules: azure.mgmt.databoxedge.v2020_09_01.aio.operations.BandwidthSchedulesOperations + :vartype bandwidth_schedules: + azure.mgmt.databoxedge.v2020_09_01.aio.operations.BandwidthSchedulesOperations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.databoxedge.v2020_09_01.aio.operations.JobsOperations :ivar nodes: NodesOperations operations :vartype nodes: azure.mgmt.databoxedge.v2020_09_01.aio.operations.NodesOperations :ivar operations_status: OperationsStatusOperations operations - :vartype operations_status: azure.mgmt.databoxedge.v2020_09_01.aio.operations.OperationsStatusOperations + :vartype operations_status: + azure.mgmt.databoxedge.v2020_09_01.aio.operations.OperationsStatusOperations :ivar orders: OrdersOperations operations :vartype orders: azure.mgmt.databoxedge.v2020_09_01.aio.operations.OrdersOperations :ivar roles: RolesOperations operations @@ -64,13 +50,16 @@ class DataBoxEdgeManagementClient(object): :ivar addons: AddonsOperations operations :vartype addons: azure.mgmt.databoxedge.v2020_09_01.aio.operations.AddonsOperations :ivar monitoring_config: MonitoringConfigOperations operations - :vartype monitoring_config: azure.mgmt.databoxedge.v2020_09_01.aio.operations.MonitoringConfigOperations + :vartype monitoring_config: + azure.mgmt.databoxedge.v2020_09_01.aio.operations.MonitoringConfigOperations :ivar shares: SharesOperations operations :vartype shares: azure.mgmt.databoxedge.v2020_09_01.aio.operations.SharesOperations :ivar storage_account_credentials: StorageAccountCredentialsOperations operations - :vartype storage_account_credentials: azure.mgmt.databoxedge.v2020_09_01.aio.operations.StorageAccountCredentialsOperations + :vartype storage_account_credentials: + azure.mgmt.databoxedge.v2020_09_01.aio.operations.StorageAccountCredentialsOperations :ivar storage_accounts: StorageAccountsOperations operations - :vartype storage_accounts: azure.mgmt.databoxedge.v2020_09_01.aio.operations.StorageAccountsOperations + :vartype storage_accounts: + azure.mgmt.databoxedge.v2020_09_01.aio.operations.StorageAccountsOperations :ivar containers: ContainersOperations operations :vartype containers: azure.mgmt.databoxedge.v2020_09_01.aio.operations.ContainersOperations :ivar triggers: TriggersOperations operations @@ -81,80 +70,71 @@ class DataBoxEdgeManagementClient(object): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = DataBoxEdgeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = DataBoxEdgeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.available_skus = AvailableSkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bandwidth_schedules = BandwidthSchedulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations_status = OperationsStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) + self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize) + self.monitoring_config = MonitoringConfigOperations(self._client, self._config, self._serialize, self._deserialize) + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_account_credentials = StorageAccountCredentialsOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) + - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.available_skus = AvailableSkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.orders = OrdersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.addons = AddonsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.monitoring_config = MonitoringConfigOperations( - self._client, self._config, self._serialize, self._deserialize) - self.shares = SharesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.containers = ContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/_patch.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_addons_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_addons_operations.py index e2da3a2ef7d4..21c1a8461584 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_addons_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_addons_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._addons_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_role_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_role( self, device_name: str, role_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.AddonList"]: """Lists all the addons configured in the role. @@ -60,7 +66,8 @@ def list_by_role( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AddonList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.AddonList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.AddonList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AddonList"] @@ -68,37 +75,35 @@ def list_by_role( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_role.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_role_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_role.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_role_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AddonList', pipeline_response) + deserialized = self._deserialize("AddonList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -116,18 +121,20 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_role.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, role_name: str, addon_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Addon": """Gets a specific addon by name. @@ -149,29 +156,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,8 +182,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, @@ -194,41 +193,31 @@ async def _create_or_update_initial( addon_name: str, resource_group_name: str, addon: "_models.Addon", - **kwargs + **kwargs: Any ) -> Optional["_models.Addon"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Addon"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(addon, 'Addon') + + request = build_create_or_update_request_initial( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(addon, 'Addon') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -244,8 +233,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, @@ -253,7 +245,7 @@ async def begin_create_or_update( addon_name: str, resource_group_name: str, addon: "_models.Addon", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Addon"]: """Create or update a addon. @@ -269,15 +261,18 @@ async def begin_create_or_update( :type addon: ~azure.mgmt.databoxedge.v2020_09_01.models.Addon :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Addon or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.Addon] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Addon"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,29 +286,21 @@ async def begin_create_or_update( addon_name=addon_name, resource_group_name=resource_group_name, addon=addon, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Addon', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -325,6 +312,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore async def _delete_initial( @@ -333,36 +321,26 @@ async def _delete_initial( role_name: str, addon_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -375,13 +353,15 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, role_name: str, addon_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the addon on the device. @@ -395,15 +375,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -419,23 +401,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -447,4 +420,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_alerts_operations.py index 5b134957aeda..110eeda51f7c 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_alerts_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._alerts_operations import build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,11 +46,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.AlertList"]: """Gets all the alerts for a Data Box Edge/Data Box Gateway device. @@ -55,7 +61,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AlertList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.AlertList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.AlertList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertList"] @@ -63,36 +70,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AlertList', pipeline_response) + deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,17 +114,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Alert": """Gets an alert by name. @@ -142,28 +148,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,4 +173,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_available_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_available_skus_operations.py index cb20cc6d9af5..49846e407709 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_available_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_available_skus_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._available_skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,9 +46,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.DataBoxEdgeSkuList"]: """List all the available Skus and information related to them. @@ -51,7 +57,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DataBoxEdgeSkuList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.DataBoxEdgeSkuList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.DataBoxEdgeSkuList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeSkuList"] @@ -59,34 +66,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeSkuList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeSkuList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -104,6 +106,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_bandwidth_schedules_operations.py index dd7b1aab3acf..f69868f2f486 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_bandwidth_schedules_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._bandwidth_schedules_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.BandwidthSchedulesList"]: """Gets all the bandwidth schedules for a Data Box Edge/Data Box Gateway device. @@ -56,8 +62,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BandwidthSchedulesList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.BandwidthSchedulesList] + :return: An iterator like instance of either BandwidthSchedulesList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.BandwidthSchedulesList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedulesList"] @@ -65,36 +73,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BandwidthSchedulesList', pipeline_response) + deserialized = self._deserialize("BandwidthSchedulesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,17 +117,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.BandwidthSchedule": """Gets the properties of the specified bandwidth schedule. @@ -142,28 +149,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,48 +174,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, parameters: "_models.BandwidthSchedule", - **kwargs + **kwargs: Any ) -> Optional["_models.BandwidthSchedule"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BandwidthSchedule"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BandwidthSchedule') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BandwidthSchedule') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -234,15 +223,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, parameters: "_models.BandwidthSchedule", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.BandwidthSchedule"]: """Creates or updates a bandwidth schedule. @@ -256,15 +248,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.databoxedge.v2020_09_01.models.BandwidthSchedule :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BandwidthSchedule or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.BandwidthSchedule] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BandwidthSchedule or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.BandwidthSchedule] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedule"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,28 +274,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BandwidthSchedule', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -310,6 +300,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore async def _delete_initial( @@ -317,35 +308,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -358,12 +339,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the specified bandwidth schedule. @@ -375,15 +358,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -398,22 +383,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -425,4 +402,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_containers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_containers_operations.py index a1cc1ba15971..4e2acb299bed 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_containers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_containers_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._containers_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_storage_account_request, build_refresh_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_storage_account( self, device_name: str, storage_account_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ContainerList"]: """Lists all the containers of a storage Account in a Data Box Edge/Data Box Gateway device. @@ -62,7 +68,8 @@ def list_by_storage_account( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ContainerList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.ContainerList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.ContainerList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerList"] @@ -70,37 +77,35 @@ def list_by_storage_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_storage_account.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_account_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_storage_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_account_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ContainerList', pipeline_response) + deserialized = self._deserialize("ContainerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,18 +123,20 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_storage_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, storage_account_name: str, container_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Container": """Gets a container by name. @@ -153,29 +160,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -189,8 +186,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, @@ -198,41 +197,31 @@ async def _create_or_update_initial( container_name: str, resource_group_name: str, container: "_models.Container", - **kwargs + **kwargs: Any ) -> Optional["_models.Container"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Container"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(container, 'Container') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(container, 'Container') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -248,8 +237,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, @@ -257,7 +249,7 @@ async def begin_create_or_update( container_name: str, resource_group_name: str, container: "_models.Container", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Container"]: """Creates a new container or updates an existing container on the device. @@ -275,15 +267,20 @@ async def begin_create_or_update( :type container: ~azure.mgmt.databoxedge.v2020_09_01.models.Container :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Container or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.Container] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Container or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.Container] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Container"] lro_delay = kwargs.pop( 'polling_interval', @@ -297,29 +294,21 @@ async def begin_create_or_update( container_name=container_name, resource_group_name=resource_group_name, container=container, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Container', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -331,6 +320,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore async def _delete_initial( @@ -339,36 +329,26 @@ async def _delete_initial( storage_account_name: str, container_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -381,13 +361,15 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, storage_account_name: str, container_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the container on the Data Box Edge/Data Box Gateway device. @@ -401,15 +383,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -425,23 +409,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -453,6 +428,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore async def _refresh_initial( @@ -461,36 +437,26 @@ async def _refresh_initial( storage_account_name: str, container_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -503,13 +469,15 @@ async def _refresh_initial( _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh'} # type: ignore + + @distributed_trace_async async def begin_refresh( self, device_name: str, storage_account_name: str, container_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Refreshes the container metadata with the data from the cloud. @@ -525,15 +493,17 @@ async def begin_refresh( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -549,23 +519,14 @@ async def begin_refresh( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -577,4 +538,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_devices_operations.py index a57be9277501..ffdbb06c7650 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_devices_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._devices_operations import build_create_or_update_request_initial, build_create_or_update_security_settings_request_initial, build_delete_request_initial, build_download_updates_request_initial, build_generate_certificate_request, build_get_extended_information_request, build_get_network_settings_request, build_get_request, build_get_update_summary_request, build_install_updates_request_initial, build_list_by_resource_group_request, build_list_by_subscription_request, build_scan_for_updates_request_initial, build_update_extended_information_request, build_update_request, build_upload_certificate_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,10 +48,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, expand: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.DataBoxEdgeDeviceList"]: """Gets all the Data Box Edge/Data Box Gateway devices in a subscription. @@ -54,8 +60,10 @@ def list_by_subscription( Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -63,36 +71,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,16 +113,18 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, expand: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.DataBoxEdgeDeviceList"]: """Gets all the Data Box Edge/Data Box Gateway devices in a resource group. @@ -129,8 +134,10 @@ def list_by_resource_group( Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -138,37 +145,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -186,16 +189,18 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDevice": """Gets the properties of the Data Box Edge/Data Box Gateway device. @@ -213,27 +218,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,46 +242,38 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, resource_group_name: str, data_box_edge_device: "_models.DataBoxEdgeDevice", - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDevice": cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') + + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -300,14 +287,17 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, resource_group_name: str, data_box_edge_device: "_models.DataBoxEdgeDevice", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.DataBoxEdgeDevice"]: """Creates or updates a Data Box Edge/Data Box Gateway resource. @@ -319,15 +309,20 @@ async def begin_create_or_update( :type data_box_edge_device: ~azure.mgmt.databoxedge.v2020_09_01.models.DataBoxEdgeDevice :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DataBoxEdgeDevice or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.DataBoxEdgeDevice] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DataBoxEdgeDevice or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.DataBoxEdgeDevice] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] lro_delay = kwargs.pop( 'polling_interval', @@ -339,27 +334,21 @@ async def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, data_box_edge_device=data_box_edge_device, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DataBoxEdgeDevice', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -371,40 +360,31 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore async def _delete_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -417,11 +397,13 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the Data Box Edge/Data Box Gateway device. @@ -431,15 +413,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -453,21 +437,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -479,14 +456,16 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + @distributed_trace_async async def update( self, device_name: str, resource_group_name: str, parameters: "_models.DataBoxEdgeDevicePatch", - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDevice": """Modifies a Data Box Edge/Data Box Gateway resource. @@ -506,32 +485,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -545,40 +514,32 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + async def _download_updates_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._download_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_download_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._download_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -591,11 +552,13 @@ async def _download_updates_initial( _download_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + + @distributed_trace_async async def begin_download_updates( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Downloads the updates on a Data Box Edge/Data Box Gateway device. @@ -607,15 +570,17 @@ async def begin_download_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -629,21 +594,14 @@ async def begin_download_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -655,13 +613,15 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_download_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + @distributed_trace_async async def generate_certificate( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.GenerateCertResponse": """Generates certificate for activation key. @@ -679,27 +639,17 @@ async def generate_certificate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.generate_certificate.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_generate_certificate_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.generate_certificate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -713,13 +663,16 @@ async def generate_certificate( return cls(pipeline_response, deserialized, {}) return deserialized + generate_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/generateCertificate'} # type: ignore + + @distributed_trace_async async def get_extended_information( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDeviceExtendedInfo": """Gets additional information for the specified Azure Stack Edge/Data Box Gateway device. @@ -737,27 +690,17 @@ async def get_extended_information( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get_extended_information.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_extended_information_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_extended_information.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -771,40 +714,32 @@ async def get_extended_information( return cls(pipeline_response, deserialized, {}) return deserialized + get_extended_information.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation'} # type: ignore + async def _install_updates_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._install_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_install_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._install_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -817,11 +752,13 @@ async def _install_updates_initial( _install_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + + @distributed_trace_async async def begin_install_updates( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Installs the updates on the Data Box Edge/Data Box Gateway device. @@ -833,15 +770,17 @@ async def begin_install_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -855,21 +794,14 @@ async def begin_install_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -881,13 +813,15 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_install_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + @distributed_trace_async async def get_network_settings( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.NetworkSettings": """Gets the network settings of the specified Data Box Edge/Data Box Gateway device. @@ -905,27 +839,17 @@ async def get_network_settings( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get_network_settings.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_network_settings_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_network_settings.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -939,40 +863,32 @@ async def get_network_settings( return cls(pipeline_response, deserialized, {}) return deserialized + get_network_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/networkSettings/default'} # type: ignore + async def _scan_for_updates_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._scan_for_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_scan_for_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._scan_for_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -985,11 +901,13 @@ async def _scan_for_updates_initial( _scan_for_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore + + @distributed_trace_async async def begin_scan_for_updates( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Scans for updates on a Data Box Edge/Data Box Gateway device. @@ -1001,15 +919,17 @@ async def begin_scan_for_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1023,21 +943,14 @@ async def begin_scan_for_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1049,6 +962,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_scan_for_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore async def _create_or_update_security_settings_initial( @@ -1056,39 +970,29 @@ async def _create_or_update_security_settings_initial( device_name: str, resource_group_name: str, security_settings: "_models.SecuritySettings", - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_security_settings_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(security_settings, 'SecuritySettings') + + request = build_create_or_update_security_settings_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_security_settings_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(security_settings, 'SecuritySettings') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1101,12 +1005,14 @@ async def _create_or_update_security_settings_initial( _create_or_update_security_settings_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + + @distributed_trace_async async def begin_create_or_update_security_settings( self, device_name: str, resource_group_name: str, security_settings: "_models.SecuritySettings", - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Updates the security settings on a Data Box Edge/Data Box Gateway device. @@ -1118,15 +1024,18 @@ async def begin_create_or_update_security_settings( :type security_settings: ~azure.mgmt.databoxedge.v2020_09_01.models.SecuritySettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1138,24 +1047,18 @@ async def begin_create_or_update_security_settings( device_name=device_name, resource_group_name=resource_group_name, security_settings=security_settings, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1167,14 +1070,16 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_security_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + @distributed_trace_async async def update_extended_information( self, device_name: str, resource_group_name: str, parameters: "_models.DataBoxEdgeDeviceExtendedInfoPatch", - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDeviceExtendedInfo": """Gets additional information for the specified Data Box Edge/Data Box Gateway device. @@ -1194,32 +1099,22 @@ async def update_extended_information( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update_extended_information.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'DataBoxEdgeDeviceExtendedInfoPatch') + + request = build_update_extended_information_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.update_extended_information.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataBoxEdgeDeviceExtendedInfoPatch') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1233,15 +1128,19 @@ async def update_extended_information( return cls(pipeline_response, deserialized, {}) return deserialized + update_extended_information.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateExtendedInformation'} # type: ignore + + @distributed_trace_async async def get_update_summary( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.UpdateSummary": - """Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. + """Gets information about the availability of updates based on the last scan of the device. It + also gets information about any ongoing download or install jobs on the device. Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. @@ -1260,27 +1159,17 @@ async def get_update_summary( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get_update_summary.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_update_summary_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_update_summary.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1294,14 +1183,17 @@ async def get_update_summary( return cls(pipeline_response, deserialized, {}) return deserialized + get_update_summary.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default'} # type: ignore + + @distributed_trace_async async def upload_certificate( self, device_name: str, resource_group_name: str, parameters: "_models.UploadCertificateRequest", - **kwargs + **kwargs: Any ) -> "_models.UploadCertificateResponse": """Uploads registration certificate for the device. @@ -1321,32 +1213,22 @@ async def upload_certificate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.upload_certificate.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'UploadCertificateRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_upload_certificate_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.upload_certificate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'UploadCertificateRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1360,4 +1242,6 @@ async def upload_certificate( return cls(pipeline_response, deserialized, {}) return deserialized + upload_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/uploadCertificate'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_jobs_operations.py index 11ea6d59f07a..8092bf9395c0 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_jobs_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._jobs_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,12 +44,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Job": """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. @@ -67,28 +72,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -102,4 +97,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_monitoring_config_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_monitoring_config_operations.py index af835149a368..f94aa24a3348 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_monitoring_config_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_monitoring_config_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._monitoring_config_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, device_name: str, role_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.MonitoringMetricConfigurationList"]: """Lists metric configurations in a role. @@ -61,8 +67,10 @@ def list( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MonitoringMetricConfigurationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.MonitoringMetricConfigurationList] + :return: An iterator like instance of either MonitoringMetricConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.MonitoringMetricConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringMetricConfigurationList"] @@ -70,37 +78,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('MonitoringMetricConfigurationList', pipeline_response) + deserialized = self._deserialize("MonitoringMetricConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,17 +124,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, role_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.MonitoringMetricConfiguration": """Gets a metric configuration of a role. @@ -150,28 +158,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,48 +183,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + async def _create_or_update_initial( self, device_name: str, role_name: str, resource_group_name: str, monitoring_metric_configuration: "_models.MonitoringMetricConfiguration", - **kwargs + **kwargs: Any ) -> Optional["_models.MonitoringMetricConfiguration"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MonitoringMetricConfiguration"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(monitoring_metric_configuration, 'MonitoringMetricConfiguration') + + request = build_create_or_update_request_initial( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(monitoring_metric_configuration, 'MonitoringMetricConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -242,15 +232,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, role_name: str, resource_group_name: str, monitoring_metric_configuration: "_models.MonitoringMetricConfiguration", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.MonitoringMetricConfiguration"]: """Creates a new metric configuration or updates an existing one for a role. @@ -263,18 +256,24 @@ async def begin_create_or_update( :param resource_group_name: The resource group name. :type resource_group_name: str :param monitoring_metric_configuration: The metric configuration. - :type monitoring_metric_configuration: ~azure.mgmt.databoxedge.v2020_09_01.models.MonitoringMetricConfiguration + :type monitoring_metric_configuration: + ~azure.mgmt.databoxedge.v2020_09_01.models.MonitoringMetricConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MonitoringMetricConfiguration or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.MonitoringMetricConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringMetricConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.MonitoringMetricConfiguration] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringMetricConfiguration"] lro_delay = kwargs.pop( 'polling_interval', @@ -287,28 +286,21 @@ async def begin_create_or_update( role_name=role_name, resource_group_name=resource_group_name, monitoring_metric_configuration=monitoring_metric_configuration, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MonitoringMetricConfiguration', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -320,6 +312,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore async def _delete_initial( @@ -327,35 +320,25 @@ async def _delete_initial( device_name: str, role_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -368,12 +351,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, role_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """deletes a new metric configuration for a role. @@ -387,15 +372,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -410,22 +397,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -437,4 +416,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_nodes_operations.py index 951e1d5c4232..efb4983cd590 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_nodes_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._nodes_operations import build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,11 +46,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.NodeList"]: """Gets all the nodes currently configured under this Data Box Edge device. @@ -55,7 +61,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either NodeList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.NodeList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.NodeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeList"] @@ -63,36 +70,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('NodeList', pipeline_response) + deserialized = self._deserialize("NodeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,6 +114,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_operations.py index 105241694868..0fb49896b03d 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,9 +46,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OperationsList"]: """List all the supported operations. @@ -51,7 +57,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.OperationsList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.OperationsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationsList"] @@ -59,30 +66,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationsList', pipeline_response) + deserialized = self._deserialize("OperationsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -100,6 +104,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_operations_status_operations.py index 1e807137bab8..4edec0b42fde 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_operations_status_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations_status_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,12 +44,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Job": """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. @@ -67,28 +72,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -102,4 +97,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/operationsStatus/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_orders_operations.py index 220286ce394f..a417cb86aa55 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_orders_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._orders_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request, build_list_dc_access_code_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OrderList"]: """Lists all the orders related to a Data Box Edge/Data Box Gateway device. @@ -59,7 +65,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OrderList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.OrderList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.OrderList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OrderList"] @@ -67,36 +74,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OrderList', pipeline_response) + deserialized = self._deserialize("OrderList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,16 +118,18 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Order": """Gets a specific order by name. @@ -143,27 +149,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,46 +173,38 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + async def _create_or_update_initial( self, device_name: str, resource_group_name: str, order: "_models.Order", - **kwargs + **kwargs: Any ) -> Optional["_models.Order"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Order"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(order, 'Order') + + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(order, 'Order') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -232,14 +220,17 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, resource_group_name: str, order: "_models.Order", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Order"]: """Creates or updates an order. @@ -253,15 +244,18 @@ async def begin_create_or_update( :type order: ~azure.mgmt.databoxedge.v2020_09_01.models.Order :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Order or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.Order] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Order"] lro_delay = kwargs.pop( 'polling_interval', @@ -273,27 +267,21 @@ async def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, order=order, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Order', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -305,40 +293,31 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore async def _delete_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -351,11 +330,13 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the order related to the device. @@ -367,15 +348,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -389,21 +372,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -415,13 +391,15 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + @distributed_trace_async async def list_dc_access_code( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.DCAccessCode": """Gets the DCAccess Code. @@ -441,27 +419,17 @@ async def list_dc_access_code( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.list_dc_access_code.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_dc_access_code_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_dc_access_code.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -475,4 +443,6 @@ async def list_dc_access_code( return cls(pipeline_response, deserialized, {}) return deserialized + list_dc_access_code.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default/listDCAccessCode'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_roles_operations.py index 1d06b52d0b3c..44c1f39eda15 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_roles_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._roles_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.RoleList"]: """Lists all the roles configured in a Data Box Edge/Data Box Gateway device. @@ -57,7 +63,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RoleList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.RoleList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.RoleList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleList"] @@ -65,36 +72,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RoleList', pipeline_response) + deserialized = self._deserialize("RoleList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,17 +116,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Role": """Gets a specific role by name. @@ -142,28 +148,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,48 +173,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, role: "_models.Role", - **kwargs + **kwargs: Any ) -> Optional["_models.Role"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Role"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(role, 'Role') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(role, 'Role') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -234,15 +222,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, role: "_models.Role", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Role"]: """Create or update a role. @@ -256,15 +247,18 @@ async def begin_create_or_update( :type role: ~azure.mgmt.databoxedge.v2020_09_01.models.Role :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Role or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.Role] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Role"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,28 +271,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, role=role, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Role', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -310,6 +297,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore async def _delete_initial( @@ -317,35 +305,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -358,12 +336,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the role on the device. @@ -375,15 +355,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -398,22 +380,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -425,4 +399,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_shares_operations.py index 246846443d64..33ac9304162c 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_shares_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._shares_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request, build_refresh_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ShareList"]: """Lists all the shares in a Data Box Edge/Data Box Gateway device. @@ -59,7 +65,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ShareList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.ShareList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.ShareList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ShareList"] @@ -67,36 +74,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ShareList', pipeline_response) + deserialized = self._deserialize("ShareList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,17 +118,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Share": """Gets a share by name. @@ -146,28 +152,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -181,48 +177,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, share: "_models.Share", - **kwargs + **kwargs: Any ) -> Optional["_models.Share"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Share"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(share, 'Share') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(share, 'Share') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -238,15 +226,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, share: "_models.Share", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Share"]: """Creates a new share or updates an existing share on the device. @@ -262,15 +253,18 @@ async def begin_create_or_update( :type share: ~azure.mgmt.databoxedge.v2020_09_01.models.Share :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Share or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.Share] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Share"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,28 +277,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, share=share, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Share', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -316,6 +303,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore async def _delete_initial( @@ -323,35 +311,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,12 +342,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the share on the Data Box Edge/Data Box Gateway device. @@ -381,15 +361,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -404,22 +386,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -431,6 +405,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore async def _refresh_initial( @@ -438,35 +413,25 @@ async def _refresh_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -479,12 +444,14 @@ async def _refresh_initial( _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore + + @distributed_trace_async async def begin_refresh( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Refreshes the share metadata with the data from the cloud. @@ -498,15 +465,17 @@ async def begin_refresh( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -521,22 +490,14 @@ async def begin_refresh( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -548,4 +509,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_storage_account_credentials_operations.py index 9c11230abb8d..744f569d3774 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_storage_account_credentials_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._storage_account_credentials_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.StorageAccountCredentialList"]: """Gets all the storage account credentials in a Data Box Edge/Data Box Gateway device. @@ -58,8 +64,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountCredentialList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.StorageAccountCredentialList] + :return: An iterator like instance of either StorageAccountCredentialList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.StorageAccountCredentialList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredentialList"] @@ -67,36 +75,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('StorageAccountCredentialList', pipeline_response) + deserialized = self._deserialize("StorageAccountCredentialList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,17 +119,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.StorageAccountCredential": """Gets the properties of the specified storage account credential. @@ -144,28 +151,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -179,48 +176,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, storage_account_credential: "_models.StorageAccountCredential", - **kwargs + **kwargs: Any ) -> Optional["_models.StorageAccountCredential"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccountCredential"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(storage_account_credential, 'StorageAccountCredential') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_account_credential, 'StorageAccountCredential') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -236,15 +225,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, storage_account_credential: "_models.StorageAccountCredential", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.StorageAccountCredential"]: """Creates or updates the storage account credential. @@ -255,18 +247,24 @@ async def begin_create_or_update( :param resource_group_name: The resource group name. :type resource_group_name: str :param storage_account_credential: The storage account credential. - :type storage_account_credential: ~azure.mgmt.databoxedge.v2020_09_01.models.StorageAccountCredential + :type storage_account_credential: + ~azure.mgmt.databoxedge.v2020_09_01.models.StorageAccountCredential :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either StorageAccountCredential or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.StorageAccountCredential] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageAccountCredential or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.StorageAccountCredential] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredential"] lro_delay = kwargs.pop( 'polling_interval', @@ -279,28 +277,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, storage_account_credential=storage_account_credential, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccountCredential', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -312,6 +303,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore async def _delete_initial( @@ -319,35 +311,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -360,12 +342,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the storage account credential. @@ -377,15 +361,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -400,22 +386,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -427,4 +405,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_storage_accounts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_storage_accounts_operations.py index 59b3bd05ec14..96e9d8251214 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_storage_accounts_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._storage_accounts_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.StorageAccountList"]: """Lists all the StorageAccounts in a Data Box Edge/Data Box Gateway device. @@ -59,7 +65,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either StorageAccountList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.StorageAccountList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.StorageAccountList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountList"] @@ -67,36 +74,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('StorageAccountList', pipeline_response) + deserialized = self._deserialize("StorageAccountList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,17 +118,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, storage_account_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.StorageAccount": """Gets a StorageAccount by name. @@ -146,28 +152,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -181,48 +177,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, storage_account_name: str, resource_group_name: str, storage_account: "_models.StorageAccount", - **kwargs + **kwargs: Any ) -> Optional["_models.StorageAccount"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(storage_account, 'StorageAccount') + + request = build_create_or_update_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_account, 'StorageAccount') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -238,15 +226,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, storage_account_name: str, resource_group_name: str, storage_account: "_models.StorageAccount", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.StorageAccount"]: """Creates a new StorageAccount or updates an existing StorageAccount on the device. @@ -262,15 +253,20 @@ async def begin_create_or_update( :type storage_account: ~azure.mgmt.databoxedge.v2020_09_01.models.StorageAccount :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either StorageAccount or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,28 +279,21 @@ async def begin_create_or_update( storage_account_name=storage_account_name, resource_group_name=resource_group_name, storage_account=storage_account, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -316,6 +305,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore async def _delete_initial( @@ -323,35 +313,25 @@ async def _delete_initial( device_name: str, storage_account_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,12 +344,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, storage_account_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the StorageAccount on the Data Box Edge/Data Box Gateway device. @@ -381,15 +363,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -404,22 +388,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -431,4 +407,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_triggers_operations.py index 47074ae7f1c3..39e12f1a4f3a 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_triggers_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._triggers_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, filter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.TriggerList"]: """Lists all the triggers configured in the device. @@ -61,7 +67,8 @@ def list_by_data_box_edge_device( :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TriggerList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.TriggerList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.TriggerList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TriggerList"] @@ -69,38 +76,35 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TriggerList', pipeline_response) + deserialized = self._deserialize("TriggerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,17 +122,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Trigger": """Get a specific trigger by name. @@ -148,28 +154,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,48 +179,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, trigger: "_models.Trigger", - **kwargs + **kwargs: Any ) -> Optional["_models.Trigger"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Trigger"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(trigger, 'Trigger') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(trigger, 'Trigger') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,15 +228,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, trigger: "_models.Trigger", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Trigger"]: """Creates or updates a trigger. @@ -262,15 +253,19 @@ async def begin_create_or_update( :type trigger: ~azure.mgmt.databoxedge.v2020_09_01.models.Trigger :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Trigger or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Trigger or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.Trigger] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Trigger"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,28 +278,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, trigger=trigger, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Trigger', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -316,6 +304,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore async def _delete_initial( @@ -323,35 +312,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,12 +343,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the trigger on the gateway device. @@ -381,15 +362,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -404,22 +387,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -431,4 +406,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_users_operations.py index 7a72b497646b..63f57658d6ab 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_users_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._users_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, expand: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.UserList"]: """Gets all the users registered on a Data Box Edge/Data Box Gateway device. @@ -61,7 +67,8 @@ def list_by_data_box_edge_device( :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.UserList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.UserList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UserList"] @@ -69,38 +76,35 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('UserList', pipeline_response) + deserialized = self._deserialize("UserList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,17 +122,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.User": """Gets the properties of the specified user. @@ -148,28 +154,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,48 +179,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, user: "_models.User", - **kwargs + **kwargs: Any ) -> Optional["_models.User"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.User"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(user, 'User') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(user, 'User') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,15 +228,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, user: "_models.User", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.User"]: """Creates a new user or updates an existing user's information on a Data Box Edge/Data Box Gateway device. @@ -263,15 +254,18 @@ async def begin_create_or_update( :type user: ~azure.mgmt.databoxedge.v2020_09_01.models.User :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either User or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.User] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.User"] lro_delay = kwargs.pop( 'polling_interval', @@ -284,28 +278,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, user=user, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('User', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -317,6 +304,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore async def _delete_initial( @@ -324,35 +312,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -365,12 +343,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the user on a databox edge/gateway device. @@ -382,15 +362,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -405,22 +387,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -432,4 +406,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/models/__init__.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/models/__init__.py index 8b331ada40a8..6941eeba099b 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/models/__init__.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/models/__init__.py @@ -6,240 +6,123 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ARMBaseModel - from ._models_py3 import Addon - from ._models_py3 import AddonList - from ._models_py3 import Address - from ._models_py3 import Alert - from ._models_py3 import AlertErrorDetails - from ._models_py3 import AlertList - from ._models_py3 import ArcAddon - from ._models_py3 import AsymmetricEncryptedSecret - from ._models_py3 import Authentication - from ._models_py3 import AzureContainerInfo - from ._models_py3 import BandwidthSchedule - from ._models_py3 import BandwidthSchedulesList - from ._models_py3 import ClientAccessRight - from ._models_py3 import CloudEdgeManagementRole - from ._models_py3 import CloudErrorBody - from ._models_py3 import CniConfig - from ._models_py3 import ComputeResource - from ._models_py3 import ContactDetails - from ._models_py3 import Container - from ._models_py3 import ContainerList - from ._models_py3 import DCAccessCode - from ._models_py3 import DataBoxEdgeDevice - from ._models_py3 import DataBoxEdgeDeviceExtendedInfo - from ._models_py3 import DataBoxEdgeDeviceExtendedInfoPatch - from ._models_py3 import DataBoxEdgeDeviceList - from ._models_py3 import DataBoxEdgeDevicePatch - from ._models_py3 import DataBoxEdgeMoveRequest - from ._models_py3 import DataBoxEdgeSku - from ._models_py3 import DataBoxEdgeSkuList - from ._models_py3 import EdgeProfile - from ._models_py3 import EdgeProfilePatch - from ._models_py3 import EdgeProfileSubscription - from ._models_py3 import EdgeProfileSubscriptionPatch - from ._models_py3 import EtcdInfo - from ._models_py3 import FileEventTrigger - from ._models_py3 import FileSourceInfo - from ._models_py3 import GenerateCertResponse - from ._models_py3 import ImageRepositoryCredential - from ._models_py3 import IoTAddon - from ._models_py3 import IoTDeviceInfo - from ._models_py3 import IoTEdgeAgentInfo - from ._models_py3 import IoTRole - from ._models_py3 import Ipv4Config - from ._models_py3 import Ipv6Config - from ._models_py3 import Job - from ._models_py3 import JobErrorDetails - from ._models_py3 import JobErrorItem - from ._models_py3 import KubernetesClusterInfo - from ._models_py3 import KubernetesIPConfiguration - from ._models_py3 import KubernetesRole - from ._models_py3 import KubernetesRoleCompute - from ._models_py3 import KubernetesRoleNetwork - from ._models_py3 import KubernetesRoleResources - from ._models_py3 import KubernetesRoleStorage - from ._models_py3 import KubernetesRoleStorageClassInfo - from ._models_py3 import LoadBalancerConfig - from ._models_py3 import MECRole - from ._models_py3 import MetricConfiguration - from ._models_py3 import MetricCounter - from ._models_py3 import MetricCounterSet - from ._models_py3 import MetricDimension - from ._models_py3 import MetricDimensionV1 - from ._models_py3 import MetricSpecificationV1 - from ._models_py3 import MonitoringMetricConfiguration - from ._models_py3 import MonitoringMetricConfigurationList - from ._models_py3 import MountPointMap - from ._models_py3 import NetworkAdapter - from ._models_py3 import NetworkAdapterPosition - from ._models_py3 import NetworkSettings - from ._models_py3 import Node - from ._models_py3 import NodeInfo - from ._models_py3 import NodeList - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationsList - from ._models_py3 import Order - from ._models_py3 import OrderList - from ._models_py3 import OrderStatus - from ._models_py3 import PeriodicTimerEventTrigger - from ._models_py3 import PeriodicTimerSourceInfo - from ._models_py3 import RefreshDetails - from ._models_py3 import ResourceIdentity - from ._models_py3 import ResourceMoveDetails - from ._models_py3 import ResourceTypeSku - from ._models_py3 import Role - from ._models_py3 import RoleList - from ._models_py3 import RoleSinkInfo - from ._models_py3 import SecuritySettings - from ._models_py3 import ServiceSpecification - from ._models_py3 import Share - from ._models_py3 import ShareAccessRight - from ._models_py3 import ShareList - from ._models_py3 import Sku - from ._models_py3 import SkuCost - from ._models_py3 import SkuInformation - from ._models_py3 import SkuInformationList - from ._models_py3 import SkuLocationInfo - from ._models_py3 import StorageAccount - from ._models_py3 import StorageAccountCredential - from ._models_py3 import StorageAccountCredentialList - from ._models_py3 import StorageAccountList - from ._models_py3 import SubscriptionRegisteredFeatures - from ._models_py3 import SymmetricKey - from ._models_py3 import SystemData - from ._models_py3 import TrackingInfo - from ._models_py3 import Trigger - from ._models_py3 import TriggerList - from ._models_py3 import UpdateDownloadProgress - from ._models_py3 import UpdateInstallProgress - from ._models_py3 import UpdateSummary - from ._models_py3 import UploadCertificateRequest - from ._models_py3 import UploadCertificateResponse - from ._models_py3 import User - from ._models_py3 import UserAccessRight - from ._models_py3 import UserList -except (SyntaxError, ImportError): - from ._models import ARMBaseModel # type: ignore - from ._models import Addon # type: ignore - from ._models import AddonList # type: ignore - from ._models import Address # type: ignore - from ._models import Alert # type: ignore - from ._models import AlertErrorDetails # type: ignore - from ._models import AlertList # type: ignore - from ._models import ArcAddon # type: ignore - from ._models import AsymmetricEncryptedSecret # type: ignore - from ._models import Authentication # type: ignore - from ._models import AzureContainerInfo # type: ignore - from ._models import BandwidthSchedule # type: ignore - from ._models import BandwidthSchedulesList # type: ignore - from ._models import ClientAccessRight # type: ignore - from ._models import CloudEdgeManagementRole # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import CniConfig # type: ignore - from ._models import ComputeResource # type: ignore - from ._models import ContactDetails # type: ignore - from ._models import Container # type: ignore - from ._models import ContainerList # type: ignore - from ._models import DCAccessCode # type: ignore - from ._models import DataBoxEdgeDevice # type: ignore - from ._models import DataBoxEdgeDeviceExtendedInfo # type: ignore - from ._models import DataBoxEdgeDeviceExtendedInfoPatch # type: ignore - from ._models import DataBoxEdgeDeviceList # type: ignore - from ._models import DataBoxEdgeDevicePatch # type: ignore - from ._models import DataBoxEdgeMoveRequest # type: ignore - from ._models import DataBoxEdgeSku # type: ignore - from ._models import DataBoxEdgeSkuList # type: ignore - from ._models import EdgeProfile # type: ignore - from ._models import EdgeProfilePatch # type: ignore - from ._models import EdgeProfileSubscription # type: ignore - from ._models import EdgeProfileSubscriptionPatch # type: ignore - from ._models import EtcdInfo # type: ignore - from ._models import FileEventTrigger # type: ignore - from ._models import FileSourceInfo # type: ignore - from ._models import GenerateCertResponse # type: ignore - from ._models import ImageRepositoryCredential # type: ignore - from ._models import IoTAddon # type: ignore - from ._models import IoTDeviceInfo # type: ignore - from ._models import IoTEdgeAgentInfo # type: ignore - from ._models import IoTRole # type: ignore - from ._models import Ipv4Config # type: ignore - from ._models import Ipv6Config # type: ignore - from ._models import Job # type: ignore - from ._models import JobErrorDetails # type: ignore - from ._models import JobErrorItem # type: ignore - from ._models import KubernetesClusterInfo # type: ignore - from ._models import KubernetesIPConfiguration # type: ignore - from ._models import KubernetesRole # type: ignore - from ._models import KubernetesRoleCompute # type: ignore - from ._models import KubernetesRoleNetwork # type: ignore - from ._models import KubernetesRoleResources # type: ignore - from ._models import KubernetesRoleStorage # type: ignore - from ._models import KubernetesRoleStorageClassInfo # type: ignore - from ._models import LoadBalancerConfig # type: ignore - from ._models import MECRole # type: ignore - from ._models import MetricConfiguration # type: ignore - from ._models import MetricCounter # type: ignore - from ._models import MetricCounterSet # type: ignore - from ._models import MetricDimension # type: ignore - from ._models import MetricDimensionV1 # type: ignore - from ._models import MetricSpecificationV1 # type: ignore - from ._models import MonitoringMetricConfiguration # type: ignore - from ._models import MonitoringMetricConfigurationList # type: ignore - from ._models import MountPointMap # type: ignore - from ._models import NetworkAdapter # type: ignore - from ._models import NetworkAdapterPosition # type: ignore - from ._models import NetworkSettings # type: ignore - from ._models import Node # type: ignore - from ._models import NodeInfo # type: ignore - from ._models import NodeList # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationsList # type: ignore - from ._models import Order # type: ignore - from ._models import OrderList # type: ignore - from ._models import OrderStatus # type: ignore - from ._models import PeriodicTimerEventTrigger # type: ignore - from ._models import PeriodicTimerSourceInfo # type: ignore - from ._models import RefreshDetails # type: ignore - from ._models import ResourceIdentity # type: ignore - from ._models import ResourceMoveDetails # type: ignore - from ._models import ResourceTypeSku # type: ignore - from ._models import Role # type: ignore - from ._models import RoleList # type: ignore - from ._models import RoleSinkInfo # type: ignore - from ._models import SecuritySettings # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Share # type: ignore - from ._models import ShareAccessRight # type: ignore - from ._models import ShareList # type: ignore - from ._models import Sku # type: ignore - from ._models import SkuCost # type: ignore - from ._models import SkuInformation # type: ignore - from ._models import SkuInformationList # type: ignore - from ._models import SkuLocationInfo # type: ignore - from ._models import StorageAccount # type: ignore - from ._models import StorageAccountCredential # type: ignore - from ._models import StorageAccountCredentialList # type: ignore - from ._models import StorageAccountList # type: ignore - from ._models import SubscriptionRegisteredFeatures # type: ignore - from ._models import SymmetricKey # type: ignore - from ._models import SystemData # type: ignore - from ._models import TrackingInfo # type: ignore - from ._models import Trigger # type: ignore - from ._models import TriggerList # type: ignore - from ._models import UpdateDownloadProgress # type: ignore - from ._models import UpdateInstallProgress # type: ignore - from ._models import UpdateSummary # type: ignore - from ._models import UploadCertificateRequest # type: ignore - from ._models import UploadCertificateResponse # type: ignore - from ._models import User # type: ignore - from ._models import UserAccessRight # type: ignore - from ._models import UserList # type: ignore +from ._models_py3 import ARMBaseModel +from ._models_py3 import Addon +from ._models_py3 import AddonList +from ._models_py3 import Address +from ._models_py3 import Alert +from ._models_py3 import AlertErrorDetails +from ._models_py3 import AlertList +from ._models_py3 import ArcAddon +from ._models_py3 import AsymmetricEncryptedSecret +from ._models_py3 import Authentication +from ._models_py3 import AzureContainerInfo +from ._models_py3 import BandwidthSchedule +from ._models_py3 import BandwidthSchedulesList +from ._models_py3 import ClientAccessRight +from ._models_py3 import CloudEdgeManagementRole +from ._models_py3 import CloudErrorBody +from ._models_py3 import CniConfig +from ._models_py3 import ComputeResource +from ._models_py3 import ContactDetails +from ._models_py3 import Container +from ._models_py3 import ContainerList +from ._models_py3 import DCAccessCode +from ._models_py3 import DataBoxEdgeDevice +from ._models_py3 import DataBoxEdgeDeviceExtendedInfo +from ._models_py3 import DataBoxEdgeDeviceExtendedInfoPatch +from ._models_py3 import DataBoxEdgeDeviceList +from ._models_py3 import DataBoxEdgeDevicePatch +from ._models_py3 import DataBoxEdgeMoveRequest +from ._models_py3 import DataBoxEdgeSku +from ._models_py3 import DataBoxEdgeSkuList +from ._models_py3 import EdgeProfile +from ._models_py3 import EdgeProfilePatch +from ._models_py3 import EdgeProfileSubscription +from ._models_py3 import EdgeProfileSubscriptionPatch +from ._models_py3 import EtcdInfo +from ._models_py3 import FileEventTrigger +from ._models_py3 import FileSourceInfo +from ._models_py3 import GenerateCertResponse +from ._models_py3 import ImageRepositoryCredential +from ._models_py3 import IoTAddon +from ._models_py3 import IoTDeviceInfo +from ._models_py3 import IoTEdgeAgentInfo +from ._models_py3 import IoTRole +from ._models_py3 import Ipv4Config +from ._models_py3 import Ipv6Config +from ._models_py3 import Job +from ._models_py3 import JobErrorDetails +from ._models_py3 import JobErrorItem +from ._models_py3 import KubernetesClusterInfo +from ._models_py3 import KubernetesIPConfiguration +from ._models_py3 import KubernetesRole +from ._models_py3 import KubernetesRoleCompute +from ._models_py3 import KubernetesRoleNetwork +from ._models_py3 import KubernetesRoleResources +from ._models_py3 import KubernetesRoleStorage +from ._models_py3 import KubernetesRoleStorageClassInfo +from ._models_py3 import LoadBalancerConfig +from ._models_py3 import MECRole +from ._models_py3 import MetricConfiguration +from ._models_py3 import MetricCounter +from ._models_py3 import MetricCounterSet +from ._models_py3 import MetricDimension +from ._models_py3 import MetricDimensionV1 +from ._models_py3 import MetricSpecificationV1 +from ._models_py3 import MonitoringMetricConfiguration +from ._models_py3 import MonitoringMetricConfigurationList +from ._models_py3 import MountPointMap +from ._models_py3 import NetworkAdapter +from ._models_py3 import NetworkAdapterPosition +from ._models_py3 import NetworkSettings +from ._models_py3 import Node +from ._models_py3 import NodeInfo +from ._models_py3 import NodeList +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationsList +from ._models_py3 import Order +from ._models_py3 import OrderList +from ._models_py3 import OrderStatus +from ._models_py3 import PeriodicTimerEventTrigger +from ._models_py3 import PeriodicTimerSourceInfo +from ._models_py3 import RefreshDetails +from ._models_py3 import ResourceIdentity +from ._models_py3 import ResourceMoveDetails +from ._models_py3 import ResourceTypeSku +from ._models_py3 import Role +from ._models_py3 import RoleList +from ._models_py3 import RoleSinkInfo +from ._models_py3 import SecuritySettings +from ._models_py3 import ServiceSpecification +from ._models_py3 import Share +from ._models_py3 import ShareAccessRight +from ._models_py3 import ShareList +from ._models_py3 import Sku +from ._models_py3 import SkuCost +from ._models_py3 import SkuInformation +from ._models_py3 import SkuInformationList +from ._models_py3 import SkuLocationInfo +from ._models_py3 import StorageAccount +from ._models_py3 import StorageAccountCredential +from ._models_py3 import StorageAccountCredentialList +from ._models_py3 import StorageAccountList +from ._models_py3 import SubscriptionRegisteredFeatures +from ._models_py3 import SymmetricKey +from ._models_py3 import SystemData +from ._models_py3 import TrackingInfo +from ._models_py3 import Trigger +from ._models_py3 import TriggerList +from ._models_py3 import UpdateDownloadProgress +from ._models_py3 import UpdateInstallProgress +from ._models_py3 import UpdateSummary +from ._models_py3 import UploadCertificateRequest +from ._models_py3 import UploadCertificateResponse +from ._models_py3 import User +from ._models_py3 import UserAccessRight +from ._models_py3 import UserList + from ._data_box_edge_management_client_enums import ( AccountType, diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/models/_data_box_edge_management_client_enums.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/models/_data_box_edge_management_client_enums.py index 0cec6392e961..25c4872a93ae 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/models/_data_box_edge_management_client_enums.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/models/_data_box_edge_management_client_enums.py @@ -6,34 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccountType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of storage accessed on the storage account. """ GENERAL_PURPOSE_STORAGE = "GeneralPurposeStorage" BLOB_STORAGE = "BlobStorage" -class AddonState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AddonState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Addon Provisioning State """ @@ -45,14 +30,14 @@ class AddonState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" DELETING = "Deleting" -class AddonType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AddonType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Addon type. """ IOT_EDGE = "IotEdge" ARC_FOR_KUBERNETES = "ArcForKubernetes" -class AlertSeverity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AlertSeverity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Severity of the alert. """ @@ -60,14 +45,14 @@ class AlertSeverity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" CRITICAL = "Critical" -class AuthenticationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AuthenticationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The authentication type. """ INVALID = "Invalid" AZURE_ACTIVE_DIRECTORY = "AzureActiveDirectory" -class AzureContainerDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AzureContainerDataFormat(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Storage format used for the file represented by the share. """ @@ -75,7 +60,7 @@ class AzureContainerDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu PAGE_BLOB = "PageBlob" AZURE_FILE = "AzureFile" -class ClientPermissionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ClientPermissionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of access to be allowed for the client. """ @@ -83,7 +68,7 @@ class ClientPermissionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ_ONLY = "ReadOnly" READ_WRITE = "ReadWrite" -class ContainerStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ContainerStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current status of the container. """ @@ -93,7 +78,7 @@ class ContainerStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UPDATING = "Updating" NEEDS_ATTENTION = "NeedsAttention" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -102,7 +87,7 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class DataBoxEdgeDeviceKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DataBoxEdgeDeviceKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The etag for the devices. """ @@ -111,7 +96,7 @@ class DataBoxEdgeDeviceKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) AZURE_STACK_HUB = "AzureStackHub" AZURE_MODULAR_DATA_CENTRE = "AzureModularDataCentre" -class DataBoxEdgeDeviceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DataBoxEdgeDeviceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the Data Box Edge/Gateway device. """ @@ -123,14 +108,14 @@ class DataBoxEdgeDeviceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum PARTIALLY_DISCONNECTED = "PartiallyDisconnected" MAINTENANCE = "Maintenance" -class DataPolicy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DataPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Data policy of the share. """ CLOUD = "Cloud" LOCAL = "Local" -class DayOfWeek(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DayOfWeek(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SUNDAY = "Sunday" MONDAY = "Monday" @@ -140,13 +125,13 @@ class DayOfWeek(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FRIDAY = "Friday" SATURDAY = "Saturday" -class DeviceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeviceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the Data Box Edge/Gateway device. """ DATA_BOX_EDGE_DEVICE = "DataBoxEdgeDevice" -class DownloadPhase(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DownloadPhase(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The download phase. """ @@ -155,7 +140,7 @@ class DownloadPhase(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DOWNLOADING = "Downloading" VERIFYING = "Verifying" -class EncryptionAlgorithm(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The algorithm used to encrypt "Value". """ @@ -163,14 +148,14 @@ class EncryptionAlgorithm(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AES256 = "AES256" RSAES_PKCS1_V1_5 = "RSAES_PKCS1_v_1_5" -class HostPlatformType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HostPlatformType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Platform where the runtime is hosted. """ KUBERNETES_CLUSTER = "KubernetesCluster" LINUX_VM = "LinuxVM" -class InstallRebootBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InstallRebootBehavior(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates if updates are available and at least one of the updates needs a reboot. """ @@ -178,7 +163,7 @@ class InstallRebootBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) REQUIRES_REBOOT = "RequiresReboot" REQUEST_REBOOT = "RequestReboot" -class JobStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JobStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current status of the job. """ @@ -190,7 +175,7 @@ class JobStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PAUSED = "Paused" SCHEDULED = "Scheduled" -class JobType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JobType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the job. """ @@ -204,7 +189,7 @@ class JobType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESTORE = "Restore" TRIGGER_SUPPORT_PACKAGE = "TriggerSupportPackage" -class KubernetesNodeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KubernetesNodeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Node type - Master/Worker """ @@ -212,7 +197,7 @@ class KubernetesNodeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MASTER = "Master" WORKER = "Worker" -class KubernetesState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KubernetesState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """State of Kubernetes deployment """ @@ -224,7 +209,7 @@ class KubernetesState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" DELETING = "Deleting" -class MetricAggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricAggregationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Metric aggregation type. """ @@ -236,14 +221,14 @@ class MetricAggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) TOTAL = "Total" COUNT = "Count" -class MetricCategory(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricCategory(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Metric category. """ CAPACITY = "Capacity" TRANSACTION = "Transaction" -class MetricUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Metric units. """ @@ -256,21 +241,21 @@ class MetricUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BYTES_PER_SECOND = "BytesPerSecond" COUNT_PER_SECOND = "CountPerSecond" -class MonitoringStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MonitoringStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current monitoring status of the share. """ ENABLED = "Enabled" DISABLED = "Disabled" -class MountType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MountType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Mounting type. """ VOLUME = "Volume" HOST_PATH = "HostPath" -class MsiIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MsiIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Identity type """ @@ -278,28 +263,28 @@ class MsiIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED = "SystemAssigned" USER_ASSIGNED = "UserAssigned" -class NetworkAdapterDHCPStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkAdapterDHCPStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Value indicating whether this adapter has DHCP enabled. """ DISABLED = "Disabled" ENABLED = "Enabled" -class NetworkAdapterRDMAStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkAdapterRDMAStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Value indicating whether this adapter is RDMA capable. """ INCAPABLE = "Incapable" CAPABLE = "Capable" -class NetworkAdapterStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkAdapterStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Value indicating whether this adapter is valid. """ INACTIVE = "Inactive" ACTIVE = "Active" -class NetworkGroup(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkGroup(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The network group. """ @@ -307,7 +292,7 @@ class NetworkGroup(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): NON_RDMA = "NonRDMA" RDMA = "RDMA" -class NodeStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NodeStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current status of the individual node """ @@ -317,7 +302,7 @@ class NodeStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): REBOOTING = "Rebooting" SHUTTING_DOWN = "ShuttingDown" -class OrderState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OrderState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the order as per the allowed status types. """ @@ -339,14 +324,14 @@ class OrderState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PICKUP_COMPLETED = "PickupCompleted" AWAITING_DROP = "AwaitingDrop" -class PlatformType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PlatformType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Host OS supported by the Arc addon. """ WINDOWS = "Windows" LINUX = "Linux" -class PosixComplianceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PosixComplianceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """If provisioned storage is posix compliant. """ @@ -354,7 +339,7 @@ class PosixComplianceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) ENABLED = "Enabled" DISABLED = "Disabled" -class ResourceMoveStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceMoveStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Denotes whether move operation is in progress """ @@ -362,14 +347,14 @@ class ResourceMoveStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESOURCE_MOVE_IN_PROGRESS = "ResourceMoveInProgress" RESOURCE_MOVE_FAILED = "ResourceMoveFailed" -class RoleStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RoleStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Local Edge Management Status """ ENABLED = "Enabled" DISABLED = "Disabled" -class RoleTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RoleTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): IOT = "IOT" ASA = "ASA" @@ -379,14 +364,14 @@ class RoleTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): CLOUD_EDGE_MANAGEMENT = "CloudEdgeManagement" KUBERNETES = "Kubernetes" -class ShareAccessProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareAccessProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Access protocol to be used by the share. """ SMB = "SMB" NFS = "NFS" -class ShareAccessType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareAccessType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of access to be allowed on the share for this user. """ @@ -394,7 +379,7 @@ class ShareAccessType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ = "Read" CUSTOM = "Custom" -class ShareStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current status of the share. """ @@ -404,20 +389,20 @@ class ShareStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UPDATING = "Updating" NEEDS_ATTENTION = "NeedsAttention" -class ShipmentType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShipmentType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NOT_APPLICABLE = "NotApplicable" SHIPPED_TO_CUSTOMER = "ShippedToCustomer" SELF_PICKUP = "SelfPickup" -class SkuAvailability(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuAvailability(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Links to the next set of results """ AVAILABLE = "Available" UNAVAILABLE = "Unavailable" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Sku name. """ @@ -443,34 +428,34 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RCA_LARGE = "RCA_Large" RDC = "RDC" -class SkuSignupOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuSignupOption(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Sku can be signed up by customer or not. """ NONE = "None" AVAILABLE = "Available" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Sku tier. """ STANDARD = "Standard" -class SkuVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Availability of the Sku as preview/stable. """ STABLE = "Stable" PREVIEW = "Preview" -class SSLStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SSLStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Signifies whether SSL needs to be enabled or not. """ ENABLED = "Enabled" DISABLED = "Disabled" -class StorageAccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current status of the storage account """ @@ -480,7 +465,7 @@ class StorageAccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UPDATING = "Updating" NEEDS_ATTENTION = "NeedsAttention" -class SubscriptionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SubscriptionState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REGISTERED = "Registered" WARNED = "Warned" @@ -488,7 +473,7 @@ class SubscriptionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DELETED = "Deleted" UNREGISTERED = "Unregistered" -class TimeGrain(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TimeGrain(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PT1_M = "PT1M" PT5_M = "PT5M" @@ -499,14 +484,14 @@ class TimeGrain(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PT12_H = "PT12H" PT1_D = "PT1D" -class TriggerEventType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TriggerEventType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Trigger Kind. """ FILE_EVENT = "FileEvent" PERIODIC_TIMER_EVENT = "PeriodicTimerEvent" -class UpdateOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpdateOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current update operation. """ @@ -515,7 +500,7 @@ class UpdateOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DOWNLOAD = "Download" INSTALL = "Install" -class UpdateOperationStage(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpdateOperationStage(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current stage of the update operation. """ @@ -537,7 +522,7 @@ class UpdateOperationStage(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESCAN_COMPLETE = "RescanComplete" RESCAN_FAILED = "RescanFailed" -class UserType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UserType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the user. """ diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/models/_models.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/models/_models.py deleted file mode 100644 index b67bee38c64f..000000000000 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/models/_models.py +++ /dev/null @@ -1,4986 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class ARMBaseModel(msrest.serialization.Model): - """Represents the base class for all object models. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ARMBaseModel, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class Addon(ARMBaseModel): - """Role Addon. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ArcAddon, IoTAddon. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Addon type.Constant filled by server. Possible values include: - "IotEdge", "ArcForKubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.AddonType - :ivar system_data: Addon type. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - _subtype_map = { - 'kind': {'ArcForKubernetes': 'ArcAddon', 'IotEdge': 'IoTAddon'} - } - - def __init__( - self, - **kwargs - ): - super(Addon, self).__init__(**kwargs) - self.kind = 'Addon' # type: str - self.system_data = None - - -class AddonList(msrest.serialization.Model): - """Collection of all the Role addon on the Azure Stack Edge device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The Value. - :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01.models.Addon] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Addon]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AddonList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class Address(msrest.serialization.Model): - """The shipping address of the customer. - - All required parameters must be populated in order to send to Azure. - - :param address_line1: The address line1. - :type address_line1: str - :param address_line2: The address line2. - :type address_line2: str - :param address_line3: The address line3. - :type address_line3: str - :param postal_code: The postal code. - :type postal_code: str - :param city: The city name. - :type city: str - :param state: The state name. - :type state: str - :param country: Required. The country name. - :type country: str - """ - - _validation = { - 'country': {'required': True}, - } - - _attribute_map = { - 'address_line1': {'key': 'addressLine1', 'type': 'str'}, - 'address_line2': {'key': 'addressLine2', 'type': 'str'}, - 'address_line3': {'key': 'addressLine3', 'type': 'str'}, - 'postal_code': {'key': 'postalCode', 'type': 'str'}, - 'city': {'key': 'city', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'country': {'key': 'country', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Address, self).__init__(**kwargs) - self.address_line1 = kwargs.get('address_line1', None) - self.address_line2 = kwargs.get('address_line2', None) - self.address_line3 = kwargs.get('address_line3', None) - self.postal_code = kwargs.get('postal_code', None) - self.city = kwargs.get('city', None) - self.state = kwargs.get('state', None) - self.country = kwargs['country'] - - -class Alert(ARMBaseModel): - """Alert on the data box edge/gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar system_data: Alert generated in the resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - :ivar title: Alert title. - :vartype title: str - :ivar alert_type: Alert type. - :vartype alert_type: str - :ivar appeared_at_date_time: UTC time when the alert appeared. - :vartype appeared_at_date_time: ~datetime.datetime - :ivar recommendation: Alert recommendation. - :vartype recommendation: str - :ivar severity: Severity of the alert. Possible values include: "Informational", "Warning", - "Critical". - :vartype severity: str or ~azure.mgmt.databoxedge.v2020_09_01.models.AlertSeverity - :ivar error_details: Error details of the alert. - :vartype error_details: ~azure.mgmt.databoxedge.v2020_09_01.models.AlertErrorDetails - :ivar detailed_information: Alert details. - :vartype detailed_information: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'title': {'readonly': True}, - 'alert_type': {'readonly': True}, - 'appeared_at_date_time': {'readonly': True}, - 'recommendation': {'readonly': True}, - 'severity': {'readonly': True}, - 'error_details': {'readonly': True}, - 'detailed_information': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'title': {'key': 'properties.title', 'type': 'str'}, - 'alert_type': {'key': 'properties.alertType', 'type': 'str'}, - 'appeared_at_date_time': {'key': 'properties.appearedAtDateTime', 'type': 'iso-8601'}, - 'recommendation': {'key': 'properties.recommendation', 'type': 'str'}, - 'severity': {'key': 'properties.severity', 'type': 'str'}, - 'error_details': {'key': 'properties.errorDetails', 'type': 'AlertErrorDetails'}, - 'detailed_information': {'key': 'properties.detailedInformation', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(Alert, self).__init__(**kwargs) - self.system_data = None - self.title = None - self.alert_type = None - self.appeared_at_date_time = None - self.recommendation = None - self.severity = None - self.error_details = None - self.detailed_information = None - - -class AlertErrorDetails(msrest.serialization.Model): - """Error details for the alert. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error_code: Error code. - :vartype error_code: str - :ivar error_message: Error Message. - :vartype error_message: str - :ivar occurrences: Number of occurrences. - :vartype occurrences: int - """ - - _validation = { - 'error_code': {'readonly': True}, - 'error_message': {'readonly': True}, - 'occurrences': {'readonly': True}, - } - - _attribute_map = { - 'error_code': {'key': 'errorCode', 'type': 'str'}, - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - 'occurrences': {'key': 'occurrences', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(AlertErrorDetails, self).__init__(**kwargs) - self.error_code = None - self.error_message = None - self.occurrences = None - - -class AlertList(msrest.serialization.Model): - """Collection of alerts. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The value. - :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01.models.Alert] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Alert]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AlertList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ArcAddon(Addon): - """Arc Addon. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Addon type.Constant filled by server. Possible values include: - "IotEdge", "ArcForKubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.AddonType - :ivar system_data: Addon type. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - :param subscription_id: Required. Arc resource subscription Id. - :type subscription_id: str - :param resource_group_name: Required. Arc resource group name. - :type resource_group_name: str - :param resource_name: Required. Arc resource Name. - :type resource_name: str - :param resource_location: Required. Arc resource location. - :type resource_location: str - :ivar version: Arc resource version. - :vartype version: str - :ivar host_platform: Host OS supported by the Arc addon. Possible values include: "Windows", - "Linux". - :vartype host_platform: str or ~azure.mgmt.databoxedge.v2020_09_01.models.PlatformType - :ivar host_platform_type: Platform where the runtime is hosted. Possible values include: - "KubernetesCluster", "LinuxVM". - :vartype host_platform_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.HostPlatformType - :ivar provisioning_state: Addon Provisioning State. Possible values include: "Invalid", - "Creating", "Created", "Updating", "Reconfiguring", "Failed", "Deleting". - :vartype provisioning_state: str or ~azure.mgmt.databoxedge.v2020_09_01.models.AddonState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - 'subscription_id': {'required': True}, - 'resource_group_name': {'required': True}, - 'resource_name': {'required': True}, - 'resource_location': {'required': True}, - 'version': {'readonly': True}, - 'host_platform': {'readonly': True}, - 'host_platform_type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'subscription_id': {'key': 'properties.subscriptionId', 'type': 'str'}, - 'resource_group_name': {'key': 'properties.resourceGroupName', 'type': 'str'}, - 'resource_name': {'key': 'properties.resourceName', 'type': 'str'}, - 'resource_location': {'key': 'properties.resourceLocation', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'host_platform': {'key': 'properties.hostPlatform', 'type': 'str'}, - 'host_platform_type': {'key': 'properties.hostPlatformType', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ArcAddon, self).__init__(**kwargs) - self.kind = 'ArcForKubernetes' # type: str - self.subscription_id = kwargs['subscription_id'] - self.resource_group_name = kwargs['resource_group_name'] - self.resource_name = kwargs['resource_name'] - self.resource_location = kwargs['resource_location'] - self.version = None - self.host_platform = None - self.host_platform_type = None - self.provisioning_state = None - - -class AsymmetricEncryptedSecret(msrest.serialization.Model): - """Represent the secrets intended for encryption with asymmetric key pair. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The value of the secret. - :type value: str - :param encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the - value is unencrypted, it will be null. - :type encryption_cert_thumbprint: str - :param encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values - include: "None", "AES256", "RSAES_PKCS1_v_1_5". - :type encryption_algorithm: str or - ~azure.mgmt.databoxedge.v2020_09_01.models.EncryptionAlgorithm - """ - - _validation = { - 'value': {'required': True}, - 'encryption_algorithm': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'encryption_cert_thumbprint': {'key': 'encryptionCertThumbprint', 'type': 'str'}, - 'encryption_algorithm': {'key': 'encryptionAlgorithm', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AsymmetricEncryptedSecret, self).__init__(**kwargs) - self.value = kwargs['value'] - self.encryption_cert_thumbprint = kwargs.get('encryption_cert_thumbprint', None) - self.encryption_algorithm = kwargs['encryption_algorithm'] - - -class Authentication(msrest.serialization.Model): - """Authentication mechanism for IoT devices. - - :param symmetric_key: Symmetric key for authentication. - :type symmetric_key: ~azure.mgmt.databoxedge.v2020_09_01.models.SymmetricKey - """ - - _attribute_map = { - 'symmetric_key': {'key': 'symmetricKey', 'type': 'SymmetricKey'}, - } - - def __init__( - self, - **kwargs - ): - super(Authentication, self).__init__(**kwargs) - self.symmetric_key = kwargs.get('symmetric_key', None) - - -class AzureContainerInfo(msrest.serialization.Model): - """Azure container mapping of the endpoint. - - All required parameters must be populated in order to send to Azure. - - :param storage_account_credential_id: Required. ID of the storage account credential used to - access storage. - :type storage_account_credential_id: str - :param container_name: Required. Container name (Based on the data format specified, this - represents the name of Azure Files/Page blob/Block blob). - :type container_name: str - :param data_format: Required. Storage format used for the file represented by the share. - Possible values include: "BlockBlob", "PageBlob", "AzureFile". - :type data_format: str or ~azure.mgmt.databoxedge.v2020_09_01.models.AzureContainerDataFormat - """ - - _validation = { - 'storage_account_credential_id': {'required': True}, - 'container_name': {'required': True}, - 'data_format': {'required': True}, - } - - _attribute_map = { - 'storage_account_credential_id': {'key': 'storageAccountCredentialId', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'data_format': {'key': 'dataFormat', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureContainerInfo, self).__init__(**kwargs) - self.storage_account_credential_id = kwargs['storage_account_credential_id'] - self.container_name = kwargs['container_name'] - self.data_format = kwargs['data_format'] - - -class BandwidthSchedule(ARMBaseModel): - """The bandwidth schedule details. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar system_data: Bandwidth object related to ASE resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - :param start: Required. The start time of the schedule in UTC. - :type start: str - :param stop: Required. The stop time of the schedule in UTC. - :type stop: str - :param rate_in_mbps: Required. The bandwidth rate in Mbps. - :type rate_in_mbps: int - :param days: Required. The days of the week when this schedule is applicable. - :type days: list[str or ~azure.mgmt.databoxedge.v2020_09_01.models.DayOfWeek] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'start': {'required': True}, - 'stop': {'required': True}, - 'rate_in_mbps': {'required': True}, - 'days': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'start': {'key': 'properties.start', 'type': 'str'}, - 'stop': {'key': 'properties.stop', 'type': 'str'}, - 'rate_in_mbps': {'key': 'properties.rateInMbps', 'type': 'int'}, - 'days': {'key': 'properties.days', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(BandwidthSchedule, self).__init__(**kwargs) - self.system_data = None - self.start = kwargs['start'] - self.stop = kwargs['stop'] - self.rate_in_mbps = kwargs['rate_in_mbps'] - self.days = kwargs['days'] - - -class BandwidthSchedulesList(msrest.serialization.Model): - """The collection of bandwidth schedules. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of bandwidth schedules. - :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01.models.BandwidthSchedule] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BandwidthSchedule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BandwidthSchedulesList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ClientAccessRight(msrest.serialization.Model): - """The mapping between a particular client IP and the type of access client has on the NFS share. - - All required parameters must be populated in order to send to Azure. - - :param client: Required. IP of the client. - :type client: str - :param access_permission: Required. Type of access to be allowed for the client. Possible - values include: "NoAccess", "ReadOnly", "ReadWrite". - :type access_permission: str or ~azure.mgmt.databoxedge.v2020_09_01.models.ClientPermissionType - """ - - _validation = { - 'client': {'required': True}, - 'access_permission': {'required': True}, - } - - _attribute_map = { - 'client': {'key': 'client', 'type': 'str'}, - 'access_permission': {'key': 'accessPermission', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClientAccessRight, self).__init__(**kwargs) - self.client = kwargs['client'] - self.access_permission = kwargs['access_permission'] - - -class Role(ARMBaseModel): - """Compute role. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: CloudEdgeManagementRole, IoTRole, KubernetesRole, MECRole. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", - "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleTypes - :ivar system_data: Role configured on ASE resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - _subtype_map = { - 'kind': {'CloudEdgeManagement': 'CloudEdgeManagementRole', 'IOT': 'IoTRole', 'Kubernetes': 'KubernetesRole', 'MEC': 'MECRole'} - } - - def __init__( - self, - **kwargs - ): - super(Role, self).__init__(**kwargs) - self.kind = 'Role' # type: str - self.system_data = None - - -class CloudEdgeManagementRole(Role): - """CloudEdgeManagementRole role. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", - "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleTypes - :ivar system_data: Role configured on ASE resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - :ivar local_management_status: Local Edge Management Status. Possible values include: - "Enabled", "Disabled". - :vartype local_management_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleStatus - :ivar edge_profile: Edge Profile of the resource. - :vartype edge_profile: ~azure.mgmt.databoxedge.v2020_09_01.models.EdgeProfile - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - 'local_management_status': {'readonly': True}, - 'edge_profile': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'local_management_status': {'key': 'properties.localManagementStatus', 'type': 'str'}, - 'edge_profile': {'key': 'properties.edgeProfile', 'type': 'EdgeProfile'}, - 'role_status': {'key': 'properties.roleStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudEdgeManagementRole, self).__init__(**kwargs) - self.kind = 'CloudEdgeManagement' # type: str - self.local_management_status = None - self.edge_profile = None - self.role_status = kwargs.get('role_status', None) - - -class CloudErrorBody(msrest.serialization.Model): - """An error response from the service. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.databoxedge.v2020_09_01.models.CloudErrorBody] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudErrorBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.details = kwargs.get('details', None) - - -class CniConfig(msrest.serialization.Model): - """Cni configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: Cni type. - :vartype type: str - :ivar version: Cni version. - :vartype version: str - :ivar pod_subnet: Pod Subnet. - :vartype pod_subnet: str - :ivar service_subnet: Service subnet. - :vartype service_subnet: str - """ - - _validation = { - 'type': {'readonly': True}, - 'version': {'readonly': True}, - 'pod_subnet': {'readonly': True}, - 'service_subnet': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'pod_subnet': {'key': 'podSubnet', 'type': 'str'}, - 'service_subnet': {'key': 'serviceSubnet', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CniConfig, self).__init__(**kwargs) - self.type = None - self.version = None - self.pod_subnet = None - self.service_subnet = None - - -class ComputeResource(msrest.serialization.Model): - """Compute infrastructure Resource. - - All required parameters must be populated in order to send to Azure. - - :param processor_count: Required. Processor count. - :type processor_count: int - :param memory_in_gb: Required. Memory in GB. - :type memory_in_gb: long - """ - - _validation = { - 'processor_count': {'required': True}, - 'memory_in_gb': {'required': True}, - } - - _attribute_map = { - 'processor_count': {'key': 'processorCount', 'type': 'int'}, - 'memory_in_gb': {'key': 'memoryInGB', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(ComputeResource, self).__init__(**kwargs) - self.processor_count = kwargs['processor_count'] - self.memory_in_gb = kwargs['memory_in_gb'] - - -class ContactDetails(msrest.serialization.Model): - """Contains all the contact details of the customer. - - All required parameters must be populated in order to send to Azure. - - :param contact_person: Required. The contact person name. - :type contact_person: str - :param company_name: Required. The name of the company. - :type company_name: str - :param phone: Required. The phone number. - :type phone: str - :param email_list: Required. The email list. - :type email_list: list[str] - """ - - _validation = { - 'contact_person': {'required': True}, - 'company_name': {'required': True}, - 'phone': {'required': True}, - 'email_list': {'required': True}, - } - - _attribute_map = { - 'contact_person': {'key': 'contactPerson', 'type': 'str'}, - 'company_name': {'key': 'companyName', 'type': 'str'}, - 'phone': {'key': 'phone', 'type': 'str'}, - 'email_list': {'key': 'emailList', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ContactDetails, self).__init__(**kwargs) - self.contact_person = kwargs['contact_person'] - self.company_name = kwargs['company_name'] - self.phone = kwargs['phone'] - self.email_list = kwargs['email_list'] - - -class Container(ARMBaseModel): - """Represents a container on the Data Box Edge/Gateway device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar system_data: Container in DataBoxEdge Resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - :ivar container_status: Current status of the container. Possible values include: "OK", - "Offline", "Unknown", "Updating", "NeedsAttention". - :vartype container_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.ContainerStatus - :param data_format: Required. DataFormat for Container. Possible values include: "BlockBlob", - "PageBlob", "AzureFile". - :type data_format: str or ~azure.mgmt.databoxedge.v2020_09_01.models.AzureContainerDataFormat - :ivar refresh_details: Details of the refresh job on this container. - :vartype refresh_details: ~azure.mgmt.databoxedge.v2020_09_01.models.RefreshDetails - :ivar created_date_time: The UTC time when container got created. - :vartype created_date_time: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'container_status': {'readonly': True}, - 'data_format': {'required': True}, - 'refresh_details': {'readonly': True}, - 'created_date_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'container_status': {'key': 'properties.containerStatus', 'type': 'str'}, - 'data_format': {'key': 'properties.dataFormat', 'type': 'str'}, - 'refresh_details': {'key': 'properties.refreshDetails', 'type': 'RefreshDetails'}, - 'created_date_time': {'key': 'properties.createdDateTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(Container, self).__init__(**kwargs) - self.system_data = None - self.container_status = None - self.data_format = kwargs['data_format'] - self.refresh_details = None - self.created_date_time = None - - -class ContainerList(msrest.serialization.Model): - """Collection of all the containers on the Data Box Edge/Gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of containers. - :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01.models.Container] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Container]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContainerList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class DataBoxEdgeDevice(ARMBaseModel): - """The Data Box Edge/Gateway device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param location: Required. The location of the device. This is a supported and registered Azure - geographical region (for example, West US, East US, or Southeast Asia). The geographical region - of a device cannot be changed once it is created, but if an identical geographical region is - specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. The list of tags that describe the device. These tags can be used - to view and group this device (across resource groups). - :type tags: dict[str, str] - :param sku: The SKU type. - :type sku: ~azure.mgmt.databoxedge.v2020_09_01.models.Sku - :param etag: The etag for the devices. - :type etag: str - :param identity: Msi identity of the resource. - :type identity: ~azure.mgmt.databoxedge.v2020_09_01.models.ResourceIdentity - :ivar kind: The etag for the devices. Possible values include: "AzureDataBoxGateway", - "AzureStackEdge", "AzureStackHub", "AzureModularDataCentre". - :vartype kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.DataBoxEdgeDeviceKind - :ivar system_data: DataBoxEdge Resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - :param data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible - values include: "ReadyToSetup", "Online", "Offline", "NeedsAttention", "Disconnected", - "PartiallyDisconnected", "Maintenance". - :type data_box_edge_device_status: str or - ~azure.mgmt.databoxedge.v2020_09_01.models.DataBoxEdgeDeviceStatus - :ivar serial_number: The Serial Number of Data Box Edge/Gateway device. - :vartype serial_number: str - :ivar description: The Description of the Data Box Edge/Gateway device. - :vartype description: str - :ivar model_description: The description of the Data Box Edge/Gateway device model. - :vartype model_description: str - :ivar device_type: The type of the Data Box Edge/Gateway device. Possible values include: - "DataBoxEdgeDevice". - :vartype device_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.DeviceType - :ivar friendly_name: The Data Box Edge/Gateway device name. - :vartype friendly_name: str - :ivar culture: The Data Box Edge/Gateway device culture. - :vartype culture: str - :ivar device_model: The Data Box Edge/Gateway device model. - :vartype device_model: str - :ivar device_software_version: The Data Box Edge/Gateway device software version. - :vartype device_software_version: str - :ivar device_local_capacity: The Data Box Edge/Gateway device local capacity in MB. - :vartype device_local_capacity: long - :ivar time_zone: The Data Box Edge/Gateway device timezone. - :vartype time_zone: str - :ivar device_hcs_version: The device software version number of the device (eg: 1.2.18105.6). - :vartype device_hcs_version: str - :ivar configured_role_types: Type of compute roles configured. - :vartype configured_role_types: list[str or - ~azure.mgmt.databoxedge.v2020_09_01.models.RoleTypes] - :ivar node_count: The number of nodes in the cluster. - :vartype node_count: int - :ivar resource_move_details: The details of the move operation on this resource. - :vartype resource_move_details: ~azure.mgmt.databoxedge.v2020_09_01.models.ResourceMoveDetails - :ivar edge_profile: The details of Edge Profile for this resource. - :vartype edge_profile: ~azure.mgmt.databoxedge.v2020_09_01.models.EdgeProfile - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'kind': {'readonly': True}, - 'system_data': {'readonly': True}, - 'serial_number': {'readonly': True}, - 'description': {'readonly': True}, - 'model_description': {'readonly': True}, - 'device_type': {'readonly': True}, - 'friendly_name': {'readonly': True}, - 'culture': {'readonly': True}, - 'device_model': {'readonly': True}, - 'device_software_version': {'readonly': True}, - 'device_local_capacity': {'readonly': True}, - 'time_zone': {'readonly': True}, - 'device_hcs_version': {'readonly': True}, - 'configured_role_types': {'readonly': True}, - 'node_count': {'readonly': True}, - 'resource_move_details': {'readonly': True}, - 'edge_profile': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'ResourceIdentity'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'data_box_edge_device_status': {'key': 'properties.dataBoxEdgeDeviceStatus', 'type': 'str'}, - 'serial_number': {'key': 'properties.serialNumber', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'model_description': {'key': 'properties.modelDescription', 'type': 'str'}, - 'device_type': {'key': 'properties.deviceType', 'type': 'str'}, - 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, - 'culture': {'key': 'properties.culture', 'type': 'str'}, - 'device_model': {'key': 'properties.deviceModel', 'type': 'str'}, - 'device_software_version': {'key': 'properties.deviceSoftwareVersion', 'type': 'str'}, - 'device_local_capacity': {'key': 'properties.deviceLocalCapacity', 'type': 'long'}, - 'time_zone': {'key': 'properties.timeZone', 'type': 'str'}, - 'device_hcs_version': {'key': 'properties.deviceHcsVersion', 'type': 'str'}, - 'configured_role_types': {'key': 'properties.configuredRoleTypes', 'type': '[str]'}, - 'node_count': {'key': 'properties.nodeCount', 'type': 'int'}, - 'resource_move_details': {'key': 'properties.resourceMoveDetails', 'type': 'ResourceMoveDetails'}, - 'edge_profile': {'key': 'properties.edgeProfile', 'type': 'EdgeProfile'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeDevice, self).__init__(**kwargs) - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.etag = kwargs.get('etag', None) - self.identity = kwargs.get('identity', None) - self.kind = None - self.system_data = None - self.data_box_edge_device_status = kwargs.get('data_box_edge_device_status', None) - self.serial_number = None - self.description = None - self.model_description = None - self.device_type = None - self.friendly_name = None - self.culture = None - self.device_model = None - self.device_software_version = None - self.device_local_capacity = None - self.time_zone = None - self.device_hcs_version = None - self.configured_role_types = None - self.node_count = None - self.resource_move_details = None - self.edge_profile = None - - -class DataBoxEdgeDeviceExtendedInfo(ARMBaseModel): - """The extended Info of the Data Box Edge/Gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param encryption_key_thumbprint: The digital signature of encrypted certificate. - :type encryption_key_thumbprint: str - :param encryption_key: The public part of the encryption certificate. Client uses this to - encrypt any secret. - :type encryption_key: str - :ivar resource_key: The Resource ID of the Resource. - :vartype resource_key: str - :param client_secret_store_id: The Key Vault ARM Id for client secrets. - :type client_secret_store_id: str - :param client_secret_store_url: The url to access the Client Key Vault. - :type client_secret_store_url: str - :param channel_integrity_key_name: The name of Channel Integrity Key stored in the Client Key - Vault. - :type channel_integrity_key_name: str - :param channel_integrity_key_version: The version of Channel Integrity Key stored in the Client - Key Vault. - :type channel_integrity_key_version: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'resource_key': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'encryption_key_thumbprint': {'key': 'properties.encryptionKeyThumbprint', 'type': 'str'}, - 'encryption_key': {'key': 'properties.encryptionKey', 'type': 'str'}, - 'resource_key': {'key': 'properties.resourceKey', 'type': 'str'}, - 'client_secret_store_id': {'key': 'properties.clientSecretStoreId', 'type': 'str'}, - 'client_secret_store_url': {'key': 'properties.clientSecretStoreUrl', 'type': 'str'}, - 'channel_integrity_key_name': {'key': 'properties.channelIntegrityKeyName', 'type': 'str'}, - 'channel_integrity_key_version': {'key': 'properties.channelIntegrityKeyVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeDeviceExtendedInfo, self).__init__(**kwargs) - self.encryption_key_thumbprint = kwargs.get('encryption_key_thumbprint', None) - self.encryption_key = kwargs.get('encryption_key', None) - self.resource_key = None - self.client_secret_store_id = kwargs.get('client_secret_store_id', None) - self.client_secret_store_url = kwargs.get('client_secret_store_url', None) - self.channel_integrity_key_name = kwargs.get('channel_integrity_key_name', None) - self.channel_integrity_key_version = kwargs.get('channel_integrity_key_version', None) - - -class DataBoxEdgeDeviceExtendedInfoPatch(msrest.serialization.Model): - """The Data Box Edge/Gateway device extended info patch. - - :param client_secret_store_id: The Key Vault ARM Id for client secrets. - :type client_secret_store_id: str - :param client_secret_store_url: The url to access the Client Key Vault. - :type client_secret_store_url: str - :param channel_integrity_key_name: The name for Channel Integrity Key stored in the Client Key - Vault. - :type channel_integrity_key_name: str - :param channel_integrity_key_version: The version of Channel Integrity Key stored in the Client - Key Vault. - :type channel_integrity_key_version: str - """ - - _attribute_map = { - 'client_secret_store_id': {'key': 'clientSecretStoreId', 'type': 'str'}, - 'client_secret_store_url': {'key': 'clientSecretStoreUrl', 'type': 'str'}, - 'channel_integrity_key_name': {'key': 'channelIntegrityKeyName', 'type': 'str'}, - 'channel_integrity_key_version': {'key': 'channelIntegrityKeyVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeDeviceExtendedInfoPatch, self).__init__(**kwargs) - self.client_secret_store_id = kwargs.get('client_secret_store_id', None) - self.client_secret_store_url = kwargs.get('client_secret_store_url', None) - self.channel_integrity_key_name = kwargs.get('channel_integrity_key_name', None) - self.channel_integrity_key_version = kwargs.get('channel_integrity_key_version', None) - - -class DataBoxEdgeDeviceList(msrest.serialization.Model): - """The collection of Data Box Edge/Gateway devices. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of Data Box Edge/Gateway devices. - :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01.models.DataBoxEdgeDevice] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DataBoxEdgeDevice]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeDeviceList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class DataBoxEdgeDevicePatch(msrest.serialization.Model): - """The Data Box Edge/Gateway device patch. - - :param tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. - :type tags: dict[str, str] - :param identity: Msi identity of the resource. - :type identity: ~azure.mgmt.databoxedge.v2020_09_01.models.ResourceIdentity - :param edge_profile: Edge Profile property of the Data Box Edge/Gateway device. - :type edge_profile: ~azure.mgmt.databoxedge.v2020_09_01.models.EdgeProfilePatch - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ResourceIdentity'}, - 'edge_profile': {'key': 'properties.edgeProfile', 'type': 'EdgeProfilePatch'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeDevicePatch, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.edge_profile = kwargs.get('edge_profile', None) - - -class DataBoxEdgeMoveRequest(msrest.serialization.Model): - """Resource Move details. - - All required parameters must be populated in order to send to Azure. - - :param target_resource_group: Required. Target resource group ARMId. - :type target_resource_group: str - :param resources: Required. List of resources to be moved. - :type resources: list[str] - """ - - _validation = { - 'target_resource_group': {'required': True}, - 'resources': {'required': True}, - } - - _attribute_map = { - 'target_resource_group': {'key': 'targetResourceGroup', 'type': 'str'}, - 'resources': {'key': 'resources', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeMoveRequest, self).__init__(**kwargs) - self.target_resource_group = kwargs['target_resource_group'] - self.resources = kwargs['resources'] - - -class DataBoxEdgeSku(msrest.serialization.Model): - """The Sku information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar resource_type: The type of the resource. - :vartype resource_type: str - :ivar name: The Sku name. Possible values include: "Gateway", "Edge", "TEA_1Node", - "TEA_1Node_UPS", "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", - "TEA_4Node_UPS_Heater", "TMA", "TDC", "TCA_Small", "GPU", "TCA_Large", "EdgeP_Base", - "EdgeP_High", "EdgePR_Base", "EdgePR_Base_UPS", "EdgeMR_Mini", "RCA_Small", "RCA_Large", "RDC". - :vartype name: str or ~azure.mgmt.databoxedge.v2020_09_01.models.SkuName - :ivar kind: The Sku kind. - :vartype kind: str - :ivar tier: The Sku tier. Possible values include: "Standard". - :vartype tier: str or ~azure.mgmt.databoxedge.v2020_09_01.models.SkuTier - :ivar size: The Sku kind. - :vartype size: str - :ivar family: The Sku family. - :vartype family: str - :ivar locations: Availability of the Sku for the region. - :vartype locations: list[str] - :ivar api_versions: The API versions in which Sku is available. - :vartype api_versions: list[str] - :ivar location_info: Availability of the Sku for the location/zone/site. - :vartype location_info: list[~azure.mgmt.databoxedge.v2020_09_01.models.SkuLocationInfo] - :ivar costs: The pricing info of the Sku. - :vartype costs: list[~azure.mgmt.databoxedge.v2020_09_01.models.SkuCost] - :ivar signup_option: Sku can be signed up by customer or not. Possible values include: "None", - "Available". - :vartype signup_option: str or ~azure.mgmt.databoxedge.v2020_09_01.models.SkuSignupOption - :ivar version: Availability of the Sku as preview/stable. Possible values include: "Stable", - "Preview". - :vartype version: str or ~azure.mgmt.databoxedge.v2020_09_01.models.SkuVersion - :ivar availability: Links to the next set of results. Possible values include: "Available", - "Unavailable". - :vartype availability: str or ~azure.mgmt.databoxedge.v2020_09_01.models.SkuAvailability - :ivar shipment_types: List of Shipment Types supported by this SKU. - :vartype shipment_types: list[str or ~azure.mgmt.databoxedge.v2020_09_01.models.ShipmentType] - """ - - _validation = { - 'resource_type': {'readonly': True}, - 'name': {'readonly': True}, - 'kind': {'readonly': True}, - 'tier': {'readonly': True}, - 'size': {'readonly': True}, - 'family': {'readonly': True}, - 'locations': {'readonly': True}, - 'api_versions': {'readonly': True}, - 'location_info': {'readonly': True}, - 'costs': {'readonly': True}, - 'signup_option': {'readonly': True}, - 'version': {'readonly': True}, - 'availability': {'readonly': True}, - 'shipment_types': {'readonly': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'str'}, - 'family': {'key': 'family', 'type': 'str'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'api_versions': {'key': 'apiVersions', 'type': '[str]'}, - 'location_info': {'key': 'locationInfo', 'type': '[SkuLocationInfo]'}, - 'costs': {'key': 'costs', 'type': '[SkuCost]'}, - 'signup_option': {'key': 'signupOption', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'availability': {'key': 'availability', 'type': 'str'}, - 'shipment_types': {'key': 'shipmentTypes', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeSku, self).__init__(**kwargs) - self.resource_type = None - self.name = None - self.kind = None - self.tier = None - self.size = None - self.family = None - self.locations = None - self.api_versions = None - self.location_info = None - self.costs = None - self.signup_option = None - self.version = None - self.availability = None - self.shipment_types = None - - -class DataBoxEdgeSkuList(msrest.serialization.Model): - """List of SKU Information objects. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of ResourceType Sku. - :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01.models.DataBoxEdgeSku] - :ivar next_link: Links to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DataBoxEdgeSku]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeSkuList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class DCAccessCode(msrest.serialization.Model): - """DC Access code in the case of Self Managed Shipping. - - :param auth_code: DCAccess Code for the Self Managed shipment. - :type auth_code: str - """ - - _attribute_map = { - 'auth_code': {'key': 'properties.authCode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DCAccessCode, self).__init__(**kwargs) - self.auth_code = kwargs.get('auth_code', None) - - -class EdgeProfile(msrest.serialization.Model): - """Details about Edge Profile for the resource. - - :param subscription: Edge Profile Subscription. - :type subscription: ~azure.mgmt.databoxedge.v2020_09_01.models.EdgeProfileSubscription - """ - - _attribute_map = { - 'subscription': {'key': 'subscription', 'type': 'EdgeProfileSubscription'}, - } - - def __init__( - self, - **kwargs - ): - super(EdgeProfile, self).__init__(**kwargs) - self.subscription = kwargs.get('subscription', None) - - -class EdgeProfilePatch(msrest.serialization.Model): - """The Data Box Edge/Gateway Edge Profile patch. - - :param subscription: The Data Box Edge/Gateway Edge Profile Subscription patch. - :type subscription: ~azure.mgmt.databoxedge.v2020_09_01.models.EdgeProfileSubscriptionPatch - """ - - _attribute_map = { - 'subscription': {'key': 'subscription', 'type': 'EdgeProfileSubscriptionPatch'}, - } - - def __init__( - self, - **kwargs - ): - super(EdgeProfilePatch, self).__init__(**kwargs) - self.subscription = kwargs.get('subscription', None) - - -class EdgeProfileSubscription(msrest.serialization.Model): - """Subscription details for the Edge Profile. - - :param registration_id: Edge Subscription Registration ID. - :type registration_id: str - :param id: ARM ID of the subscription. - :type id: str - :param state: Possible values include: "Registered", "Warned", "Suspended", "Deleted", - "Unregistered". - :type state: str or ~azure.mgmt.databoxedge.v2020_09_01.models.SubscriptionState - :param registration_date: - :type registration_date: str - :param subscription_id: - :type subscription_id: str - :param tenant_id: - :type tenant_id: str - :param location_placement_id: - :type location_placement_id: str - :param quota_id: - :type quota_id: str - :param serialized_details: - :type serialized_details: str - :param registered_features: - :type registered_features: - list[~azure.mgmt.databoxedge.v2020_09_01.models.SubscriptionRegisteredFeatures] - """ - - _attribute_map = { - 'registration_id': {'key': 'registrationId', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'registration_date': {'key': 'registrationDate', 'type': 'str'}, - 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, - 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, - 'location_placement_id': {'key': 'properties.locationPlacementId', 'type': 'str'}, - 'quota_id': {'key': 'properties.quotaId', 'type': 'str'}, - 'serialized_details': {'key': 'properties.serializedDetails', 'type': 'str'}, - 'registered_features': {'key': 'properties.registeredFeatures', 'type': '[SubscriptionRegisteredFeatures]'}, - } - - def __init__( - self, - **kwargs - ): - super(EdgeProfileSubscription, self).__init__(**kwargs) - self.registration_id = kwargs.get('registration_id', None) - self.id = kwargs.get('id', None) - self.state = kwargs.get('state', None) - self.registration_date = kwargs.get('registration_date', None) - self.subscription_id = kwargs.get('subscription_id', None) - self.tenant_id = kwargs.get('tenant_id', None) - self.location_placement_id = kwargs.get('location_placement_id', None) - self.quota_id = kwargs.get('quota_id', None) - self.serialized_details = kwargs.get('serialized_details', None) - self.registered_features = kwargs.get('registered_features', None) - - -class EdgeProfileSubscriptionPatch(msrest.serialization.Model): - """The Data Box Edge/Gateway Edge Profile Subscription patch. - - :param id: The path ID that uniquely identifies the subscription of the edge profile. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EdgeProfileSubscriptionPatch, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class EtcdInfo(msrest.serialization.Model): - """Etcd configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: Etcd type. - :vartype type: str - :ivar version: Etcd version. - :vartype version: str - """ - - _validation = { - 'type': {'readonly': True}, - 'version': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EtcdInfo, self).__init__(**kwargs) - self.type = None - self.version = None - - -class Trigger(ARMBaseModel): - """Trigger details. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: FileEventTrigger, PeriodicTimerEventTrigger. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar system_data: Trigger in DataBoxEdge Resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: - "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.TriggerEventType - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'kind': {'key': 'kind', 'type': 'str'}, - } - - _subtype_map = { - 'kind': {'FileEvent': 'FileEventTrigger', 'PeriodicTimerEvent': 'PeriodicTimerEventTrigger'} - } - - def __init__( - self, - **kwargs - ): - super(Trigger, self).__init__(**kwargs) - self.system_data = None - self.kind = 'Trigger' # type: str - - -class FileEventTrigger(Trigger): - """Trigger details. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar system_data: Trigger in DataBoxEdge Resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: - "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.TriggerEventType - :param source_info: Required. File event source details. - :type source_info: ~azure.mgmt.databoxedge.v2020_09_01.models.FileSourceInfo - :param sink_info: Required. Role sink info. - :type sink_info: ~azure.mgmt.databoxedge.v2020_09_01.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against - its usage. For example, if a periodic timer trigger is intended for certain specific IoT - modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'kind': {'required': True}, - 'source_info': {'required': True}, - 'sink_info': {'required': True}, - 'custom_context_tag': {'max_length': 192, 'min_length': 0}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'source_info': {'key': 'properties.sourceInfo', 'type': 'FileSourceInfo'}, - 'sink_info': {'key': 'properties.sinkInfo', 'type': 'RoleSinkInfo'}, - 'custom_context_tag': {'key': 'properties.customContextTag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FileEventTrigger, self).__init__(**kwargs) - self.kind = 'FileEvent' # type: str - self.source_info = kwargs['source_info'] - self.sink_info = kwargs['sink_info'] - self.custom_context_tag = kwargs.get('custom_context_tag', None) - - -class FileSourceInfo(msrest.serialization.Model): - """File source details. - - All required parameters must be populated in order to send to Azure. - - :param share_id: Required. File share ID. - :type share_id: str - """ - - _validation = { - 'share_id': {'required': True}, - } - - _attribute_map = { - 'share_id': {'key': 'shareId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FileSourceInfo, self).__init__(**kwargs) - self.share_id = kwargs['share_id'] - - -class GenerateCertResponse(msrest.serialization.Model): - """Used in activation key generation flow. - - :param public_key: Gets or sets base64 encoded certificate raw data, - this is the public part needed to be uploaded to cert vault. - :type public_key: str - :param private_key: Gets or sets base64 encoded private part of the certificate, - needed to form the activation key. - :type private_key: str - :param expiry_time_in_utc: Gets or sets expiry time in UTC. - :type expiry_time_in_utc: str - """ - - _attribute_map = { - 'public_key': {'key': 'publicKey', 'type': 'str'}, - 'private_key': {'key': 'privateKey', 'type': 'str'}, - 'expiry_time_in_utc': {'key': 'expiryTimeInUTC', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GenerateCertResponse, self).__init__(**kwargs) - self.public_key = kwargs.get('public_key', None) - self.private_key = kwargs.get('private_key', None) - self.expiry_time_in_utc = kwargs.get('expiry_time_in_utc', None) - - -class ImageRepositoryCredential(msrest.serialization.Model): - """Image repository credential. - - All required parameters must be populated in order to send to Azure. - - :param image_repository_url: Required. Image repository url (e.g.: mcr.microsoft.com). - :type image_repository_url: str - :param user_name: Required. Repository user name. - :type user_name: str - :param password: Repository user password. - :type password: ~azure.mgmt.databoxedge.v2020_09_01.models.AsymmetricEncryptedSecret - """ - - _validation = { - 'image_repository_url': {'required': True}, - 'user_name': {'required': True}, - } - - _attribute_map = { - 'image_repository_url': {'key': 'imageRepositoryUrl', 'type': 'str'}, - 'user_name': {'key': 'userName', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'AsymmetricEncryptedSecret'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageRepositoryCredential, self).__init__(**kwargs) - self.image_repository_url = kwargs['image_repository_url'] - self.user_name = kwargs['user_name'] - self.password = kwargs.get('password', None) - - -class IoTAddon(Addon): - """IoT Addon. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Addon type.Constant filled by server. Possible values include: - "IotEdge", "ArcForKubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.AddonType - :ivar system_data: Addon type. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - :param io_t_device_details: Required. IoT device metadata to which appliance needs to be - connected. - :type io_t_device_details: ~azure.mgmt.databoxedge.v2020_09_01.models.IoTDeviceInfo - :param io_t_edge_device_details: Required. IoT edge device to which the IoT Addon needs to be - configured. - :type io_t_edge_device_details: ~azure.mgmt.databoxedge.v2020_09_01.models.IoTDeviceInfo - :ivar version: Version of IoT running on the appliance. - :vartype version: str - :ivar host_platform: Host OS supported by the IoT addon. Possible values include: "Windows", - "Linux". - :vartype host_platform: str or ~azure.mgmt.databoxedge.v2020_09_01.models.PlatformType - :ivar host_platform_type: Platform where the runtime is hosted. Possible values include: - "KubernetesCluster", "LinuxVM". - :vartype host_platform_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.HostPlatformType - :ivar provisioning_state: Addon Provisioning State. Possible values include: "Invalid", - "Creating", "Created", "Updating", "Reconfiguring", "Failed", "Deleting". - :vartype provisioning_state: str or ~azure.mgmt.databoxedge.v2020_09_01.models.AddonState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - 'io_t_device_details': {'required': True}, - 'io_t_edge_device_details': {'required': True}, - 'version': {'readonly': True}, - 'host_platform': {'readonly': True}, - 'host_platform_type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'io_t_device_details': {'key': 'properties.ioTDeviceDetails', 'type': 'IoTDeviceInfo'}, - 'io_t_edge_device_details': {'key': 'properties.ioTEdgeDeviceDetails', 'type': 'IoTDeviceInfo'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'host_platform': {'key': 'properties.hostPlatform', 'type': 'str'}, - 'host_platform_type': {'key': 'properties.hostPlatformType', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IoTAddon, self).__init__(**kwargs) - self.kind = 'IotEdge' # type: str - self.io_t_device_details = kwargs['io_t_device_details'] - self.io_t_edge_device_details = kwargs['io_t_edge_device_details'] - self.version = None - self.host_platform = None - self.host_platform_type = None - self.provisioning_state = None - - -class IoTDeviceInfo(msrest.serialization.Model): - """Metadata of IoT device/IoT Edge device to be configured. - - All required parameters must be populated in order to send to Azure. - - :param device_id: Required. ID of the IoT device/edge device. - :type device_id: str - :param io_t_host_hub: Required. Host name for the IoT hub associated to the device. - :type io_t_host_hub: str - :param io_t_host_hub_id: Id for the IoT hub associated to the device. - :type io_t_host_hub_id: str - :param authentication: Encrypted IoT device/IoT edge device connection string. - :type authentication: ~azure.mgmt.databoxedge.v2020_09_01.models.Authentication - """ - - _validation = { - 'device_id': {'required': True}, - 'io_t_host_hub': {'required': True}, - } - - _attribute_map = { - 'device_id': {'key': 'deviceId', 'type': 'str'}, - 'io_t_host_hub': {'key': 'ioTHostHub', 'type': 'str'}, - 'io_t_host_hub_id': {'key': 'ioTHostHubId', 'type': 'str'}, - 'authentication': {'key': 'authentication', 'type': 'Authentication'}, - } - - def __init__( - self, - **kwargs - ): - super(IoTDeviceInfo, self).__init__(**kwargs) - self.device_id = kwargs['device_id'] - self.io_t_host_hub = kwargs['io_t_host_hub'] - self.io_t_host_hub_id = kwargs.get('io_t_host_hub_id', None) - self.authentication = kwargs.get('authentication', None) - - -class IoTEdgeAgentInfo(msrest.serialization.Model): - """IoT edge agent details is optional, this will be used for download system Agent module while bootstrapping IoT Role if specified. - - All required parameters must be populated in order to send to Azure. - - :param image_name: Required. Name of the IoT edge agent image. - :type image_name: str - :param tag: Required. Image Tag. - :type tag: str - :param image_repository: Image repository details. - :type image_repository: ~azure.mgmt.databoxedge.v2020_09_01.models.ImageRepositoryCredential - """ - - _validation = { - 'image_name': {'required': True}, - 'tag': {'required': True}, - } - - _attribute_map = { - 'image_name': {'key': 'imageName', 'type': 'str'}, - 'tag': {'key': 'tag', 'type': 'str'}, - 'image_repository': {'key': 'imageRepository', 'type': 'ImageRepositoryCredential'}, - } - - def __init__( - self, - **kwargs - ): - super(IoTEdgeAgentInfo, self).__init__(**kwargs) - self.image_name = kwargs['image_name'] - self.tag = kwargs['tag'] - self.image_repository = kwargs.get('image_repository', None) - - -class IoTRole(Role): - """Compute role. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", - "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleTypes - :ivar system_data: Role configured on ASE resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - :param host_platform: Host OS supported by the IoT role. Possible values include: "Windows", - "Linux". - :type host_platform: str or ~azure.mgmt.databoxedge.v2020_09_01.models.PlatformType - :param io_t_device_details: IoT device metadata to which data box edge device needs to be - connected. - :type io_t_device_details: ~azure.mgmt.databoxedge.v2020_09_01.models.IoTDeviceInfo - :param io_t_edge_device_details: IoT edge device to which the IoT role needs to be configured. - :type io_t_edge_device_details: ~azure.mgmt.databoxedge.v2020_09_01.models.IoTDeviceInfo - :param share_mappings: Mount points of shares in role(s). - :type share_mappings: list[~azure.mgmt.databoxedge.v2020_09_01.models.MountPointMap] - :param io_t_edge_agent_info: Iot edge agent details to download the agent and bootstrap iot - runtime. - :type io_t_edge_agent_info: ~azure.mgmt.databoxedge.v2020_09_01.models.IoTEdgeAgentInfo - :ivar host_platform_type: Platform where the Iot runtime is hosted. Possible values include: - "KubernetesCluster", "LinuxVM". - :vartype host_platform_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.HostPlatformType - :param compute_resource: Resource allocation. - :type compute_resource: ~azure.mgmt.databoxedge.v2020_09_01.models.ComputeResource - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - 'host_platform_type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'host_platform': {'key': 'properties.hostPlatform', 'type': 'str'}, - 'io_t_device_details': {'key': 'properties.ioTDeviceDetails', 'type': 'IoTDeviceInfo'}, - 'io_t_edge_device_details': {'key': 'properties.ioTEdgeDeviceDetails', 'type': 'IoTDeviceInfo'}, - 'share_mappings': {'key': 'properties.shareMappings', 'type': '[MountPointMap]'}, - 'io_t_edge_agent_info': {'key': 'properties.ioTEdgeAgentInfo', 'type': 'IoTEdgeAgentInfo'}, - 'host_platform_type': {'key': 'properties.hostPlatformType', 'type': 'str'}, - 'compute_resource': {'key': 'properties.computeResource', 'type': 'ComputeResource'}, - 'role_status': {'key': 'properties.roleStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IoTRole, self).__init__(**kwargs) - self.kind = 'IOT' # type: str - self.host_platform = kwargs.get('host_platform', None) - self.io_t_device_details = kwargs.get('io_t_device_details', None) - self.io_t_edge_device_details = kwargs.get('io_t_edge_device_details', None) - self.share_mappings = kwargs.get('share_mappings', None) - self.io_t_edge_agent_info = kwargs.get('io_t_edge_agent_info', None) - self.host_platform_type = None - self.compute_resource = kwargs.get('compute_resource', None) - self.role_status = kwargs.get('role_status', None) - - -class Ipv4Config(msrest.serialization.Model): - """Details related to the IPv4 address configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar ip_address: The IPv4 address of the network adapter. - :vartype ip_address: str - :ivar subnet: The IPv4 subnet of the network adapter. - :vartype subnet: str - :ivar gateway: The IPv4 gateway of the network adapter. - :vartype gateway: str - """ - - _validation = { - 'ip_address': {'readonly': True}, - 'subnet': {'readonly': True}, - 'gateway': {'readonly': True}, - } - - _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'subnet': {'key': 'subnet', 'type': 'str'}, - 'gateway': {'key': 'gateway', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Ipv4Config, self).__init__(**kwargs) - self.ip_address = None - self.subnet = None - self.gateway = None - - -class Ipv6Config(msrest.serialization.Model): - """Details related to the IPv6 address configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar ip_address: The IPv6 address of the network adapter. - :vartype ip_address: str - :ivar prefix_length: The IPv6 prefix of the network adapter. - :vartype prefix_length: int - :ivar gateway: The IPv6 gateway of the network adapter. - :vartype gateway: str - """ - - _validation = { - 'ip_address': {'readonly': True}, - 'prefix_length': {'readonly': True}, - 'gateway': {'readonly': True}, - } - - _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'prefix_length': {'key': 'prefixLength', 'type': 'int'}, - 'gateway': {'key': 'gateway', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Ipv6Config, self).__init__(**kwargs) - self.ip_address = None - self.prefix_length = None - self.gateway = None - - -class Job(msrest.serialization.Model): - """A device job. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The name of the object. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar status: The current status of the job. Possible values include: "Invalid", "Running", - "Succeeded", "Failed", "Canceled", "Paused", "Scheduled". - :vartype status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.JobStatus - :ivar start_time: The UTC date and time at which the job started. - :vartype start_time: ~datetime.datetime - :ivar end_time: The UTC date and time at which the job completed. - :vartype end_time: ~datetime.datetime - :ivar percent_complete: The percentage of the job that is complete. - :vartype percent_complete: int - :ivar error: The error details. - :vartype error: ~azure.mgmt.databoxedge.v2020_09_01.models.JobErrorDetails - :ivar job_type: The type of the job. Possible values include: "Invalid", "ScanForUpdates", - "DownloadUpdates", "InstallUpdates", "RefreshShare", "RefreshContainer", "Backup", "Restore", - "TriggerSupportPackage". - :vartype job_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.JobType - :ivar current_stage: Current stage of the update operation. Possible values include: "Unknown", - "Initial", "ScanStarted", "ScanComplete", "ScanFailed", "DownloadStarted", "DownloadComplete", - "DownloadFailed", "InstallStarted", "InstallComplete", "InstallFailed", "RebootInitiated", - "Success", "Failure", "RescanStarted", "RescanComplete", "RescanFailed". - :vartype current_stage: str or ~azure.mgmt.databoxedge.v2020_09_01.models.UpdateOperationStage - :ivar download_progress: The download progress. - :vartype download_progress: ~azure.mgmt.databoxedge.v2020_09_01.models.UpdateDownloadProgress - :ivar install_progress: The install progress. - :vartype install_progress: ~azure.mgmt.databoxedge.v2020_09_01.models.UpdateInstallProgress - :ivar total_refresh_errors: Total number of errors encountered during the refresh process. - :vartype total_refresh_errors: int - :ivar error_manifest_file: Local share/remote container relative path to the error manifest - file of the refresh. - :vartype error_manifest_file: str - :ivar refreshed_entity_id: ARM ID of the entity that was refreshed. - :vartype refreshed_entity_id: str - :param folder: If only subfolders need to be refreshed, then the subfolder path inside the - share or container. (The path is empty if there are no subfolders.). - :type folder: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'status': {'readonly': True}, - 'start_time': {'readonly': True}, - 'end_time': {'readonly': True}, - 'percent_complete': {'readonly': True}, - 'error': {'readonly': True}, - 'job_type': {'readonly': True}, - 'current_stage': {'readonly': True}, - 'download_progress': {'readonly': True}, - 'install_progress': {'readonly': True}, - 'total_refresh_errors': {'readonly': True}, - 'error_manifest_file': {'readonly': True}, - 'refreshed_entity_id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'percent_complete': {'key': 'percentComplete', 'type': 'int'}, - 'error': {'key': 'error', 'type': 'JobErrorDetails'}, - 'job_type': {'key': 'properties.jobType', 'type': 'str'}, - 'current_stage': {'key': 'properties.currentStage', 'type': 'str'}, - 'download_progress': {'key': 'properties.downloadProgress', 'type': 'UpdateDownloadProgress'}, - 'install_progress': {'key': 'properties.installProgress', 'type': 'UpdateInstallProgress'}, - 'total_refresh_errors': {'key': 'properties.totalRefreshErrors', 'type': 'int'}, - 'error_manifest_file': {'key': 'properties.errorManifestFile', 'type': 'str'}, - 'refreshed_entity_id': {'key': 'properties.refreshedEntityId', 'type': 'str'}, - 'folder': {'key': 'properties.folder', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Job, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.status = None - self.start_time = None - self.end_time = None - self.percent_complete = None - self.error = None - self.job_type = None - self.current_stage = None - self.download_progress = None - self.install_progress = None - self.total_refresh_errors = None - self.error_manifest_file = None - self.refreshed_entity_id = None - self.folder = kwargs.get('folder', None) - - -class JobErrorDetails(msrest.serialization.Model): - """The job error information containing the list of job errors. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error_details: The error details. - :vartype error_details: list[~azure.mgmt.databoxedge.v2020_09_01.models.JobErrorItem] - :ivar code: The code intended for programmatic access. - :vartype code: str - :ivar message: The message that describes the error in detail. - :vartype message: str - """ - - _validation = { - 'error_details': {'readonly': True}, - 'code': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'error_details': {'key': 'errorDetails', 'type': '[JobErrorItem]'}, - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(JobErrorDetails, self).__init__(**kwargs) - self.error_details = None - self.code = None - self.message = None - - -class JobErrorItem(msrest.serialization.Model): - """The job error items. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar recommendations: The recommended actions. - :vartype recommendations: list[str] - :ivar code: The code intended for programmatic access. - :vartype code: str - :ivar message: The message that describes the error in detail. - :vartype message: str - """ - - _validation = { - 'recommendations': {'readonly': True}, - 'code': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'recommendations': {'key': 'recommendations', 'type': '[str]'}, - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(JobErrorItem, self).__init__(**kwargs) - self.recommendations = None - self.code = None - self.message = None - - -class KubernetesClusterInfo(msrest.serialization.Model): - """Kubernetes cluster configuration. - - 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 etcd_info: Etcd configuration. - :vartype etcd_info: ~azure.mgmt.databoxedge.v2020_09_01.models.EtcdInfo - :ivar nodes: Kubernetes cluster nodes. - :vartype nodes: list[~azure.mgmt.databoxedge.v2020_09_01.models.NodeInfo] - :param version: Required. Kubernetes cluster version. - :type version: str - """ - - _validation = { - 'etcd_info': {'readonly': True}, - 'nodes': {'readonly': True}, - 'version': {'required': True}, - } - - _attribute_map = { - 'etcd_info': {'key': 'etcdInfo', 'type': 'EtcdInfo'}, - 'nodes': {'key': 'nodes', 'type': '[NodeInfo]'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KubernetesClusterInfo, self).__init__(**kwargs) - self.etcd_info = None - self.nodes = None - self.version = kwargs['version'] - - -class KubernetesIPConfiguration(msrest.serialization.Model): - """Kubernetes node IP configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar port: Port of the Kubernetes node. - :vartype port: str - :param ip_address: IP address of the Kubernetes node. - :type ip_address: str - """ - - _validation = { - 'port': {'readonly': True}, - } - - _attribute_map = { - 'port': {'key': 'port', 'type': 'str'}, - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KubernetesIPConfiguration, self).__init__(**kwargs) - self.port = None - self.ip_address = kwargs.get('ip_address', None) - - -class KubernetesRole(Role): - """Kubernetes role. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", - "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleTypes - :ivar system_data: Role configured on ASE resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - :param host_platform: Host OS supported by the Kubernetes role. Possible values include: - "Windows", "Linux". - :type host_platform: str or ~azure.mgmt.databoxedge.v2020_09_01.models.PlatformType - :ivar provisioning_state: State of Kubernetes deployment. Possible values include: "Invalid", - "Creating", "Created", "Updating", "Reconfiguring", "Failed", "Deleting". - :vartype provisioning_state: str or ~azure.mgmt.databoxedge.v2020_09_01.models.KubernetesState - :ivar host_platform_type: Platform where the runtime is hosted. Possible values include: - "KubernetesCluster", "LinuxVM". - :vartype host_platform_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.HostPlatformType - :param kubernetes_cluster_info: Kubernetes cluster configuration. - :type kubernetes_cluster_info: ~azure.mgmt.databoxedge.v2020_09_01.models.KubernetesClusterInfo - :param kubernetes_role_resources: Kubernetes role resources. - :type kubernetes_role_resources: - ~azure.mgmt.databoxedge.v2020_09_01.models.KubernetesRoleResources - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'host_platform_type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'host_platform': {'key': 'properties.hostPlatform', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'host_platform_type': {'key': 'properties.hostPlatformType', 'type': 'str'}, - 'kubernetes_cluster_info': {'key': 'properties.kubernetesClusterInfo', 'type': 'KubernetesClusterInfo'}, - 'kubernetes_role_resources': {'key': 'properties.kubernetesRoleResources', 'type': 'KubernetesRoleResources'}, - 'role_status': {'key': 'properties.roleStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KubernetesRole, self).__init__(**kwargs) - self.kind = 'Kubernetes' # type: str - self.host_platform = kwargs.get('host_platform', None) - self.provisioning_state = None - self.host_platform_type = None - self.kubernetes_cluster_info = kwargs.get('kubernetes_cluster_info', None) - self.kubernetes_role_resources = kwargs.get('kubernetes_role_resources', None) - self.role_status = kwargs.get('role_status', None) - - -class KubernetesRoleCompute(msrest.serialization.Model): - """Kubernetes role compute 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. - - :param vm_profile: Required. VM profile. - :type vm_profile: str - :ivar memory_in_bytes: Memory in bytes. - :vartype memory_in_bytes: long - :ivar processor_count: Processor count. - :vartype processor_count: int - """ - - _validation = { - 'vm_profile': {'required': True}, - 'memory_in_bytes': {'readonly': True}, - 'processor_count': {'readonly': True}, - } - - _attribute_map = { - 'vm_profile': {'key': 'vmProfile', 'type': 'str'}, - 'memory_in_bytes': {'key': 'memoryInBytes', 'type': 'long'}, - 'processor_count': {'key': 'processorCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(KubernetesRoleCompute, self).__init__(**kwargs) - self.vm_profile = kwargs['vm_profile'] - self.memory_in_bytes = None - self.processor_count = None - - -class KubernetesRoleNetwork(msrest.serialization.Model): - """Kubernetes role network resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cni_config: Cni configuration. - :vartype cni_config: ~azure.mgmt.databoxedge.v2020_09_01.models.CniConfig - :ivar load_balancer_config: Load balancer configuration. - :vartype load_balancer_config: ~azure.mgmt.databoxedge.v2020_09_01.models.LoadBalancerConfig - """ - - _validation = { - 'cni_config': {'readonly': True}, - 'load_balancer_config': {'readonly': True}, - } - - _attribute_map = { - 'cni_config': {'key': 'cniConfig', 'type': 'CniConfig'}, - 'load_balancer_config': {'key': 'loadBalancerConfig', 'type': 'LoadBalancerConfig'}, - } - - def __init__( - self, - **kwargs - ): - super(KubernetesRoleNetwork, self).__init__(**kwargs) - self.cni_config = None - self.load_balancer_config = None - - -class KubernetesRoleResources(msrest.serialization.Model): - """Kubernetes role resources. - - 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 storage: Kubernetes role storage resource. - :type storage: ~azure.mgmt.databoxedge.v2020_09_01.models.KubernetesRoleStorage - :param compute: Required. Kubernetes role compute resource. - :type compute: ~azure.mgmt.databoxedge.v2020_09_01.models.KubernetesRoleCompute - :ivar network: Kubernetes role network resource. - :vartype network: ~azure.mgmt.databoxedge.v2020_09_01.models.KubernetesRoleNetwork - """ - - _validation = { - 'compute': {'required': True}, - 'network': {'readonly': True}, - } - - _attribute_map = { - 'storage': {'key': 'storage', 'type': 'KubernetesRoleStorage'}, - 'compute': {'key': 'compute', 'type': 'KubernetesRoleCompute'}, - 'network': {'key': 'network', 'type': 'KubernetesRoleNetwork'}, - } - - def __init__( - self, - **kwargs - ): - super(KubernetesRoleResources, self).__init__(**kwargs) - self.storage = kwargs.get('storage', None) - self.compute = kwargs['compute'] - self.network = None - - -class KubernetesRoleStorage(msrest.serialization.Model): - """Kubernetes role storage resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar storage_classes: Kubernetes storage class info. - :vartype storage_classes: - list[~azure.mgmt.databoxedge.v2020_09_01.models.KubernetesRoleStorageClassInfo] - :param endpoints: Mount points of shares in role(s). - :type endpoints: list[~azure.mgmt.databoxedge.v2020_09_01.models.MountPointMap] - """ - - _validation = { - 'storage_classes': {'readonly': True}, - } - - _attribute_map = { - 'storage_classes': {'key': 'storageClasses', 'type': '[KubernetesRoleStorageClassInfo]'}, - 'endpoints': {'key': 'endpoints', 'type': '[MountPointMap]'}, - } - - def __init__( - self, - **kwargs - ): - super(KubernetesRoleStorage, self).__init__(**kwargs) - self.storage_classes = None - self.endpoints = kwargs.get('endpoints', None) - - -class KubernetesRoleStorageClassInfo(msrest.serialization.Model): - """Kubernetes storage class info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Storage class name. - :vartype name: str - :ivar type: Storage class type. - :vartype type: str - :ivar posix_compliant: If provisioned storage is posix compliant. Possible values include: - "Invalid", "Enabled", "Disabled". - :vartype posix_compliant: str or - ~azure.mgmt.databoxedge.v2020_09_01.models.PosixComplianceStatus - """ - - _validation = { - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'posix_compliant': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'posix_compliant': {'key': 'posixCompliant', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KubernetesRoleStorageClassInfo, self).__init__(**kwargs) - self.name = None - self.type = None - self.posix_compliant = None - - -class LoadBalancerConfig(msrest.serialization.Model): - """Load balancer configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: Load balancer type. - :vartype type: str - :ivar version: Load balancer version. - :vartype version: str - """ - - _validation = { - 'type': {'readonly': True}, - 'version': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LoadBalancerConfig, self).__init__(**kwargs) - self.type = None - self.version = None - - -class MECRole(Role): - """MEC role. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", - "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleTypes - :ivar system_data: Role configured on ASE resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - :param connection_string: Activation key of the MEC. - :type connection_string: ~azure.mgmt.databoxedge.v2020_09_01.models.AsymmetricEncryptedSecret - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'connection_string': {'key': 'properties.connectionString', 'type': 'AsymmetricEncryptedSecret'}, - 'role_status': {'key': 'properties.roleStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MECRole, self).__init__(**kwargs) - self.kind = 'MEC' # type: str - self.connection_string = kwargs.get('connection_string', None) - self.role_status = kwargs.get('role_status', None) - - -class MetricConfiguration(msrest.serialization.Model): - """Metric configuration. - - All required parameters must be populated in order to send to Azure. - - :param resource_id: Required. The Resource ID on which the metrics should be pushed. - :type resource_id: str - :param mdm_account: The MDM account to which the counters should be pushed. - :type mdm_account: str - :param metric_name_space: The MDM namespace to which the counters should be pushed. This is - required if MDMAccount is specified. - :type metric_name_space: str - :param counter_sets: Required. Host name for the IoT hub associated to the device. - :type counter_sets: list[~azure.mgmt.databoxedge.v2020_09_01.models.MetricCounterSet] - """ - - _validation = { - 'resource_id': {'required': True}, - 'counter_sets': {'required': True}, - } - - _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'mdm_account': {'key': 'mdmAccount', 'type': 'str'}, - 'metric_name_space': {'key': 'metricNameSpace', 'type': 'str'}, - 'counter_sets': {'key': 'counterSets', 'type': '[MetricCounterSet]'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricConfiguration, self).__init__(**kwargs) - self.resource_id = kwargs['resource_id'] - self.mdm_account = kwargs.get('mdm_account', None) - self.metric_name_space = kwargs.get('metric_name_space', None) - self.counter_sets = kwargs['counter_sets'] - - -class MetricCounter(msrest.serialization.Model): - """The metric counter. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The counter name. - :type name: str - :param instance: The instance from which counter should be collected. - :type instance: str - :param dimension_filter: The dimension filter. - :type dimension_filter: list[~azure.mgmt.databoxedge.v2020_09_01.models.MetricDimension] - :param additional_dimensions: The additional dimensions to be added to metric. - :type additional_dimensions: list[~azure.mgmt.databoxedge.v2020_09_01.models.MetricDimension] - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'instance': {'key': 'instance', 'type': 'str'}, - 'dimension_filter': {'key': 'dimensionFilter', 'type': '[MetricDimension]'}, - 'additional_dimensions': {'key': 'additionalDimensions', 'type': '[MetricDimension]'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricCounter, self).__init__(**kwargs) - self.name = kwargs['name'] - self.instance = kwargs.get('instance', None) - self.dimension_filter = kwargs.get('dimension_filter', None) - self.additional_dimensions = kwargs.get('additional_dimensions', None) - - -class MetricCounterSet(msrest.serialization.Model): - """The metric counter set. - - All required parameters must be populated in order to send to Azure. - - :param counters: Required. The counters that should be collected in this set. - :type counters: list[~azure.mgmt.databoxedge.v2020_09_01.models.MetricCounter] - """ - - _validation = { - 'counters': {'required': True}, - } - - _attribute_map = { - 'counters': {'key': 'counters', 'type': '[MetricCounter]'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricCounterSet, self).__init__(**kwargs) - self.counters = kwargs['counters'] - - -class MetricDimension(msrest.serialization.Model): - """The metric dimension. - - All required parameters must be populated in order to send to Azure. - - :param source_type: Required. The dimension type. - :type source_type: str - :param source_name: Required. The dimension value. - :type source_name: str - """ - - _validation = { - 'source_type': {'required': True}, - 'source_name': {'required': True}, - } - - _attribute_map = { - 'source_type': {'key': 'sourceType', 'type': 'str'}, - 'source_name': {'key': 'sourceName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricDimension, self).__init__(**kwargs) - self.source_type = kwargs['source_type'] - self.source_name = kwargs['source_name'] - - -class MetricDimensionV1(msrest.serialization.Model): - """Metric Dimension v1. - - :param name: Name of the metrics dimension. - :type name: str - :param display_name: Display name of the metrics dimension. - :type display_name: str - :param to_be_exported_for_shoebox: To be exported to shoe box. - :type to_be_exported_for_shoebox: bool - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricDimensionV1, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) - - -class MetricSpecificationV1(msrest.serialization.Model): - """Metric specification version 1. - - :param name: Name of the metric. - :type name: str - :param display_name: Display name of the metric. - :type display_name: str - :param display_description: Description of the metric to be displayed. - :type display_description: str - :param unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", - "Seconds", "Milliseconds", "Bytes", "BytesPerSecond", "CountPerSecond". - :type unit: str or ~azure.mgmt.databoxedge.v2020_09_01.models.MetricUnit - :param aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", - "None", "Average", "Minimum", "Maximum", "Total", "Count". - :type aggregation_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.MetricAggregationType - :param dimensions: Metric dimensions, other than default dimension which is resource. - :type dimensions: list[~azure.mgmt.databoxedge.v2020_09_01.models.MetricDimensionV1] - :param fill_gap_with_zero: Set true to fill the gaps with zero. - :type fill_gap_with_zero: bool - :param category: Metric category. Possible values include: "Capacity", "Transaction". - :type category: str or ~azure.mgmt.databoxedge.v2020_09_01.models.MetricCategory - :param resource_id_dimension_name_override: Resource name override. - :type resource_id_dimension_name_override: str - :param supported_time_grain_types: Support granularity of metrics. - :type supported_time_grain_types: list[str or - ~azure.mgmt.databoxedge.v2020_09_01.models.TimeGrain] - :param supported_aggregation_types: Support metric aggregation type. - :type supported_aggregation_types: list[str or - ~azure.mgmt.databoxedge.v2020_09_01.models.MetricAggregationType] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[MetricDimensionV1]'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'category': {'key': 'category', 'type': 'str'}, - 'resource_id_dimension_name_override': {'key': 'resourceIdDimensionNameOverride', 'type': 'str'}, - 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, - 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricSpecificationV1, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.dimensions = kwargs.get('dimensions', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.category = kwargs.get('category', None) - self.resource_id_dimension_name_override = kwargs.get('resource_id_dimension_name_override', None) - self.supported_time_grain_types = kwargs.get('supported_time_grain_types', None) - self.supported_aggregation_types = kwargs.get('supported_aggregation_types', None) - - -class MonitoringMetricConfiguration(ARMBaseModel): - """The metric setting details for the role. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param metric_configurations: Required. The metrics configuration details. - :type metric_configurations: - list[~azure.mgmt.databoxedge.v2020_09_01.models.MetricConfiguration] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'metric_configurations': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'metric_configurations': {'key': 'properties.metricConfigurations', 'type': '[MetricConfiguration]'}, - } - - def __init__( - self, - **kwargs - ): - super(MonitoringMetricConfiguration, self).__init__(**kwargs) - self.metric_configurations = kwargs['metric_configurations'] - - -class MonitoringMetricConfigurationList(msrest.serialization.Model): - """Collection of metric configurations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of metric configurations. - :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01.models.MonitoringMetricConfiguration] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[MonitoringMetricConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MonitoringMetricConfigurationList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class MountPointMap(msrest.serialization.Model): - """The share mount point. - - 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 share_id: Required. ID of the share mounted to the role VM. - :type share_id: str - :ivar role_id: ID of the role to which share is mounted. - :vartype role_id: str - :ivar mount_point: Mount point for the share. - :vartype mount_point: str - :ivar mount_type: Mounting type. Possible values include: "Volume", "HostPath". - :vartype mount_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.MountType - :ivar role_type: Role type. Possible values include: "IOT", "ASA", "Functions", "Cognitive", - "MEC", "CloudEdgeManagement", "Kubernetes". - :vartype role_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleTypes - """ - - _validation = { - 'share_id': {'required': True}, - 'role_id': {'readonly': True}, - 'mount_point': {'readonly': True}, - 'mount_type': {'readonly': True}, - 'role_type': {'readonly': True}, - } - - _attribute_map = { - 'share_id': {'key': 'shareId', 'type': 'str'}, - 'role_id': {'key': 'roleId', 'type': 'str'}, - 'mount_point': {'key': 'mountPoint', 'type': 'str'}, - 'mount_type': {'key': 'mountType', 'type': 'str'}, - 'role_type': {'key': 'roleType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MountPointMap, self).__init__(**kwargs) - self.share_id = kwargs['share_id'] - self.role_id = None - self.mount_point = None - self.mount_type = None - self.role_type = None - - -class NetworkAdapter(msrest.serialization.Model): - """Represents the networkAdapter on a device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar adapter_id: Instance ID of network adapter. - :vartype adapter_id: str - :ivar adapter_position: Hardware position of network adapter. - :vartype adapter_position: ~azure.mgmt.databoxedge.v2020_09_01.models.NetworkAdapterPosition - :ivar index: Logical index of the adapter. - :vartype index: int - :ivar node_id: Node ID of the network adapter. - :vartype node_id: str - :ivar network_adapter_name: Network adapter name. - :vartype network_adapter_name: str - :ivar label: Hardware label for the adapter. - :vartype label: str - :ivar mac_address: MAC address. - :vartype mac_address: str - :ivar link_speed: Link speed. - :vartype link_speed: long - :ivar status: Value indicating whether this adapter is valid. Possible values include: - "Inactive", "Active". - :vartype status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.NetworkAdapterStatus - :param rdma_status: Value indicating whether this adapter is RDMA capable. Possible values - include: "Incapable", "Capable". - :type rdma_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.NetworkAdapterRDMAStatus - :param dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values - include: "Disabled", "Enabled". - :type dhcp_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.NetworkAdapterDHCPStatus - :ivar ipv4_configuration: The IPv4 configuration of the network adapter. - :vartype ipv4_configuration: ~azure.mgmt.databoxedge.v2020_09_01.models.Ipv4Config - :ivar ipv6_configuration: The IPv6 configuration of the network adapter. - :vartype ipv6_configuration: ~azure.mgmt.databoxedge.v2020_09_01.models.Ipv6Config - :ivar ipv6_link_local_address: The IPv6 local address. - :vartype ipv6_link_local_address: str - :ivar dns_servers: The list of DNS Servers of the device. - :vartype dns_servers: list[str] - """ - - _validation = { - 'adapter_id': {'readonly': True}, - 'adapter_position': {'readonly': True}, - 'index': {'readonly': True}, - 'node_id': {'readonly': True}, - 'network_adapter_name': {'readonly': True}, - 'label': {'readonly': True}, - 'mac_address': {'readonly': True}, - 'link_speed': {'readonly': True}, - 'status': {'readonly': True}, - 'ipv4_configuration': {'readonly': True}, - 'ipv6_configuration': {'readonly': True}, - 'ipv6_link_local_address': {'readonly': True}, - 'dns_servers': {'readonly': True}, - } - - _attribute_map = { - 'adapter_id': {'key': 'adapterId', 'type': 'str'}, - 'adapter_position': {'key': 'adapterPosition', 'type': 'NetworkAdapterPosition'}, - 'index': {'key': 'index', 'type': 'int'}, - 'node_id': {'key': 'nodeId', 'type': 'str'}, - 'network_adapter_name': {'key': 'networkAdapterName', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'mac_address': {'key': 'macAddress', 'type': 'str'}, - 'link_speed': {'key': 'linkSpeed', 'type': 'long'}, - 'status': {'key': 'status', 'type': 'str'}, - 'rdma_status': {'key': 'rdmaStatus', 'type': 'str'}, - 'dhcp_status': {'key': 'dhcpStatus', 'type': 'str'}, - 'ipv4_configuration': {'key': 'ipv4Configuration', 'type': 'Ipv4Config'}, - 'ipv6_configuration': {'key': 'ipv6Configuration', 'type': 'Ipv6Config'}, - 'ipv6_link_local_address': {'key': 'ipv6LinkLocalAddress', 'type': 'str'}, - 'dns_servers': {'key': 'dnsServers', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkAdapter, self).__init__(**kwargs) - self.adapter_id = None - self.adapter_position = None - self.index = None - self.node_id = None - self.network_adapter_name = None - self.label = None - self.mac_address = None - self.link_speed = None - self.status = None - self.rdma_status = kwargs.get('rdma_status', None) - self.dhcp_status = kwargs.get('dhcp_status', None) - self.ipv4_configuration = None - self.ipv6_configuration = None - self.ipv6_link_local_address = None - self.dns_servers = None - - -class NetworkAdapterPosition(msrest.serialization.Model): - """The network adapter position. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar network_group: The network group. Possible values include: "None", "NonRDMA", "RDMA". - :vartype network_group: str or ~azure.mgmt.databoxedge.v2020_09_01.models.NetworkGroup - :ivar port: The port. - :vartype port: int - """ - - _validation = { - 'network_group': {'readonly': True}, - 'port': {'readonly': True}, - } - - _attribute_map = { - 'network_group': {'key': 'networkGroup', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkAdapterPosition, self).__init__(**kwargs) - self.network_group = None - self.port = None - - -class NetworkSettings(ARMBaseModel): - """The network settings of a device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar network_adapters: The network adapter list on the device. - :vartype network_adapters: list[~azure.mgmt.databoxedge.v2020_09_01.models.NetworkAdapter] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'network_adapters': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'network_adapters': {'key': 'properties.networkAdapters', 'type': '[NetworkAdapter]'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkSettings, self).__init__(**kwargs) - self.network_adapters = None - - -class Node(ARMBaseModel): - """Represents a single node in a Data box Edge/Gateway device -Gateway devices, standalone Edge devices and a single node cluster Edge device will all have 1 node -Multi-node Edge devices will have more than 1 nodes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar node_status: The current status of the individual node. Possible values include: - "Unknown", "Up", "Down", "Rebooting", "ShuttingDown". - :vartype node_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.NodeStatus - :ivar node_chassis_serial_number: Serial number of the Chassis. - :vartype node_chassis_serial_number: str - :ivar node_serial_number: Serial number of the individual node. - :vartype node_serial_number: str - :ivar node_display_name: Display Name of the individual node. - :vartype node_display_name: str - :ivar node_friendly_software_version: Friendly software version name that is currently - installed on the node. - :vartype node_friendly_software_version: str - :ivar node_hcs_version: HCS version that is currently installed on the node. - :vartype node_hcs_version: str - :ivar node_instance_id: Guid instance id of the node. - :vartype node_instance_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'node_status': {'readonly': True}, - 'node_chassis_serial_number': {'readonly': True}, - 'node_serial_number': {'readonly': True}, - 'node_display_name': {'readonly': True}, - 'node_friendly_software_version': {'readonly': True}, - 'node_hcs_version': {'readonly': True}, - 'node_instance_id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'node_status': {'key': 'properties.nodeStatus', 'type': 'str'}, - 'node_chassis_serial_number': {'key': 'properties.nodeChassisSerialNumber', 'type': 'str'}, - 'node_serial_number': {'key': 'properties.nodeSerialNumber', 'type': 'str'}, - 'node_display_name': {'key': 'properties.nodeDisplayName', 'type': 'str'}, - 'node_friendly_software_version': {'key': 'properties.nodeFriendlySoftwareVersion', 'type': 'str'}, - 'node_hcs_version': {'key': 'properties.nodeHcsVersion', 'type': 'str'}, - 'node_instance_id': {'key': 'properties.nodeInstanceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Node, self).__init__(**kwargs) - self.node_status = None - self.node_chassis_serial_number = None - self.node_serial_number = None - self.node_display_name = None - self.node_friendly_software_version = None - self.node_hcs_version = None - self.node_instance_id = None - - -class NodeInfo(msrest.serialization.Model): - """Kubernetes node info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Node name. - :vartype name: str - :ivar type: Node type - Master/Worker. Possible values include: "Invalid", "Master", "Worker". - :vartype type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.KubernetesNodeType - :param ip_configuration: IP Configuration of the Kubernetes node. - :type ip_configuration: - list[~azure.mgmt.databoxedge.v2020_09_01.models.KubernetesIPConfiguration] - """ - - _validation = { - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'ip_configuration': {'key': 'ipConfiguration', 'type': '[KubernetesIPConfiguration]'}, - } - - def __init__( - self, - **kwargs - ): - super(NodeInfo, self).__init__(**kwargs) - self.name = None - self.type = None - self.ip_configuration = kwargs.get('ip_configuration', None) - - -class NodeList(msrest.serialization.Model): - """Collection of Nodes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of Nodes. - :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01.models.Node] - :param next_link: Link to the next set of results. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Node]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NodeList, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class Operation(msrest.serialization.Model): - """Operations. - - :param name: Name of the operation. - :type name: str - :param display: Properties displayed for the operation. - :type display: ~azure.mgmt.databoxedge.v2020_09_01.models.OperationDisplay - :param origin: Origin of the operation. - :type origin: str - :param is_data_action: Indicates whether the operation is a data action. - :type is_data_action: bool - :param service_specification: Service specification. - :type service_specification: ~azure.mgmt.databoxedge.v2020_09_01.models.ServiceSpecification - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.is_data_action = kwargs.get('is_data_action', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplay(msrest.serialization.Model): - """Operation display properties. - - :param provider: Provider name. - :type provider: str - :param resource: The type of resource in which the operation is performed. - :type resource: str - :param operation: Operation to be performed on the resource. - :type operation: str - :param description: Description of the operation to be performed. - :type description: str - """ - - _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 - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationsList(msrest.serialization.Model): - """The list of operations used for the discovery of available provider operations. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The value. - :type value: list[~azure.mgmt.databoxedge.v2020_09_01.models.Operation] - :param next_link: Link to the next set of results. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationsList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class Order(ARMBaseModel): - """The order details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param contact_information: The contact details. - :type contact_information: ~azure.mgmt.databoxedge.v2020_09_01.models.ContactDetails - :param shipping_address: The shipping address. - :type shipping_address: ~azure.mgmt.databoxedge.v2020_09_01.models.Address - :ivar current_status: Current status of the order. - :vartype current_status: ~azure.mgmt.databoxedge.v2020_09_01.models.OrderStatus - :ivar order_history: List of status changes in the order. - :vartype order_history: list[~azure.mgmt.databoxedge.v2020_09_01.models.OrderStatus] - :ivar serial_number: Serial number of the device. - :vartype serial_number: str - :ivar delivery_tracking_info: Tracking information for the package delivered to the customer - whether it has an original or a replacement device. - :vartype delivery_tracking_info: list[~azure.mgmt.databoxedge.v2020_09_01.models.TrackingInfo] - :ivar return_tracking_info: Tracking information for the package returned from the customer - whether it has an original or a replacement device. - :vartype return_tracking_info: list[~azure.mgmt.databoxedge.v2020_09_01.models.TrackingInfo] - :param shipment_type: ShipmentType of the order. Possible values include: "NotApplicable", - "ShippedToCustomer", "SelfPickup". - :type shipment_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.ShipmentType - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'current_status': {'readonly': True}, - 'order_history': {'readonly': True}, - 'serial_number': {'readonly': True}, - 'delivery_tracking_info': {'readonly': True}, - 'return_tracking_info': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'contact_information': {'key': 'properties.contactInformation', 'type': 'ContactDetails'}, - 'shipping_address': {'key': 'properties.shippingAddress', 'type': 'Address'}, - 'current_status': {'key': 'properties.currentStatus', 'type': 'OrderStatus'}, - 'order_history': {'key': 'properties.orderHistory', 'type': '[OrderStatus]'}, - 'serial_number': {'key': 'properties.serialNumber', 'type': 'str'}, - 'delivery_tracking_info': {'key': 'properties.deliveryTrackingInfo', 'type': '[TrackingInfo]'}, - 'return_tracking_info': {'key': 'properties.returnTrackingInfo', 'type': '[TrackingInfo]'}, - 'shipment_type': {'key': 'properties.shipmentType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Order, self).__init__(**kwargs) - self.contact_information = kwargs.get('contact_information', None) - self.shipping_address = kwargs.get('shipping_address', None) - self.current_status = None - self.order_history = None - self.serial_number = None - self.delivery_tracking_info = None - self.return_tracking_info = None - self.shipment_type = kwargs.get('shipment_type', None) - - -class OrderList(msrest.serialization.Model): - """List of order entities. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of orders. - :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01.models.Order] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Order]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OrderList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class OrderStatus(msrest.serialization.Model): - """Represents a single status change. - - 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 status: Required. Status of the order as per the allowed status types. Possible values - include: "Untracked", "AwaitingFulfilment", "AwaitingPreparation", "AwaitingShipment", - "Shipped", "Arriving", "Delivered", "ReplacementRequested", "LostDevice", "Declined", - "ReturnInitiated", "AwaitingReturnShipment", "ShippedBack", "CollectedAtMicrosoft", - "AwaitingPickup", "PickupCompleted", "AwaitingDrop". - :type status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.OrderState - :ivar update_date_time: Time of status update. - :vartype update_date_time: ~datetime.datetime - :param comments: Comments related to this status change. - :type comments: str - :ivar tracking_information: Tracking information related to the state in the ordering flow. - :vartype tracking_information: ~azure.mgmt.databoxedge.v2020_09_01.models.TrackingInfo - :ivar additional_order_details: Dictionary to hold generic information which is not stored - by the already existing properties. - :vartype additional_order_details: dict[str, str] - """ - - _validation = { - 'status': {'required': True}, - 'update_date_time': {'readonly': True}, - 'tracking_information': {'readonly': True}, - 'additional_order_details': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'update_date_time': {'key': 'updateDateTime', 'type': 'iso-8601'}, - 'comments': {'key': 'comments', 'type': 'str'}, - 'tracking_information': {'key': 'trackingInformation', 'type': 'TrackingInfo'}, - 'additional_order_details': {'key': 'additionalOrderDetails', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(OrderStatus, self).__init__(**kwargs) - self.status = kwargs['status'] - self.update_date_time = None - self.comments = kwargs.get('comments', None) - self.tracking_information = None - self.additional_order_details = None - - -class PeriodicTimerEventTrigger(Trigger): - """Trigger details. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar system_data: Trigger in DataBoxEdge Resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: - "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.TriggerEventType - :param source_info: Required. Periodic timer details. - :type source_info: ~azure.mgmt.databoxedge.v2020_09_01.models.PeriodicTimerSourceInfo - :param sink_info: Required. Role Sink information. - :type sink_info: ~azure.mgmt.databoxedge.v2020_09_01.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against - its usage. For example, if a periodic timer trigger is intended for certain specific IoT - modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'kind': {'required': True}, - 'source_info': {'required': True}, - 'sink_info': {'required': True}, - 'custom_context_tag': {'max_length': 192, 'min_length': 0}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'source_info': {'key': 'properties.sourceInfo', 'type': 'PeriodicTimerSourceInfo'}, - 'sink_info': {'key': 'properties.sinkInfo', 'type': 'RoleSinkInfo'}, - 'custom_context_tag': {'key': 'properties.customContextTag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PeriodicTimerEventTrigger, self).__init__(**kwargs) - self.kind = 'PeriodicTimerEvent' # type: str - self.source_info = kwargs['source_info'] - self.sink_info = kwargs['sink_info'] - self.custom_context_tag = kwargs.get('custom_context_tag', None) - - -class PeriodicTimerSourceInfo(msrest.serialization.Model): - """Periodic timer event source. - - All required parameters must be populated in order to send to Azure. - - :param start_time: Required. The time of the day that results in a valid trigger. Schedule is - computed with reference to the time specified upto seconds. If timezone is not specified the - time will considered to be in device timezone. The value will always be returned as UTC time. - :type start_time: ~datetime.datetime - :param schedule: Required. Periodic frequency at which timer event needs to be raised. Supports - daily, hourly, minutes, and seconds. - :type schedule: str - :param topic: Topic where periodic events are published to IoT device. - :type topic: str - """ - - _validation = { - 'start_time': {'required': True}, - 'schedule': {'required': True}, - } - - _attribute_map = { - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'schedule': {'key': 'schedule', 'type': 'str'}, - 'topic': {'key': 'topic', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PeriodicTimerSourceInfo, self).__init__(**kwargs) - self.start_time = kwargs['start_time'] - self.schedule = kwargs['schedule'] - self.topic = kwargs.get('topic', None) - - -class RefreshDetails(msrest.serialization.Model): - """Fields for tracking refresh job on the share or container. - - :param in_progress_refresh_job_id: If a refresh job is currently in progress on this share or - container, this field indicates the ARM resource ID of that job. The field is empty if no job - is in progress. - :type in_progress_refresh_job_id: str - :param last_completed_refresh_job_time_in_utc: Indicates the completed time for the last - refresh job on this particular share or container, if any.This could be a failed job or a - successful job. - :type last_completed_refresh_job_time_in_utc: ~datetime.datetime - :param error_manifest_file: Indicates the relative path of the error xml for the last refresh - job on this particular share or container, if any. This could be a failed job or a successful - job. - :type error_manifest_file: str - :param last_job: Indicates the id of the last refresh job on this particular share or - container,if any. This could be a failed job or a successful job. - :type last_job: str - """ - - _attribute_map = { - 'in_progress_refresh_job_id': {'key': 'inProgressRefreshJobId', 'type': 'str'}, - 'last_completed_refresh_job_time_in_utc': {'key': 'lastCompletedRefreshJobTimeInUTC', 'type': 'iso-8601'}, - 'error_manifest_file': {'key': 'errorManifestFile', 'type': 'str'}, - 'last_job': {'key': 'lastJob', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RefreshDetails, self).__init__(**kwargs) - self.in_progress_refresh_job_id = kwargs.get('in_progress_refresh_job_id', None) - self.last_completed_refresh_job_time_in_utc = kwargs.get('last_completed_refresh_job_time_in_utc', None) - self.error_manifest_file = kwargs.get('error_manifest_file', None) - self.last_job = kwargs.get('last_job', None) - - -class ResourceIdentity(msrest.serialization.Model): - """Msi identity details of the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param type: Identity type. Possible values include: "None", "SystemAssigned", "UserAssigned". - :type type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.MsiIdentityType - :ivar principal_id: Service Principal Id backing the Msi. - :vartype principal_id: str - :ivar tenant_id: Home Tenant Id. - :vartype tenant_id: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceIdentity, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.principal_id = None - self.tenant_id = None - - -class ResourceMoveDetails(msrest.serialization.Model): - """Fields for tracking resource move. - - :param operation_in_progress: Denotes whether move operation is in progress. Possible values - include: "None", "ResourceMoveInProgress", "ResourceMoveFailed". - :type operation_in_progress: str or - ~azure.mgmt.databoxedge.v2020_09_01.models.ResourceMoveStatus - :param operation_in_progress_lock_timeout_in_utc: Denotes the timeout of the operation to - finish. - :type operation_in_progress_lock_timeout_in_utc: ~datetime.datetime - """ - - _attribute_map = { - 'operation_in_progress': {'key': 'operationInProgress', 'type': 'str'}, - 'operation_in_progress_lock_timeout_in_utc': {'key': 'operationInProgressLockTimeoutInUTC', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceMoveDetails, self).__init__(**kwargs) - self.operation_in_progress = kwargs.get('operation_in_progress', None) - self.operation_in_progress_lock_timeout_in_utc = kwargs.get('operation_in_progress_lock_timeout_in_utc', None) - - -class ResourceTypeSku(msrest.serialization.Model): - """Resource type Sku object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar resource_type: The resource type. - :vartype resource_type: str - :ivar skus: The skus. - :vartype skus: list[~azure.mgmt.databoxedge.v2020_09_01.models.SkuInformation] - """ - - _validation = { - 'resource_type': {'readonly': True}, - 'skus': {'readonly': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'skus': {'key': 'skus', 'type': '[SkuInformation]'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceTypeSku, self).__init__(**kwargs) - self.resource_type = None - self.skus = None - - -class RoleList(msrest.serialization.Model): - """Collection of all the roles on the Data Box Edge device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The Value. - :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01.models.Role] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Role]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RoleList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class RoleSinkInfo(msrest.serialization.Model): - """Compute role against which events will be raised. - - All required parameters must be populated in order to send to Azure. - - :param role_id: Required. Compute role ID. - :type role_id: str - """ - - _validation = { - 'role_id': {'required': True}, - } - - _attribute_map = { - 'role_id': {'key': 'roleId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RoleSinkInfo, self).__init__(**kwargs) - self.role_id = kwargs['role_id'] - - -class SecuritySettings(ARMBaseModel): - """The security settings of a device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param device_admin_password: Required. Device administrator password as an encrypted string - (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual - password should have at least 8 characters that are a combination of uppercase, lowercase, - numeric, and special characters. - :type device_admin_password: - ~azure.mgmt.databoxedge.v2020_09_01.models.AsymmetricEncryptedSecret - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'device_admin_password': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'device_admin_password': {'key': 'properties.deviceAdminPassword', 'type': 'AsymmetricEncryptedSecret'}, - } - - def __init__( - self, - **kwargs - ): - super(SecuritySettings, self).__init__(**kwargs) - self.device_admin_password = kwargs['device_admin_password'] - - -class ServiceSpecification(msrest.serialization.Model): - """Service specification. - - :param metric_specifications: Metric specification as defined by shoebox. - :type metric_specifications: - list[~azure.mgmt.databoxedge.v2020_09_01.models.MetricSpecificationV1] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecificationV1]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class Share(ARMBaseModel): - """Represents a share on the Data Box Edge/Gateway device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar system_data: Share on ASE device. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - :param description: Description for the share. - :type description: str - :param share_status: Required. Current status of the share. Possible values include: "Offline", - "Unknown", "OK", "Updating", "NeedsAttention". - :type share_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.ShareStatus - :param monitoring_status: Required. Current monitoring status of the share. Possible values - include: "Enabled", "Disabled". - :type monitoring_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.MonitoringStatus - :param azure_container_info: Azure container mapping for the share. - :type azure_container_info: ~azure.mgmt.databoxedge.v2020_09_01.models.AzureContainerInfo - :param access_protocol: Required. Access protocol to be used by the share. Possible values - include: "SMB", "NFS". - :type access_protocol: str or ~azure.mgmt.databoxedge.v2020_09_01.models.ShareAccessProtocol - :param user_access_rights: Mapping of users and corresponding access rights on the share - (required for SMB protocol). - :type user_access_rights: list[~azure.mgmt.databoxedge.v2020_09_01.models.UserAccessRight] - :param client_access_rights: List of IP addresses and corresponding access rights on the - share(required for NFS protocol). - :type client_access_rights: list[~azure.mgmt.databoxedge.v2020_09_01.models.ClientAccessRight] - :param refresh_details: Details of the refresh job on this share. - :type refresh_details: ~azure.mgmt.databoxedge.v2020_09_01.models.RefreshDetails - :ivar share_mappings: Share mount point to the role. - :vartype share_mappings: list[~azure.mgmt.databoxedge.v2020_09_01.models.MountPointMap] - :param data_policy: Data policy of the share. Possible values include: "Cloud", "Local". - :type data_policy: str or ~azure.mgmt.databoxedge.v2020_09_01.models.DataPolicy - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'share_status': {'required': True}, - 'monitoring_status': {'required': True}, - 'access_protocol': {'required': True}, - 'share_mappings': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'share_status': {'key': 'properties.shareStatus', 'type': 'str'}, - 'monitoring_status': {'key': 'properties.monitoringStatus', 'type': 'str'}, - 'azure_container_info': {'key': 'properties.azureContainerInfo', 'type': 'AzureContainerInfo'}, - 'access_protocol': {'key': 'properties.accessProtocol', 'type': 'str'}, - 'user_access_rights': {'key': 'properties.userAccessRights', 'type': '[UserAccessRight]'}, - 'client_access_rights': {'key': 'properties.clientAccessRights', 'type': '[ClientAccessRight]'}, - 'refresh_details': {'key': 'properties.refreshDetails', 'type': 'RefreshDetails'}, - 'share_mappings': {'key': 'properties.shareMappings', 'type': '[MountPointMap]'}, - 'data_policy': {'key': 'properties.dataPolicy', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Share, self).__init__(**kwargs) - self.system_data = None - self.description = kwargs.get('description', None) - self.share_status = kwargs['share_status'] - self.monitoring_status = kwargs['monitoring_status'] - self.azure_container_info = kwargs.get('azure_container_info', None) - self.access_protocol = kwargs['access_protocol'] - self.user_access_rights = kwargs.get('user_access_rights', None) - self.client_access_rights = kwargs.get('client_access_rights', None) - self.refresh_details = kwargs.get('refresh_details', None) - self.share_mappings = None - self.data_policy = kwargs.get('data_policy', None) - - -class ShareAccessRight(msrest.serialization.Model): - """Specifies the mapping between this particular user and the type of access he has on shares on this device. - - All required parameters must be populated in order to send to Azure. - - :param share_id: Required. The share ID. - :type share_id: str - :param access_type: Required. Type of access to be allowed on the share for this user. Possible - values include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.ShareAccessType - """ - - _validation = { - 'share_id': {'required': True}, - 'access_type': {'required': True}, - } - - _attribute_map = { - 'share_id': {'key': 'shareId', 'type': 'str'}, - 'access_type': {'key': 'accessType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ShareAccessRight, self).__init__(**kwargs) - self.share_id = kwargs['share_id'] - self.access_type = kwargs['access_type'] - - -class ShareList(msrest.serialization.Model): - """Collection of all the shares on the Data Box Edge/Gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of shares. - :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01.models.Share] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Share]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ShareList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class Sku(msrest.serialization.Model): - """The SKU type. - - :param name: SKU name. Possible values include: "Gateway", "Edge", "TEA_1Node", - "TEA_1Node_UPS", "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", - "TEA_4Node_UPS_Heater", "TMA", "TDC", "TCA_Small", "GPU", "TCA_Large", "EdgeP_Base", - "EdgeP_High", "EdgePR_Base", "EdgePR_Base_UPS", "EdgeMR_Mini", "RCA_Small", "RCA_Large", "RDC". - :type name: str or ~azure.mgmt.databoxedge.v2020_09_01.models.SkuName - :param tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard". - :type tier: str or ~azure.mgmt.databoxedge.v2020_09_01.models.SkuTier - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = kwargs.get('tier', None) - - -class SkuCost(msrest.serialization.Model): - """The metadata for retrieving price info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar meter_id: Used for querying price from commerce. - :vartype meter_id: str - :ivar quantity: The cost quantity. - :vartype quantity: long - :ivar extended_unit: The extended unit. - :vartype extended_unit: str - """ - - _validation = { - 'meter_id': {'readonly': True}, - 'quantity': {'readonly': True}, - 'extended_unit': {'readonly': True}, - } - - _attribute_map = { - 'meter_id': {'key': 'meterId', 'type': 'str'}, - 'quantity': {'key': 'quantity', 'type': 'long'}, - 'extended_unit': {'key': 'extendedUnit', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuCost, self).__init__(**kwargs) - self.meter_id = None - self.quantity = None - self.extended_unit = None - - -class SkuInformation(msrest.serialization.Model): - """Sku information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The sku name. - :vartype name: str - :ivar tier: The sku tier. - :vartype tier: str - :ivar kind: The sku kind. - :vartype kind: str - :ivar family: The Sku family. - :vartype family: str - :ivar costs: The pricing info of the Sku. - :vartype costs: list[~azure.mgmt.databoxedge.v2020_09_01.models.SkuCost] - :ivar locations: The locations where Sku is available. - :vartype locations: list[str] - :ivar location_info: The locations where Sku is available with zones and sites info. - :vartype location_info: list[~azure.mgmt.databoxedge.v2020_09_01.models.SkuLocationInfo] - :ivar required_quota_ids: The required quotaIds for the sku to be available. - :vartype required_quota_ids: list[str] - :ivar required_features: The required features for the sku to be available. - :vartype required_features: list[str] - """ - - _validation = { - 'name': {'readonly': True}, - 'tier': {'readonly': True}, - 'kind': {'readonly': True}, - 'family': {'readonly': True}, - 'costs': {'readonly': True}, - 'locations': {'readonly': True}, - 'location_info': {'readonly': True}, - 'required_quota_ids': {'readonly': True}, - 'required_features': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'family': {'key': 'family', 'type': 'str'}, - 'costs': {'key': 'costs', 'type': '[SkuCost]'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'location_info': {'key': 'locationInfo', 'type': '[SkuLocationInfo]'}, - 'required_quota_ids': {'key': 'requiredQuotaIds', 'type': '[str]'}, - 'required_features': {'key': 'requiredFeatures', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuInformation, self).__init__(**kwargs) - self.name = None - self.tier = None - self.kind = None - self.family = None - self.costs = None - self.locations = None - self.location_info = None - self.required_quota_ids = None - self.required_features = None - - -class SkuInformationList(msrest.serialization.Model): - """List of SKU Information objects. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of ResourceTypeSku objects. - :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01.models.ResourceTypeSku] - :ivar next_link: Links to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceTypeSku]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuInformationList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SkuLocationInfo(msrest.serialization.Model): - """The location info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar location: The location. - :vartype location: str - :ivar zones: The zones. - :vartype zones: list[str] - :ivar sites: The sites. - :vartype sites: list[str] - """ - - _validation = { - 'location': {'readonly': True}, - 'zones': {'readonly': True}, - 'sites': {'readonly': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'sites': {'key': 'sites', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuLocationInfo, self).__init__(**kwargs) - self.location = None - self.zones = None - self.sites = None - - -class StorageAccount(ARMBaseModel): - """Represents a Storage Account on the Data Box Edge/Gateway device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar system_data: StorageAccount object on ASE device. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - :param description: Description for the storage Account. - :type description: str - :param storage_account_status: Current status of the storage account. Possible values include: - "OK", "Offline", "Unknown", "Updating", "NeedsAttention". - :type storage_account_status: str or - ~azure.mgmt.databoxedge.v2020_09_01.models.StorageAccountStatus - :param data_policy: Required. Data policy of the storage Account. Possible values include: - "Cloud", "Local". - :type data_policy: str or ~azure.mgmt.databoxedge.v2020_09_01.models.DataPolicy - :param storage_account_credential_id: Storage Account Credential Id. - :type storage_account_credential_id: str - :ivar blob_endpoint: BlobEndpoint of Storage Account. - :vartype blob_endpoint: str - :ivar container_count: The Container Count. Present only for Storage Accounts with DataPolicy - set to Cloud. - :vartype container_count: int - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'data_policy': {'required': True}, - 'blob_endpoint': {'readonly': True}, - 'container_count': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'storage_account_status': {'key': 'properties.storageAccountStatus', 'type': 'str'}, - 'data_policy': {'key': 'properties.dataPolicy', 'type': 'str'}, - 'storage_account_credential_id': {'key': 'properties.storageAccountCredentialId', 'type': 'str'}, - 'blob_endpoint': {'key': 'properties.blobEndpoint', 'type': 'str'}, - 'container_count': {'key': 'properties.containerCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccount, self).__init__(**kwargs) - self.system_data = None - self.description = kwargs.get('description', None) - self.storage_account_status = kwargs.get('storage_account_status', None) - self.data_policy = kwargs['data_policy'] - self.storage_account_credential_id = kwargs.get('storage_account_credential_id', None) - self.blob_endpoint = None - self.container_count = None - - -class StorageAccountCredential(ARMBaseModel): - """The storage account credential. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar system_data: StorageAccountCredential object. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - :param alias: Required. Alias for the storage account. - :type alias: str - :param user_name: Username for the storage account. - :type user_name: str - :param account_key: Encrypted storage key. - :type account_key: ~azure.mgmt.databoxedge.v2020_09_01.models.AsymmetricEncryptedSecret - :param connection_string: Connection string for the storage account. Use this string if - username and account key are not specified. - :type connection_string: str - :param ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible values - include: "Enabled", "Disabled". - :type ssl_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.SSLStatus - :param blob_domain_name: Blob end point for private clouds. - :type blob_domain_name: str - :param account_type: Required. Type of storage accessed on the storage account. Possible values - include: "GeneralPurposeStorage", "BlobStorage". - :type account_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.AccountType - :param storage_account_id: Id of the storage account. - :type storage_account_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'alias': {'required': True}, - 'ssl_status': {'required': True}, - 'account_type': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'alias': {'key': 'properties.alias', 'type': 'str'}, - 'user_name': {'key': 'properties.userName', 'type': 'str'}, - 'account_key': {'key': 'properties.accountKey', 'type': 'AsymmetricEncryptedSecret'}, - 'connection_string': {'key': 'properties.connectionString', 'type': 'str'}, - 'ssl_status': {'key': 'properties.sslStatus', 'type': 'str'}, - 'blob_domain_name': {'key': 'properties.blobDomainName', 'type': 'str'}, - 'account_type': {'key': 'properties.accountType', 'type': 'str'}, - 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCredential, self).__init__(**kwargs) - self.system_data = None - self.alias = kwargs['alias'] - self.user_name = kwargs.get('user_name', None) - self.account_key = kwargs.get('account_key', None) - self.connection_string = kwargs.get('connection_string', None) - self.ssl_status = kwargs['ssl_status'] - self.blob_domain_name = kwargs.get('blob_domain_name', None) - self.account_type = kwargs['account_type'] - self.storage_account_id = kwargs.get('storage_account_id', None) - - -class StorageAccountCredentialList(msrest.serialization.Model): - """The collection of storage account credentials. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The value. - :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01.models.StorageAccountCredential] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccountCredential]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCredentialList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class StorageAccountList(msrest.serialization.Model): - """Collection of all the Storage Accounts on the Data Box Edge/Gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of storageAccounts. - :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01.models.StorageAccount] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccount]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SubscriptionRegisteredFeatures(msrest.serialization.Model): - """SubscriptionRegisteredFeatures. - - :param name: - :type name: str - :param state: - :type state: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SubscriptionRegisteredFeatures, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.state = kwargs.get('state', None) - - -class SymmetricKey(msrest.serialization.Model): - """Symmetric key for authentication. - - :param connection_string: Connection string based on the symmetric key. - :type connection_string: ~azure.mgmt.databoxedge.v2020_09_01.models.AsymmetricEncryptedSecret - """ - - _attribute_map = { - 'connection_string': {'key': 'connectionString', 'type': 'AsymmetricEncryptedSecret'}, - } - - def __init__( - self, - **kwargs - ): - super(SymmetricKey, self).__init__(**kwargs) - self.connection_string = kwargs.get('connection_string', None) - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.CreatedByType - :param last_modified_at: The type of identity that last modified the resource. - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class TrackingInfo(msrest.serialization.Model): - """Tracking courier information. - - :param serial_number: Serial number of the device being tracked. - :type serial_number: str - :param carrier_name: Name of the carrier used in the delivery. - :type carrier_name: str - :param tracking_id: Tracking ID of the shipment. - :type tracking_id: str - :param tracking_url: Tracking URL of the shipment. - :type tracking_url: str - """ - - _attribute_map = { - 'serial_number': {'key': 'serialNumber', 'type': 'str'}, - 'carrier_name': {'key': 'carrierName', 'type': 'str'}, - 'tracking_id': {'key': 'trackingId', 'type': 'str'}, - 'tracking_url': {'key': 'trackingUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackingInfo, self).__init__(**kwargs) - self.serial_number = kwargs.get('serial_number', None) - self.carrier_name = kwargs.get('carrier_name', None) - self.tracking_id = kwargs.get('tracking_id', None) - self.tracking_url = kwargs.get('tracking_url', None) - - -class TriggerList(msrest.serialization.Model): - """Collection of all trigger on the data box edge device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of triggers. - :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01.models.Trigger] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Trigger]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TriggerList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class UpdateDownloadProgress(msrest.serialization.Model): - """Details about the download progress of update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar download_phase: The download phase. Possible values include: "Unknown", "Initializing", - "Downloading", "Verifying". - :vartype download_phase: str or ~azure.mgmt.databoxedge.v2020_09_01.models.DownloadPhase - :ivar percent_complete: Percentage of completion. - :vartype percent_complete: int - :ivar total_bytes_to_download: Total bytes to download. - :vartype total_bytes_to_download: float - :ivar total_bytes_downloaded: Total bytes downloaded. - :vartype total_bytes_downloaded: float - :ivar number_of_updates_to_download: Number of updates to download. - :vartype number_of_updates_to_download: int - :ivar number_of_updates_downloaded: Number of updates downloaded. - :vartype number_of_updates_downloaded: int - """ - - _validation = { - 'download_phase': {'readonly': True}, - 'percent_complete': {'readonly': True}, - 'total_bytes_to_download': {'readonly': True}, - 'total_bytes_downloaded': {'readonly': True}, - 'number_of_updates_to_download': {'readonly': True}, - 'number_of_updates_downloaded': {'readonly': True}, - } - - _attribute_map = { - 'download_phase': {'key': 'downloadPhase', 'type': 'str'}, - 'percent_complete': {'key': 'percentComplete', 'type': 'int'}, - 'total_bytes_to_download': {'key': 'totalBytesToDownload', 'type': 'float'}, - 'total_bytes_downloaded': {'key': 'totalBytesDownloaded', 'type': 'float'}, - 'number_of_updates_to_download': {'key': 'numberOfUpdatesToDownload', 'type': 'int'}, - 'number_of_updates_downloaded': {'key': 'numberOfUpdatesDownloaded', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateDownloadProgress, self).__init__(**kwargs) - self.download_phase = None - self.percent_complete = None - self.total_bytes_to_download = None - self.total_bytes_downloaded = None - self.number_of_updates_to_download = None - self.number_of_updates_downloaded = None - - -class UpdateInstallProgress(msrest.serialization.Model): - """Progress details during installation of updates. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar percent_complete: Percentage completed. - :vartype percent_complete: int - :ivar number_of_updates_to_install: Number of updates to install. - :vartype number_of_updates_to_install: int - :ivar number_of_updates_installed: Number of updates installed. - :vartype number_of_updates_installed: int - """ - - _validation = { - 'percent_complete': {'readonly': True}, - 'number_of_updates_to_install': {'readonly': True}, - 'number_of_updates_installed': {'readonly': True}, - } - - _attribute_map = { - 'percent_complete': {'key': 'percentComplete', 'type': 'int'}, - 'number_of_updates_to_install': {'key': 'numberOfUpdatesToInstall', 'type': 'int'}, - 'number_of_updates_installed': {'key': 'numberOfUpdatesInstalled', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateInstallProgress, self).__init__(**kwargs) - self.percent_complete = None - self.number_of_updates_to_install = None - self.number_of_updates_installed = None - - -class UpdateSummary(ARMBaseModel): - """Details about ongoing updates and availability of updates on the device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param device_version_number: The current version of the device in format: 1.2.17312.13.",. - :type device_version_number: str - :param friendly_device_version_name: The current version of the device in text format. - :type friendly_device_version_name: str - :param device_last_scanned_date_time: The last time when a scan was done on the device. - :type device_last_scanned_date_time: ~datetime.datetime - :param last_completed_scan_job_date_time: The time when the last scan job was completed - (success/cancelled/failed) on the appliance. - :type last_completed_scan_job_date_time: ~datetime.datetime - :ivar last_completed_download_job_date_time: The time when the last Download job was completed - (success/cancelled/failed) on the appliance. - :vartype last_completed_download_job_date_time: ~datetime.datetime - :ivar last_completed_install_job_date_time: The time when the last Install job was completed - (success/cancelled/failed) on the appliance. - :vartype last_completed_install_job_date_time: ~datetime.datetime - :ivar total_number_of_updates_available: The number of updates available for the current device - version as per the last device scan. - :vartype total_number_of_updates_available: int - :ivar total_number_of_updates_pending_download: The total number of items pending download. - :vartype total_number_of_updates_pending_download: int - :ivar total_number_of_updates_pending_install: The total number of items pending install. - :vartype total_number_of_updates_pending_install: int - :ivar reboot_behavior: Indicates if updates are available and at least one of the updates needs - a reboot. Possible values include: "NeverReboots", "RequiresReboot", "RequestReboot". - :vartype reboot_behavior: str or - ~azure.mgmt.databoxedge.v2020_09_01.models.InstallRebootBehavior - :ivar ongoing_update_operation: The current update operation. Possible values include: "None", - "Scan", "Download", "Install". - :vartype ongoing_update_operation: str or - ~azure.mgmt.databoxedge.v2020_09_01.models.UpdateOperation - :ivar in_progress_download_job_id: The job ID of the download job in progress. - :vartype in_progress_download_job_id: str - :ivar in_progress_install_job_id: The job ID of the install job in progress. - :vartype in_progress_install_job_id: str - :ivar in_progress_download_job_started_date_time: The time when the currently running download - (if any) started. - :vartype in_progress_download_job_started_date_time: ~datetime.datetime - :ivar in_progress_install_job_started_date_time: The time when the currently running install - (if any) started. - :vartype in_progress_install_job_started_date_time: ~datetime.datetime - :ivar update_titles: The list of updates available for install. - :vartype update_titles: list[str] - :ivar total_update_size_in_bytes: The total size of updates available for download in bytes. - :vartype total_update_size_in_bytes: float - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'last_completed_download_job_date_time': {'readonly': True}, - 'last_completed_install_job_date_time': {'readonly': True}, - 'total_number_of_updates_available': {'readonly': True}, - 'total_number_of_updates_pending_download': {'readonly': True}, - 'total_number_of_updates_pending_install': {'readonly': True}, - 'reboot_behavior': {'readonly': True}, - 'ongoing_update_operation': {'readonly': True}, - 'in_progress_download_job_id': {'readonly': True}, - 'in_progress_install_job_id': {'readonly': True}, - 'in_progress_download_job_started_date_time': {'readonly': True}, - 'in_progress_install_job_started_date_time': {'readonly': True}, - 'update_titles': {'readonly': True}, - 'total_update_size_in_bytes': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'device_version_number': {'key': 'properties.deviceVersionNumber', 'type': 'str'}, - 'friendly_device_version_name': {'key': 'properties.friendlyDeviceVersionName', 'type': 'str'}, - 'device_last_scanned_date_time': {'key': 'properties.deviceLastScannedDateTime', 'type': 'iso-8601'}, - 'last_completed_scan_job_date_time': {'key': 'properties.lastCompletedScanJobDateTime', 'type': 'iso-8601'}, - 'last_completed_download_job_date_time': {'key': 'properties.lastCompletedDownloadJobDateTime', 'type': 'iso-8601'}, - 'last_completed_install_job_date_time': {'key': 'properties.lastCompletedInstallJobDateTime', 'type': 'iso-8601'}, - 'total_number_of_updates_available': {'key': 'properties.totalNumberOfUpdatesAvailable', 'type': 'int'}, - 'total_number_of_updates_pending_download': {'key': 'properties.totalNumberOfUpdatesPendingDownload', 'type': 'int'}, - 'total_number_of_updates_pending_install': {'key': 'properties.totalNumberOfUpdatesPendingInstall', 'type': 'int'}, - 'reboot_behavior': {'key': 'properties.rebootBehavior', 'type': 'str'}, - 'ongoing_update_operation': {'key': 'properties.ongoingUpdateOperation', 'type': 'str'}, - 'in_progress_download_job_id': {'key': 'properties.inProgressDownloadJobId', 'type': 'str'}, - 'in_progress_install_job_id': {'key': 'properties.inProgressInstallJobId', 'type': 'str'}, - 'in_progress_download_job_started_date_time': {'key': 'properties.inProgressDownloadJobStartedDateTime', 'type': 'iso-8601'}, - 'in_progress_install_job_started_date_time': {'key': 'properties.inProgressInstallJobStartedDateTime', 'type': 'iso-8601'}, - 'update_titles': {'key': 'properties.updateTitles', 'type': '[str]'}, - 'total_update_size_in_bytes': {'key': 'properties.totalUpdateSizeInBytes', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateSummary, self).__init__(**kwargs) - self.device_version_number = kwargs.get('device_version_number', None) - self.friendly_device_version_name = kwargs.get('friendly_device_version_name', None) - self.device_last_scanned_date_time = kwargs.get('device_last_scanned_date_time', None) - self.last_completed_scan_job_date_time = kwargs.get('last_completed_scan_job_date_time', None) - self.last_completed_download_job_date_time = None - self.last_completed_install_job_date_time = None - self.total_number_of_updates_available = None - self.total_number_of_updates_pending_download = None - self.total_number_of_updates_pending_install = None - self.reboot_behavior = None - self.ongoing_update_operation = None - self.in_progress_download_job_id = None - self.in_progress_install_job_id = None - self.in_progress_download_job_started_date_time = None - self.in_progress_install_job_started_date_time = None - self.update_titles = None - self.total_update_size_in_bytes = None - - -class UploadCertificateRequest(msrest.serialization.Model): - """The upload certificate request. - - All required parameters must be populated in order to send to Azure. - - :param authentication_type: The authentication type. Possible values include: "Invalid", - "AzureActiveDirectory". - :type authentication_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.AuthenticationType - :param certificate: Required. The base64 encoded certificate raw data. - :type certificate: str - """ - - _validation = { - 'certificate': {'required': True}, - } - - _attribute_map = { - 'authentication_type': {'key': 'properties.authenticationType', 'type': 'str'}, - 'certificate': {'key': 'properties.certificate', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UploadCertificateRequest, self).__init__(**kwargs) - self.authentication_type = kwargs.get('authentication_type', None) - self.certificate = kwargs['certificate'] - - -class UploadCertificateResponse(msrest.serialization.Model): - """The upload registration certificate response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param auth_type: Specifies authentication type. Possible values include: "Invalid", - "AzureActiveDirectory". - :type auth_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.AuthenticationType - :ivar resource_id: The resource ID of the Data Box Edge/Gateway device. - :vartype resource_id: str - :ivar aad_authority: Azure Active Directory tenant authority. - :vartype aad_authority: str - :ivar aad_tenant_id: Azure Active Directory tenant ID. - :vartype aad_tenant_id: str - :ivar service_principal_client_id: Azure Active Directory service principal client ID. - :vartype service_principal_client_id: str - :ivar service_principal_object_id: Azure Active Directory service principal object ID. - :vartype service_principal_object_id: str - :ivar azure_management_endpoint_audience: The azure management endpoint audience. - :vartype azure_management_endpoint_audience: str - :ivar aad_audience: Identifier of the target resource that is the recipient of the requested - token. - :vartype aad_audience: str - """ - - _validation = { - 'resource_id': {'readonly': True}, - 'aad_authority': {'readonly': True}, - 'aad_tenant_id': {'readonly': True}, - 'service_principal_client_id': {'readonly': True}, - 'service_principal_object_id': {'readonly': True}, - 'azure_management_endpoint_audience': {'readonly': True}, - 'aad_audience': {'readonly': True}, - } - - _attribute_map = { - 'auth_type': {'key': 'authType', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'aad_authority': {'key': 'aadAuthority', 'type': 'str'}, - 'aad_tenant_id': {'key': 'aadTenantId', 'type': 'str'}, - 'service_principal_client_id': {'key': 'servicePrincipalClientId', 'type': 'str'}, - 'service_principal_object_id': {'key': 'servicePrincipalObjectId', 'type': 'str'}, - 'azure_management_endpoint_audience': {'key': 'azureManagementEndpointAudience', 'type': 'str'}, - 'aad_audience': {'key': 'aadAudience', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UploadCertificateResponse, self).__init__(**kwargs) - self.auth_type = kwargs.get('auth_type', None) - self.resource_id = None - self.aad_authority = None - self.aad_tenant_id = None - self.service_principal_client_id = None - self.service_principal_object_id = None - self.azure_management_endpoint_audience = None - self.aad_audience = None - - -class User(ARMBaseModel): - """Represents a user who has access to one or more shares on the Data Box Edge/Gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar system_data: User in DataBoxEdge Resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - :param encrypted_password: The password details. - :type encrypted_password: ~azure.mgmt.databoxedge.v2020_09_01.models.AsymmetricEncryptedSecret - :ivar share_access_rights: List of shares that the user has rights on. This field should not be - specified during user creation. - :vartype share_access_rights: list[~azure.mgmt.databoxedge.v2020_09_01.models.ShareAccessRight] - :param user_type: Type of the user. Possible values include: "Share", "LocalManagement", "ARM". - :type user_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.UserType - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'share_access_rights': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'encrypted_password': {'key': 'properties.encryptedPassword', 'type': 'AsymmetricEncryptedSecret'}, - 'share_access_rights': {'key': 'properties.shareAccessRights', 'type': '[ShareAccessRight]'}, - 'user_type': {'key': 'properties.userType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(User, self).__init__(**kwargs) - self.system_data = None - self.encrypted_password = kwargs.get('encrypted_password', None) - self.share_access_rights = None - self.user_type = kwargs.get('user_type', None) - - -class UserAccessRight(msrest.serialization.Model): - """The mapping between a particular user and the access type on the SMB share. - - All required parameters must be populated in order to send to Azure. - - :param user_id: Required. User ID (already existing in the device). - :type user_id: str - :param access_type: Required. Type of access to be allowed for the user. Possible values - include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.ShareAccessType - """ - - _validation = { - 'user_id': {'required': True}, - 'access_type': {'required': True}, - } - - _attribute_map = { - 'user_id': {'key': 'userId', 'type': 'str'}, - 'access_type': {'key': 'accessType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserAccessRight, self).__init__(**kwargs) - self.user_id = kwargs['user_id'] - self.access_type = kwargs['access_type'] - - -class UserList(msrest.serialization.Model): - """Collection of users. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of users. - :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01.models.User] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[User]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserList, self).__init__(**kwargs) - self.value = None - self.next_link = None diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/models/_models_py3.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/models/_models_py3.py index 3940676b4046..6fa54bcb218d 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/models/_models_py3.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/models/_models_py3.py @@ -43,6 +43,8 @@ def __init__( self, **kwargs ): + """ + """ super(ARMBaseModel, self).__init__(**kwargs) self.id = None self.name = None @@ -65,9 +67,9 @@ class Addon(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Addon type.Constant filled by server. Possible values include: - "IotEdge", "ArcForKubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.AddonType + :ivar kind: Required. Addon type.Constant filled by server. Possible values include: "IotEdge", + "ArcForKubernetes". + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.AddonType :ivar system_data: Addon type. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData """ @@ -96,6 +98,8 @@ def __init__( self, **kwargs ): + """ + """ super(Addon, self).__init__(**kwargs) self.kind = 'Addon' # type: str self.system_data = None @@ -126,6 +130,8 @@ def __init__( self, **kwargs ): + """ + """ super(AddonList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -136,20 +142,20 @@ class Address(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param address_line1: The address line1. - :type address_line1: str - :param address_line2: The address line2. - :type address_line2: str - :param address_line3: The address line3. - :type address_line3: str - :param postal_code: The postal code. - :type postal_code: str - :param city: The city name. - :type city: str - :param state: The state name. - :type state: str - :param country: Required. The country name. - :type country: str + :ivar address_line1: The address line1. + :vartype address_line1: str + :ivar address_line2: The address line2. + :vartype address_line2: str + :ivar address_line3: The address line3. + :vartype address_line3: str + :ivar postal_code: The postal code. + :vartype postal_code: str + :ivar city: The city name. + :vartype city: str + :ivar state: The state name. + :vartype state: str + :ivar country: Required. The country name. + :vartype country: str """ _validation = { @@ -178,6 +184,22 @@ def __init__( state: Optional[str] = None, **kwargs ): + """ + :keyword address_line1: The address line1. + :paramtype address_line1: str + :keyword address_line2: The address line2. + :paramtype address_line2: str + :keyword address_line3: The address line3. + :paramtype address_line3: str + :keyword postal_code: The postal code. + :paramtype postal_code: str + :keyword city: The city name. + :paramtype city: str + :keyword state: The state name. + :paramtype state: str + :keyword country: Required. The country name. + :paramtype country: str + """ super(Address, self).__init__(**kwargs) self.address_line1 = address_line1 self.address_line2 = address_line2 @@ -250,6 +272,8 @@ def __init__( self, **kwargs ): + """ + """ super(Alert, self).__init__(**kwargs) self.system_data = None self.title = None @@ -290,6 +314,8 @@ def __init__( self, **kwargs ): + """ + """ super(AlertErrorDetails, self).__init__(**kwargs) self.error_code = None self.error_message = None @@ -321,6 +347,8 @@ def __init__( self, **kwargs ): + """ + """ super(AlertList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -339,19 +367,19 @@ class ArcAddon(Addon): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Addon type.Constant filled by server. Possible values include: - "IotEdge", "ArcForKubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.AddonType + :ivar kind: Required. Addon type.Constant filled by server. Possible values include: "IotEdge", + "ArcForKubernetes". + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.AddonType :ivar system_data: Addon type. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - :param subscription_id: Required. Arc resource subscription Id. - :type subscription_id: str - :param resource_group_name: Required. Arc resource group name. - :type resource_group_name: str - :param resource_name: Required. Arc resource Name. - :type resource_name: str - :param resource_location: Required. Arc resource location. - :type resource_location: str + :ivar subscription_id: Required. Arc resource subscription Id. + :vartype subscription_id: str + :ivar resource_group_name: Required. Arc resource group name. + :vartype resource_group_name: str + :ivar resource_name: Required. Arc resource Name. + :vartype resource_name: str + :ivar resource_location: Required. Arc resource location. + :vartype resource_location: str :ivar version: Arc resource version. :vartype version: str :ivar host_platform: Host OS supported by the Arc addon. Possible values include: "Windows", @@ -406,6 +434,16 @@ def __init__( resource_location: str, **kwargs ): + """ + :keyword subscription_id: Required. Arc resource subscription Id. + :paramtype subscription_id: str + :keyword resource_group_name: Required. Arc resource group name. + :paramtype resource_group_name: str + :keyword resource_name: Required. Arc resource Name. + :paramtype resource_name: str + :keyword resource_location: Required. Arc resource location. + :paramtype resource_location: str + """ super(ArcAddon, self).__init__(**kwargs) self.kind = 'ArcForKubernetes' # type: str self.subscription_id = subscription_id @@ -423,14 +461,14 @@ class AsymmetricEncryptedSecret(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The value of the secret. - :type value: str - :param encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the + :ivar value: Required. The value of the secret. + :vartype value: str + :ivar encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the value is unencrypted, it will be null. - :type encryption_cert_thumbprint: str - :param encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values + :vartype encryption_cert_thumbprint: str + :ivar encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values include: "None", "AES256", "RSAES_PKCS1_v_1_5". - :type encryption_algorithm: str or + :vartype encryption_algorithm: str or ~azure.mgmt.databoxedge.v2020_09_01.models.EncryptionAlgorithm """ @@ -453,6 +491,17 @@ def __init__( encryption_cert_thumbprint: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The value of the secret. + :paramtype value: str + :keyword encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the + value is unencrypted, it will be null. + :paramtype encryption_cert_thumbprint: str + :keyword encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values + include: "None", "AES256", "RSAES_PKCS1_v_1_5". + :paramtype encryption_algorithm: str or + ~azure.mgmt.databoxedge.v2020_09_01.models.EncryptionAlgorithm + """ super(AsymmetricEncryptedSecret, self).__init__(**kwargs) self.value = value self.encryption_cert_thumbprint = encryption_cert_thumbprint @@ -462,8 +511,8 @@ def __init__( class Authentication(msrest.serialization.Model): """Authentication mechanism for IoT devices. - :param symmetric_key: Symmetric key for authentication. - :type symmetric_key: ~azure.mgmt.databoxedge.v2020_09_01.models.SymmetricKey + :ivar symmetric_key: Symmetric key for authentication. + :vartype symmetric_key: ~azure.mgmt.databoxedge.v2020_09_01.models.SymmetricKey """ _attribute_map = { @@ -476,6 +525,10 @@ def __init__( symmetric_key: Optional["SymmetricKey"] = None, **kwargs ): + """ + :keyword symmetric_key: Symmetric key for authentication. + :paramtype symmetric_key: ~azure.mgmt.databoxedge.v2020_09_01.models.SymmetricKey + """ super(Authentication, self).__init__(**kwargs) self.symmetric_key = symmetric_key @@ -485,15 +538,16 @@ class AzureContainerInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param storage_account_credential_id: Required. ID of the storage account credential used to + :ivar storage_account_credential_id: Required. ID of the storage account credential used to access storage. - :type storage_account_credential_id: str - :param container_name: Required. Container name (Based on the data format specified, this + :vartype storage_account_credential_id: str + :ivar container_name: Required. Container name (Based on the data format specified, this represents the name of Azure Files/Page blob/Block blob). - :type container_name: str - :param data_format: Required. Storage format used for the file represented by the share. + :vartype container_name: str + :ivar data_format: Required. Storage format used for the file represented by the share. Possible values include: "BlockBlob", "PageBlob", "AzureFile". - :type data_format: str or ~azure.mgmt.databoxedge.v2020_09_01.models.AzureContainerDataFormat + :vartype data_format: str or + ~azure.mgmt.databoxedge.v2020_09_01.models.AzureContainerDataFormat """ _validation = { @@ -516,6 +570,18 @@ def __init__( data_format: Union[str, "AzureContainerDataFormat"], **kwargs ): + """ + :keyword storage_account_credential_id: Required. ID of the storage account credential used to + access storage. + :paramtype storage_account_credential_id: str + :keyword container_name: Required. Container name (Based on the data format specified, this + represents the name of Azure Files/Page blob/Block blob). + :paramtype container_name: str + :keyword data_format: Required. Storage format used for the file represented by the share. + Possible values include: "BlockBlob", "PageBlob", "AzureFile". + :paramtype data_format: str or + ~azure.mgmt.databoxedge.v2020_09_01.models.AzureContainerDataFormat + """ super(AzureContainerInfo, self).__init__(**kwargs) self.storage_account_credential_id = storage_account_credential_id self.container_name = container_name @@ -537,14 +603,14 @@ class BandwidthSchedule(ARMBaseModel): :vartype type: str :ivar system_data: Bandwidth object related to ASE resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - :param start: Required. The start time of the schedule in UTC. - :type start: str - :param stop: Required. The stop time of the schedule in UTC. - :type stop: str - :param rate_in_mbps: Required. The bandwidth rate in Mbps. - :type rate_in_mbps: int - :param days: Required. The days of the week when this schedule is applicable. - :type days: list[str or ~azure.mgmt.databoxedge.v2020_09_01.models.DayOfWeek] + :ivar start: Required. The start time of the schedule in UTC. + :vartype start: str + :ivar stop: Required. The stop time of the schedule in UTC. + :vartype stop: str + :ivar rate_in_mbps: Required. The bandwidth rate in Mbps. + :vartype rate_in_mbps: int + :ivar days: Required. The days of the week when this schedule is applicable. + :vartype days: list[str or ~azure.mgmt.databoxedge.v2020_09_01.models.DayOfWeek] """ _validation = { @@ -578,6 +644,16 @@ def __init__( days: List[Union[str, "DayOfWeek"]], **kwargs ): + """ + :keyword start: Required. The start time of the schedule in UTC. + :paramtype start: str + :keyword stop: Required. The stop time of the schedule in UTC. + :paramtype stop: str + :keyword rate_in_mbps: Required. The bandwidth rate in Mbps. + :paramtype rate_in_mbps: int + :keyword days: Required. The days of the week when this schedule is applicable. + :paramtype days: list[str or ~azure.mgmt.databoxedge.v2020_09_01.models.DayOfWeek] + """ super(BandwidthSchedule, self).__init__(**kwargs) self.system_data = None self.start = start @@ -611,6 +687,8 @@ def __init__( self, **kwargs ): + """ + """ super(BandwidthSchedulesList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -621,11 +699,12 @@ class ClientAccessRight(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param client: Required. IP of the client. - :type client: str - :param access_permission: Required. Type of access to be allowed for the client. Possible - values include: "NoAccess", "ReadOnly", "ReadWrite". - :type access_permission: str or ~azure.mgmt.databoxedge.v2020_09_01.models.ClientPermissionType + :ivar client: Required. IP of the client. + :vartype client: str + :ivar access_permission: Required. Type of access to be allowed for the client. Possible values + include: "NoAccess", "ReadOnly", "ReadWrite". + :vartype access_permission: str or + ~azure.mgmt.databoxedge.v2020_09_01.models.ClientPermissionType """ _validation = { @@ -645,6 +724,14 @@ def __init__( access_permission: Union[str, "ClientPermissionType"], **kwargs ): + """ + :keyword client: Required. IP of the client. + :paramtype client: str + :keyword access_permission: Required. Type of access to be allowed for the client. Possible + values include: "NoAccess", "ReadOnly", "ReadWrite". + :paramtype access_permission: str or + ~azure.mgmt.databoxedge.v2020_09_01.models.ClientPermissionType + """ super(ClientAccessRight, self).__init__(**kwargs) self.client = client self.access_permission = access_permission @@ -666,9 +753,9 @@ class Role(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleTypes + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleTypes :ivar system_data: Role configured on ASE resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData """ @@ -697,6 +784,8 @@ def __init__( self, **kwargs ): + """ + """ super(Role, self).__init__(**kwargs) self.kind = 'Role' # type: str self.system_data = None @@ -715,9 +804,9 @@ class CloudEdgeManagementRole(Role): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleTypes + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleTypes :ivar system_data: Role configured on ASE resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData :ivar local_management_status: Local Edge Management Status. Possible values include: @@ -725,8 +814,8 @@ class CloudEdgeManagementRole(Role): :vartype local_management_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleStatus :ivar edge_profile: Edge Profile of the resource. :vartype edge_profile: ~azure.mgmt.databoxedge.v2020_09_01.models.EdgeProfile - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleStatus + :ivar role_status: Role status. Possible values include: "Enabled", "Disabled". + :vartype role_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleStatus """ _validation = { @@ -756,6 +845,10 @@ def __init__( role_status: Optional[Union[str, "RoleStatus"]] = None, **kwargs ): + """ + :keyword role_status: Role status. Possible values include: "Enabled", "Disabled". + :paramtype role_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleStatus + """ super(CloudEdgeManagementRole, self).__init__(**kwargs) self.kind = 'CloudEdgeManagement' # type: str self.local_management_status = None @@ -766,14 +859,14 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from the service. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.databoxedge.v2020_09_01.models.CloudErrorBody] + :vartype message: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.databoxedge.v2020_09_01.models.CloudErrorBody] """ _attribute_map = { @@ -790,6 +883,16 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.databoxedge.v2020_09_01.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -829,6 +932,8 @@ def __init__( self, **kwargs ): + """ + """ super(CniConfig, self).__init__(**kwargs) self.type = None self.version = None @@ -841,10 +946,10 @@ class ComputeResource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param processor_count: Required. Processor count. - :type processor_count: int - :param memory_in_gb: Required. Memory in GB. - :type memory_in_gb: long + :ivar processor_count: Required. Processor count. + :vartype processor_count: int + :ivar memory_in_gb: Required. Memory in GB. + :vartype memory_in_gb: long """ _validation = { @@ -864,6 +969,12 @@ def __init__( memory_in_gb: int, **kwargs ): + """ + :keyword processor_count: Required. Processor count. + :paramtype processor_count: int + :keyword memory_in_gb: Required. Memory in GB. + :paramtype memory_in_gb: long + """ super(ComputeResource, self).__init__(**kwargs) self.processor_count = processor_count self.memory_in_gb = memory_in_gb @@ -874,14 +985,14 @@ class ContactDetails(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param contact_person: Required. The contact person name. - :type contact_person: str - :param company_name: Required. The name of the company. - :type company_name: str - :param phone: Required. The phone number. - :type phone: str - :param email_list: Required. The email list. - :type email_list: list[str] + :ivar contact_person: Required. The contact person name. + :vartype contact_person: str + :ivar company_name: Required. The name of the company. + :vartype company_name: str + :ivar phone: Required. The phone number. + :vartype phone: str + :ivar email_list: Required. The email list. + :vartype email_list: list[str] """ _validation = { @@ -907,6 +1018,16 @@ def __init__( email_list: List[str], **kwargs ): + """ + :keyword contact_person: Required. The contact person name. + :paramtype contact_person: str + :keyword company_name: Required. The name of the company. + :paramtype company_name: str + :keyword phone: Required. The phone number. + :paramtype phone: str + :keyword email_list: Required. The email list. + :paramtype email_list: list[str] + """ super(ContactDetails, self).__init__(**kwargs) self.contact_person = contact_person self.company_name = company_name @@ -932,9 +1053,10 @@ class Container(ARMBaseModel): :ivar container_status: Current status of the container. Possible values include: "OK", "Offline", "Unknown", "Updating", "NeedsAttention". :vartype container_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.ContainerStatus - :param data_format: Required. DataFormat for Container. Possible values include: "BlockBlob", + :ivar data_format: Required. DataFormat for Container. Possible values include: "BlockBlob", "PageBlob", "AzureFile". - :type data_format: str or ~azure.mgmt.databoxedge.v2020_09_01.models.AzureContainerDataFormat + :vartype data_format: str or + ~azure.mgmt.databoxedge.v2020_09_01.models.AzureContainerDataFormat :ivar refresh_details: Details of the refresh job on this container. :vartype refresh_details: ~azure.mgmt.databoxedge.v2020_09_01.models.RefreshDetails :ivar created_date_time: The UTC time when container got created. @@ -969,6 +1091,12 @@ def __init__( data_format: Union[str, "AzureContainerDataFormat"], **kwargs ): + """ + :keyword data_format: Required. DataFormat for Container. Possible values include: "BlockBlob", + "PageBlob", "AzureFile". + :paramtype data_format: str or + ~azure.mgmt.databoxedge.v2020_09_01.models.AzureContainerDataFormat + """ super(Container, self).__init__(**kwargs) self.system_data = None self.container_status = None @@ -1002,6 +1130,8 @@ def __init__( self, **kwargs ): + """ + """ super(ContainerList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1020,29 +1150,29 @@ class DataBoxEdgeDevice(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param location: Required. The location of the device. This is a supported and registered Azure + :ivar location: Required. The location of the device. This is a supported and registered Azure geographical region (for example, West US, East US, or Southeast Asia). The geographical region of a device cannot be changed once it is created, but if an identical geographical region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. The list of tags that describe the device. These tags can be used - to view and group this device (across resource groups). - :type tags: dict[str, str] - :param sku: The SKU type. - :type sku: ~azure.mgmt.databoxedge.v2020_09_01.models.Sku - :param etag: The etag for the devices. - :type etag: str - :param identity: Msi identity of the resource. - :type identity: ~azure.mgmt.databoxedge.v2020_09_01.models.ResourceIdentity + :vartype location: str + :ivar tags: A set of tags. The list of tags that describe the device. These tags can be used to + view and group this device (across resource groups). + :vartype tags: dict[str, str] + :ivar sku: The SKU type. + :vartype sku: ~azure.mgmt.databoxedge.v2020_09_01.models.Sku + :ivar etag: The etag for the devices. + :vartype etag: str + :ivar identity: Msi identity of the resource. + :vartype identity: ~azure.mgmt.databoxedge.v2020_09_01.models.ResourceIdentity :ivar kind: The etag for the devices. Possible values include: "AzureDataBoxGateway", "AzureStackEdge", "AzureStackHub", "AzureModularDataCentre". :vartype kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.DataBoxEdgeDeviceKind :ivar system_data: DataBoxEdge Resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - :param data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible + :ivar data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible values include: "ReadyToSetup", "Online", "Offline", "NeedsAttention", "Disconnected", "PartiallyDisconnected", "Maintenance". - :type data_box_edge_device_status: str or + :vartype data_box_edge_device_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.DataBoxEdgeDeviceStatus :ivar serial_number: The Serial Number of Data Box Edge/Gateway device. :vartype serial_number: str @@ -1142,6 +1272,27 @@ def __init__( data_box_edge_device_status: Optional[Union[str, "DataBoxEdgeDeviceStatus"]] = None, **kwargs ): + """ + :keyword location: Required. The location of the device. This is a supported and registered + Azure geographical region (for example, West US, East US, or Southeast Asia). The geographical + region of a device cannot be changed once it is created, but if an identical geographical + region is specified on update, the request will succeed. + :paramtype location: str + :keyword tags: A set of tags. The list of tags that describe the device. These tags can be used + to view and group this device (across resource groups). + :paramtype tags: dict[str, str] + :keyword sku: The SKU type. + :paramtype sku: ~azure.mgmt.databoxedge.v2020_09_01.models.Sku + :keyword etag: The etag for the devices. + :paramtype etag: str + :keyword identity: Msi identity of the resource. + :paramtype identity: ~azure.mgmt.databoxedge.v2020_09_01.models.ResourceIdentity + :keyword data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible + values include: "ReadyToSetup", "Online", "Offline", "NeedsAttention", "Disconnected", + "PartiallyDisconnected", "Maintenance". + :paramtype data_box_edge_device_status: str or + ~azure.mgmt.databoxedge.v2020_09_01.models.DataBoxEdgeDeviceStatus + """ super(DataBoxEdgeDevice, self).__init__(**kwargs) self.location = location self.tags = tags @@ -1179,23 +1330,23 @@ class DataBoxEdgeDeviceExtendedInfo(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param encryption_key_thumbprint: The digital signature of encrypted certificate. - :type encryption_key_thumbprint: str - :param encryption_key: The public part of the encryption certificate. Client uses this to + :ivar encryption_key_thumbprint: The digital signature of encrypted certificate. + :vartype encryption_key_thumbprint: str + :ivar encryption_key: The public part of the encryption certificate. Client uses this to encrypt any secret. - :type encryption_key: str + :vartype encryption_key: str :ivar resource_key: The Resource ID of the Resource. :vartype resource_key: str - :param client_secret_store_id: The Key Vault ARM Id for client secrets. - :type client_secret_store_id: str - :param client_secret_store_url: The url to access the Client Key Vault. - :type client_secret_store_url: str - :param channel_integrity_key_name: The name of Channel Integrity Key stored in the Client Key + :ivar client_secret_store_id: The Key Vault ARM Id for client secrets. + :vartype client_secret_store_id: str + :ivar client_secret_store_url: The url to access the Client Key Vault. + :vartype client_secret_store_url: str + :ivar channel_integrity_key_name: The name of Channel Integrity Key stored in the Client Key Vault. - :type channel_integrity_key_name: str - :param channel_integrity_key_version: The version of Channel Integrity Key stored in the Client + :vartype channel_integrity_key_name: str + :ivar channel_integrity_key_version: The version of Channel Integrity Key stored in the Client Key Vault. - :type channel_integrity_key_version: str + :vartype channel_integrity_key_version: str """ _validation = { @@ -1229,6 +1380,23 @@ def __init__( channel_integrity_key_version: Optional[str] = None, **kwargs ): + """ + :keyword encryption_key_thumbprint: The digital signature of encrypted certificate. + :paramtype encryption_key_thumbprint: str + :keyword encryption_key: The public part of the encryption certificate. Client uses this to + encrypt any secret. + :paramtype encryption_key: str + :keyword client_secret_store_id: The Key Vault ARM Id for client secrets. + :paramtype client_secret_store_id: str + :keyword client_secret_store_url: The url to access the Client Key Vault. + :paramtype client_secret_store_url: str + :keyword channel_integrity_key_name: The name of Channel Integrity Key stored in the Client Key + Vault. + :paramtype channel_integrity_key_name: str + :keyword channel_integrity_key_version: The version of Channel Integrity Key stored in the + Client Key Vault. + :paramtype channel_integrity_key_version: str + """ super(DataBoxEdgeDeviceExtendedInfo, self).__init__(**kwargs) self.encryption_key_thumbprint = encryption_key_thumbprint self.encryption_key = encryption_key @@ -1242,16 +1410,16 @@ def __init__( class DataBoxEdgeDeviceExtendedInfoPatch(msrest.serialization.Model): """The Data Box Edge/Gateway device extended info patch. - :param client_secret_store_id: The Key Vault ARM Id for client secrets. - :type client_secret_store_id: str - :param client_secret_store_url: The url to access the Client Key Vault. - :type client_secret_store_url: str - :param channel_integrity_key_name: The name for Channel Integrity Key stored in the Client Key + :ivar client_secret_store_id: The Key Vault ARM Id for client secrets. + :vartype client_secret_store_id: str + :ivar client_secret_store_url: The url to access the Client Key Vault. + :vartype client_secret_store_url: str + :ivar channel_integrity_key_name: The name for Channel Integrity Key stored in the Client Key Vault. - :type channel_integrity_key_name: str - :param channel_integrity_key_version: The version of Channel Integrity Key stored in the Client + :vartype channel_integrity_key_name: str + :ivar channel_integrity_key_version: The version of Channel Integrity Key stored in the Client Key Vault. - :type channel_integrity_key_version: str + :vartype channel_integrity_key_version: str """ _attribute_map = { @@ -1270,6 +1438,18 @@ def __init__( channel_integrity_key_version: Optional[str] = None, **kwargs ): + """ + :keyword client_secret_store_id: The Key Vault ARM Id for client secrets. + :paramtype client_secret_store_id: str + :keyword client_secret_store_url: The url to access the Client Key Vault. + :paramtype client_secret_store_url: str + :keyword channel_integrity_key_name: The name for Channel Integrity Key stored in the Client + Key Vault. + :paramtype channel_integrity_key_name: str + :keyword channel_integrity_key_version: The version of Channel Integrity Key stored in the + Client Key Vault. + :paramtype channel_integrity_key_version: str + """ super(DataBoxEdgeDeviceExtendedInfoPatch, self).__init__(**kwargs) self.client_secret_store_id = client_secret_store_id self.client_secret_store_url = client_secret_store_url @@ -1302,6 +1482,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataBoxEdgeDeviceList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1310,12 +1492,12 @@ def __init__( class DataBoxEdgeDevicePatch(msrest.serialization.Model): """The Data Box Edge/Gateway device patch. - :param tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. - :type tags: dict[str, str] - :param identity: Msi identity of the resource. - :type identity: ~azure.mgmt.databoxedge.v2020_09_01.models.ResourceIdentity - :param edge_profile: Edge Profile property of the Data Box Edge/Gateway device. - :type edge_profile: ~azure.mgmt.databoxedge.v2020_09_01.models.EdgeProfilePatch + :ivar tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. + :vartype tags: dict[str, str] + :ivar identity: Msi identity of the resource. + :vartype identity: ~azure.mgmt.databoxedge.v2020_09_01.models.ResourceIdentity + :ivar edge_profile: Edge Profile property of the Data Box Edge/Gateway device. + :vartype edge_profile: ~azure.mgmt.databoxedge.v2020_09_01.models.EdgeProfilePatch """ _attribute_map = { @@ -1332,6 +1514,14 @@ def __init__( edge_profile: Optional["EdgeProfilePatch"] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. + :paramtype tags: dict[str, str] + :keyword identity: Msi identity of the resource. + :paramtype identity: ~azure.mgmt.databoxedge.v2020_09_01.models.ResourceIdentity + :keyword edge_profile: Edge Profile property of the Data Box Edge/Gateway device. + :paramtype edge_profile: ~azure.mgmt.databoxedge.v2020_09_01.models.EdgeProfilePatch + """ super(DataBoxEdgeDevicePatch, self).__init__(**kwargs) self.tags = tags self.identity = identity @@ -1343,10 +1533,10 @@ class DataBoxEdgeMoveRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param target_resource_group: Required. Target resource group ARMId. - :type target_resource_group: str - :param resources: Required. List of resources to be moved. - :type resources: list[str] + :ivar target_resource_group: Required. Target resource group ARMId. + :vartype target_resource_group: str + :ivar resources: Required. List of resources to be moved. + :vartype resources: list[str] """ _validation = { @@ -1366,6 +1556,12 @@ def __init__( resources: List[str], **kwargs ): + """ + :keyword target_resource_group: Required. Target resource group ARMId. + :paramtype target_resource_group: str + :keyword resources: Required. List of resources to be moved. + :paramtype resources: list[str] + """ super(DataBoxEdgeMoveRequest, self).__init__(**kwargs) self.target_resource_group = target_resource_group self.resources = resources @@ -1450,6 +1646,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataBoxEdgeSku, self).__init__(**kwargs) self.resource_type = None self.name = None @@ -1492,6 +1690,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataBoxEdgeSkuList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1500,8 +1700,8 @@ def __init__( class DCAccessCode(msrest.serialization.Model): """DC Access code in the case of Self Managed Shipping. - :param auth_code: DCAccess Code for the Self Managed shipment. - :type auth_code: str + :ivar auth_code: DCAccess Code for the Self Managed shipment. + :vartype auth_code: str """ _attribute_map = { @@ -1514,6 +1714,10 @@ def __init__( auth_code: Optional[str] = None, **kwargs ): + """ + :keyword auth_code: DCAccess Code for the Self Managed shipment. + :paramtype auth_code: str + """ super(DCAccessCode, self).__init__(**kwargs) self.auth_code = auth_code @@ -1521,8 +1725,8 @@ def __init__( class EdgeProfile(msrest.serialization.Model): """Details about Edge Profile for the resource. - :param subscription: Edge Profile Subscription. - :type subscription: ~azure.mgmt.databoxedge.v2020_09_01.models.EdgeProfileSubscription + :ivar subscription: Edge Profile Subscription. + :vartype subscription: ~azure.mgmt.databoxedge.v2020_09_01.models.EdgeProfileSubscription """ _attribute_map = { @@ -1535,6 +1739,10 @@ def __init__( subscription: Optional["EdgeProfileSubscription"] = None, **kwargs ): + """ + :keyword subscription: Edge Profile Subscription. + :paramtype subscription: ~azure.mgmt.databoxedge.v2020_09_01.models.EdgeProfileSubscription + """ super(EdgeProfile, self).__init__(**kwargs) self.subscription = subscription @@ -1542,8 +1750,8 @@ def __init__( class EdgeProfilePatch(msrest.serialization.Model): """The Data Box Edge/Gateway Edge Profile patch. - :param subscription: The Data Box Edge/Gateway Edge Profile Subscription patch. - :type subscription: ~azure.mgmt.databoxedge.v2020_09_01.models.EdgeProfileSubscriptionPatch + :ivar subscription: The Data Box Edge/Gateway Edge Profile Subscription patch. + :vartype subscription: ~azure.mgmt.databoxedge.v2020_09_01.models.EdgeProfileSubscriptionPatch """ _attribute_map = { @@ -1556,6 +1764,11 @@ def __init__( subscription: Optional["EdgeProfileSubscriptionPatch"] = None, **kwargs ): + """ + :keyword subscription: The Data Box Edge/Gateway Edge Profile Subscription patch. + :paramtype subscription: + ~azure.mgmt.databoxedge.v2020_09_01.models.EdgeProfileSubscriptionPatch + """ super(EdgeProfilePatch, self).__init__(**kwargs) self.subscription = subscription @@ -1563,27 +1776,27 @@ def __init__( class EdgeProfileSubscription(msrest.serialization.Model): """Subscription details for the Edge Profile. - :param registration_id: Edge Subscription Registration ID. - :type registration_id: str - :param id: ARM ID of the subscription. - :type id: str - :param state: Possible values include: "Registered", "Warned", "Suspended", "Deleted", + :ivar registration_id: Edge Subscription Registration ID. + :vartype registration_id: str + :ivar id: ARM ID of the subscription. + :vartype id: str + :ivar state: Possible values include: "Registered", "Warned", "Suspended", "Deleted", "Unregistered". - :type state: str or ~azure.mgmt.databoxedge.v2020_09_01.models.SubscriptionState - :param registration_date: - :type registration_date: str - :param subscription_id: - :type subscription_id: str - :param tenant_id: - :type tenant_id: str - :param location_placement_id: - :type location_placement_id: str - :param quota_id: - :type quota_id: str - :param serialized_details: - :type serialized_details: str - :param registered_features: - :type registered_features: + :vartype state: str or ~azure.mgmt.databoxedge.v2020_09_01.models.SubscriptionState + :ivar registration_date: + :vartype registration_date: str + :ivar subscription_id: + :vartype subscription_id: str + :ivar tenant_id: + :vartype tenant_id: str + :ivar location_placement_id: + :vartype location_placement_id: str + :ivar quota_id: + :vartype quota_id: str + :ivar serialized_details: + :vartype serialized_details: str + :ivar registered_features: + :vartype registered_features: list[~azure.mgmt.databoxedge.v2020_09_01.models.SubscriptionRegisteredFeatures] """ @@ -1615,6 +1828,30 @@ def __init__( registered_features: Optional[List["SubscriptionRegisteredFeatures"]] = None, **kwargs ): + """ + :keyword registration_id: Edge Subscription Registration ID. + :paramtype registration_id: str + :keyword id: ARM ID of the subscription. + :paramtype id: str + :keyword state: Possible values include: "Registered", "Warned", "Suspended", "Deleted", + "Unregistered". + :paramtype state: str or ~azure.mgmt.databoxedge.v2020_09_01.models.SubscriptionState + :keyword registration_date: + :paramtype registration_date: str + :keyword subscription_id: + :paramtype subscription_id: str + :keyword tenant_id: + :paramtype tenant_id: str + :keyword location_placement_id: + :paramtype location_placement_id: str + :keyword quota_id: + :paramtype quota_id: str + :keyword serialized_details: + :paramtype serialized_details: str + :keyword registered_features: + :paramtype registered_features: + list[~azure.mgmt.databoxedge.v2020_09_01.models.SubscriptionRegisteredFeatures] + """ super(EdgeProfileSubscription, self).__init__(**kwargs) self.registration_id = registration_id self.id = id @@ -1631,8 +1868,8 @@ def __init__( class EdgeProfileSubscriptionPatch(msrest.serialization.Model): """The Data Box Edge/Gateway Edge Profile Subscription patch. - :param id: The path ID that uniquely identifies the subscription of the edge profile. - :type id: str + :ivar id: The path ID that uniquely identifies the subscription of the edge profile. + :vartype id: str """ _attribute_map = { @@ -1645,6 +1882,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The path ID that uniquely identifies the subscription of the edge profile. + :paramtype id: str + """ super(EdgeProfileSubscriptionPatch, self).__init__(**kwargs) self.id = id @@ -1674,6 +1915,8 @@ def __init__( self, **kwargs ): + """ + """ super(EtcdInfo, self).__init__(**kwargs) self.type = None self.version = None @@ -1697,9 +1940,9 @@ class Trigger(ARMBaseModel): :vartype type: str :ivar system_data: Trigger in DataBoxEdge Resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: + :ivar kind: Required. Trigger Kind.Constant filled by server. Possible values include: "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.TriggerEventType + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.TriggerEventType """ _validation = { @@ -1726,6 +1969,8 @@ def __init__( self, **kwargs ): + """ + """ super(Trigger, self).__init__(**kwargs) self.system_data = None self.kind = 'Trigger' # type: str @@ -1746,17 +1991,17 @@ class FileEventTrigger(Trigger): :vartype type: str :ivar system_data: Trigger in DataBoxEdge Resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: + :ivar kind: Required. Trigger Kind.Constant filled by server. Possible values include: "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.TriggerEventType - :param source_info: Required. File event source details. - :type source_info: ~azure.mgmt.databoxedge.v2020_09_01.models.FileSourceInfo - :param sink_info: Required. Role sink info. - :type sink_info: ~azure.mgmt.databoxedge.v2020_09_01.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.TriggerEventType + :ivar source_info: Required. File event source details. + :vartype source_info: ~azure.mgmt.databoxedge.v2020_09_01.models.FileSourceInfo + :ivar sink_info: Required. Role sink info. + :vartype sink_info: ~azure.mgmt.databoxedge.v2020_09_01.models.RoleSinkInfo + :ivar custom_context_tag: A custom context tag typically used to correlate the trigger against its usage. For example, if a periodic timer trigger is intended for certain specific IoT modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str + :vartype custom_context_tag: str """ _validation = { @@ -1789,6 +2034,16 @@ def __init__( custom_context_tag: Optional[str] = None, **kwargs ): + """ + :keyword source_info: Required. File event source details. + :paramtype source_info: ~azure.mgmt.databoxedge.v2020_09_01.models.FileSourceInfo + :keyword sink_info: Required. Role sink info. + :paramtype sink_info: ~azure.mgmt.databoxedge.v2020_09_01.models.RoleSinkInfo + :keyword custom_context_tag: A custom context tag typically used to correlate the trigger + against its usage. For example, if a periodic timer trigger is intended for certain specific + IoT modules in the device, the tag can be the name or the image URL of the module. + :paramtype custom_context_tag: str + """ super(FileEventTrigger, self).__init__(**kwargs) self.kind = 'FileEvent' # type: str self.source_info = source_info @@ -1801,8 +2056,8 @@ class FileSourceInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param share_id: Required. File share ID. - :type share_id: str + :ivar share_id: Required. File share ID. + :vartype share_id: str """ _validation = { @@ -1819,6 +2074,10 @@ def __init__( share_id: str, **kwargs ): + """ + :keyword share_id: Required. File share ID. + :paramtype share_id: str + """ super(FileSourceInfo, self).__init__(**kwargs) self.share_id = share_id @@ -1826,14 +2085,14 @@ def __init__( class GenerateCertResponse(msrest.serialization.Model): """Used in activation key generation flow. - :param public_key: Gets or sets base64 encoded certificate raw data, + :ivar public_key: Gets or sets base64 encoded certificate raw data, this is the public part needed to be uploaded to cert vault. - :type public_key: str - :param private_key: Gets or sets base64 encoded private part of the certificate, + :vartype public_key: str + :ivar private_key: Gets or sets base64 encoded private part of the certificate, needed to form the activation key. - :type private_key: str - :param expiry_time_in_utc: Gets or sets expiry time in UTC. - :type expiry_time_in_utc: str + :vartype private_key: str + :ivar expiry_time_in_utc: Gets or sets expiry time in UTC. + :vartype expiry_time_in_utc: str """ _attribute_map = { @@ -1850,6 +2109,16 @@ def __init__( expiry_time_in_utc: Optional[str] = None, **kwargs ): + """ + :keyword public_key: Gets or sets base64 encoded certificate raw data, + this is the public part needed to be uploaded to cert vault. + :paramtype public_key: str + :keyword private_key: Gets or sets base64 encoded private part of the certificate, + needed to form the activation key. + :paramtype private_key: str + :keyword expiry_time_in_utc: Gets or sets expiry time in UTC. + :paramtype expiry_time_in_utc: str + """ super(GenerateCertResponse, self).__init__(**kwargs) self.public_key = public_key self.private_key = private_key @@ -1861,12 +2130,12 @@ class ImageRepositoryCredential(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param image_repository_url: Required. Image repository url (e.g.: mcr.microsoft.com). - :type image_repository_url: str - :param user_name: Required. Repository user name. - :type user_name: str - :param password: Repository user password. - :type password: ~azure.mgmt.databoxedge.v2020_09_01.models.AsymmetricEncryptedSecret + :ivar image_repository_url: Required. Image repository url (e.g.: mcr.microsoft.com). + :vartype image_repository_url: str + :ivar user_name: Required. Repository user name. + :vartype user_name: str + :ivar password: Repository user password. + :vartype password: ~azure.mgmt.databoxedge.v2020_09_01.models.AsymmetricEncryptedSecret """ _validation = { @@ -1888,6 +2157,14 @@ def __init__( password: Optional["AsymmetricEncryptedSecret"] = None, **kwargs ): + """ + :keyword image_repository_url: Required. Image repository url (e.g.: mcr.microsoft.com). + :paramtype image_repository_url: str + :keyword user_name: Required. Repository user name. + :paramtype user_name: str + :keyword password: Repository user password. + :paramtype password: ~azure.mgmt.databoxedge.v2020_09_01.models.AsymmetricEncryptedSecret + """ super(ImageRepositoryCredential, self).__init__(**kwargs) self.image_repository_url = image_repository_url self.user_name = user_name @@ -1907,17 +2184,17 @@ class IoTAddon(Addon): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Addon type.Constant filled by server. Possible values include: - "IotEdge", "ArcForKubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.AddonType + :ivar kind: Required. Addon type.Constant filled by server. Possible values include: "IotEdge", + "ArcForKubernetes". + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.AddonType :ivar system_data: Addon type. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - :param io_t_device_details: Required. IoT device metadata to which appliance needs to be + :ivar io_t_device_details: Required. IoT device metadata to which appliance needs to be connected. - :type io_t_device_details: ~azure.mgmt.databoxedge.v2020_09_01.models.IoTDeviceInfo - :param io_t_edge_device_details: Required. IoT edge device to which the IoT Addon needs to be + :vartype io_t_device_details: ~azure.mgmt.databoxedge.v2020_09_01.models.IoTDeviceInfo + :ivar io_t_edge_device_details: Required. IoT edge device to which the IoT Addon needs to be configured. - :type io_t_edge_device_details: ~azure.mgmt.databoxedge.v2020_09_01.models.IoTDeviceInfo + :vartype io_t_edge_device_details: ~azure.mgmt.databoxedge.v2020_09_01.models.IoTDeviceInfo :ivar version: Version of IoT running on the appliance. :vartype version: str :ivar host_platform: Host OS supported by the IoT addon. Possible values include: "Windows", @@ -1966,6 +2243,14 @@ def __init__( io_t_edge_device_details: "IoTDeviceInfo", **kwargs ): + """ + :keyword io_t_device_details: Required. IoT device metadata to which appliance needs to be + connected. + :paramtype io_t_device_details: ~azure.mgmt.databoxedge.v2020_09_01.models.IoTDeviceInfo + :keyword io_t_edge_device_details: Required. IoT edge device to which the IoT Addon needs to be + configured. + :paramtype io_t_edge_device_details: ~azure.mgmt.databoxedge.v2020_09_01.models.IoTDeviceInfo + """ super(IoTAddon, self).__init__(**kwargs) self.kind = 'IotEdge' # type: str self.io_t_device_details = io_t_device_details @@ -1981,14 +2266,14 @@ class IoTDeviceInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param device_id: Required. ID of the IoT device/edge device. - :type device_id: str - :param io_t_host_hub: Required. Host name for the IoT hub associated to the device. - :type io_t_host_hub: str - :param io_t_host_hub_id: Id for the IoT hub associated to the device. - :type io_t_host_hub_id: str - :param authentication: Encrypted IoT device/IoT edge device connection string. - :type authentication: ~azure.mgmt.databoxedge.v2020_09_01.models.Authentication + :ivar device_id: Required. ID of the IoT device/edge device. + :vartype device_id: str + :ivar io_t_host_hub: Required. Host name for the IoT hub associated to the device. + :vartype io_t_host_hub: str + :ivar io_t_host_hub_id: Id for the IoT hub associated to the device. + :vartype io_t_host_hub_id: str + :ivar authentication: Encrypted IoT device/IoT edge device connection string. + :vartype authentication: ~azure.mgmt.databoxedge.v2020_09_01.models.Authentication """ _validation = { @@ -2012,6 +2297,16 @@ def __init__( authentication: Optional["Authentication"] = None, **kwargs ): + """ + :keyword device_id: Required. ID of the IoT device/edge device. + :paramtype device_id: str + :keyword io_t_host_hub: Required. Host name for the IoT hub associated to the device. + :paramtype io_t_host_hub: str + :keyword io_t_host_hub_id: Id for the IoT hub associated to the device. + :paramtype io_t_host_hub_id: str + :keyword authentication: Encrypted IoT device/IoT edge device connection string. + :paramtype authentication: ~azure.mgmt.databoxedge.v2020_09_01.models.Authentication + """ super(IoTDeviceInfo, self).__init__(**kwargs) self.device_id = device_id self.io_t_host_hub = io_t_host_hub @@ -2024,12 +2319,12 @@ class IoTEdgeAgentInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param image_name: Required. Name of the IoT edge agent image. - :type image_name: str - :param tag: Required. Image Tag. - :type tag: str - :param image_repository: Image repository details. - :type image_repository: ~azure.mgmt.databoxedge.v2020_09_01.models.ImageRepositoryCredential + :ivar image_name: Required. Name of the IoT edge agent image. + :vartype image_name: str + :ivar tag: Required. Image Tag. + :vartype tag: str + :ivar image_repository: Image repository details. + :vartype image_repository: ~azure.mgmt.databoxedge.v2020_09_01.models.ImageRepositoryCredential """ _validation = { @@ -2051,6 +2346,15 @@ def __init__( image_repository: Optional["ImageRepositoryCredential"] = None, **kwargs ): + """ + :keyword image_name: Required. Name of the IoT edge agent image. + :paramtype image_name: str + :keyword tag: Required. Image Tag. + :paramtype tag: str + :keyword image_repository: Image repository details. + :paramtype image_repository: + ~azure.mgmt.databoxedge.v2020_09_01.models.ImageRepositoryCredential + """ super(IoTEdgeAgentInfo, self).__init__(**kwargs) self.image_name = image_name self.tag = tag @@ -2070,31 +2374,31 @@ class IoTRole(Role): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleTypes + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleTypes :ivar system_data: Role configured on ASE resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - :param host_platform: Host OS supported by the IoT role. Possible values include: "Windows", + :ivar host_platform: Host OS supported by the IoT role. Possible values include: "Windows", "Linux". - :type host_platform: str or ~azure.mgmt.databoxedge.v2020_09_01.models.PlatformType - :param io_t_device_details: IoT device metadata to which data box edge device needs to be + :vartype host_platform: str or ~azure.mgmt.databoxedge.v2020_09_01.models.PlatformType + :ivar io_t_device_details: IoT device metadata to which data box edge device needs to be connected. - :type io_t_device_details: ~azure.mgmt.databoxedge.v2020_09_01.models.IoTDeviceInfo - :param io_t_edge_device_details: IoT edge device to which the IoT role needs to be configured. - :type io_t_edge_device_details: ~azure.mgmt.databoxedge.v2020_09_01.models.IoTDeviceInfo - :param share_mappings: Mount points of shares in role(s). - :type share_mappings: list[~azure.mgmt.databoxedge.v2020_09_01.models.MountPointMap] - :param io_t_edge_agent_info: Iot edge agent details to download the agent and bootstrap iot + :vartype io_t_device_details: ~azure.mgmt.databoxedge.v2020_09_01.models.IoTDeviceInfo + :ivar io_t_edge_device_details: IoT edge device to which the IoT role needs to be configured. + :vartype io_t_edge_device_details: ~azure.mgmt.databoxedge.v2020_09_01.models.IoTDeviceInfo + :ivar share_mappings: Mount points of shares in role(s). + :vartype share_mappings: list[~azure.mgmt.databoxedge.v2020_09_01.models.MountPointMap] + :ivar io_t_edge_agent_info: Iot edge agent details to download the agent and bootstrap iot runtime. - :type io_t_edge_agent_info: ~azure.mgmt.databoxedge.v2020_09_01.models.IoTEdgeAgentInfo + :vartype io_t_edge_agent_info: ~azure.mgmt.databoxedge.v2020_09_01.models.IoTEdgeAgentInfo :ivar host_platform_type: Platform where the Iot runtime is hosted. Possible values include: "KubernetesCluster", "LinuxVM". :vartype host_platform_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.HostPlatformType - :param compute_resource: Resource allocation. - :type compute_resource: ~azure.mgmt.databoxedge.v2020_09_01.models.ComputeResource - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleStatus + :ivar compute_resource: Resource allocation. + :vartype compute_resource: ~azure.mgmt.databoxedge.v2020_09_01.models.ComputeResource + :ivar role_status: Role status. Possible values include: "Enabled", "Disabled". + :vartype role_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleStatus """ _validation = { @@ -2134,6 +2438,26 @@ def __init__( role_status: Optional[Union[str, "RoleStatus"]] = None, **kwargs ): + """ + :keyword host_platform: Host OS supported by the IoT role. Possible values include: "Windows", + "Linux". + :paramtype host_platform: str or ~azure.mgmt.databoxedge.v2020_09_01.models.PlatformType + :keyword io_t_device_details: IoT device metadata to which data box edge device needs to be + connected. + :paramtype io_t_device_details: ~azure.mgmt.databoxedge.v2020_09_01.models.IoTDeviceInfo + :keyword io_t_edge_device_details: IoT edge device to which the IoT role needs to be + configured. + :paramtype io_t_edge_device_details: ~azure.mgmt.databoxedge.v2020_09_01.models.IoTDeviceInfo + :keyword share_mappings: Mount points of shares in role(s). + :paramtype share_mappings: list[~azure.mgmt.databoxedge.v2020_09_01.models.MountPointMap] + :keyword io_t_edge_agent_info: Iot edge agent details to download the agent and bootstrap iot + runtime. + :paramtype io_t_edge_agent_info: ~azure.mgmt.databoxedge.v2020_09_01.models.IoTEdgeAgentInfo + :keyword compute_resource: Resource allocation. + :paramtype compute_resource: ~azure.mgmt.databoxedge.v2020_09_01.models.ComputeResource + :keyword role_status: Role status. Possible values include: "Enabled", "Disabled". + :paramtype role_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleStatus + """ super(IoTRole, self).__init__(**kwargs) self.kind = 'IOT' # type: str self.host_platform = host_platform @@ -2175,6 +2499,8 @@ def __init__( self, **kwargs ): + """ + """ super(Ipv4Config, self).__init__(**kwargs) self.ip_address = None self.subnet = None @@ -2210,6 +2536,8 @@ def __init__( self, **kwargs ): + """ + """ super(Ipv6Config, self).__init__(**kwargs) self.ip_address = None self.prefix_length = None @@ -2258,9 +2586,9 @@ class Job(msrest.serialization.Model): :vartype error_manifest_file: str :ivar refreshed_entity_id: ARM ID of the entity that was refreshed. :vartype refreshed_entity_id: str - :param folder: If only subfolders need to be refreshed, then the subfolder path inside the - share or container. (The path is empty if there are no subfolders.). - :type folder: str + :ivar folder: If only subfolders need to be refreshed, then the subfolder path inside the share + or container. (The path is empty if there are no subfolders.). + :vartype folder: str """ _validation = { @@ -2306,6 +2634,11 @@ def __init__( folder: Optional[str] = None, **kwargs ): + """ + :keyword folder: If only subfolders need to be refreshed, then the subfolder path inside the + share or container. (The path is empty if there are no subfolders.). + :paramtype folder: str + """ super(Job, self).__init__(**kwargs) self.id = None self.name = None @@ -2354,6 +2687,8 @@ def __init__( self, **kwargs ): + """ + """ super(JobErrorDetails, self).__init__(**kwargs) self.error_details = None self.code = None @@ -2389,6 +2724,8 @@ def __init__( self, **kwargs ): + """ + """ super(JobErrorItem, self).__init__(**kwargs) self.recommendations = None self.code = None @@ -2406,8 +2743,8 @@ class KubernetesClusterInfo(msrest.serialization.Model): :vartype etcd_info: ~azure.mgmt.databoxedge.v2020_09_01.models.EtcdInfo :ivar nodes: Kubernetes cluster nodes. :vartype nodes: list[~azure.mgmt.databoxedge.v2020_09_01.models.NodeInfo] - :param version: Required. Kubernetes cluster version. - :type version: str + :ivar version: Required. Kubernetes cluster version. + :vartype version: str """ _validation = { @@ -2428,6 +2765,10 @@ def __init__( version: str, **kwargs ): + """ + :keyword version: Required. Kubernetes cluster version. + :paramtype version: str + """ super(KubernetesClusterInfo, self).__init__(**kwargs) self.etcd_info = None self.nodes = None @@ -2441,8 +2782,8 @@ class KubernetesIPConfiguration(msrest.serialization.Model): :ivar port: Port of the Kubernetes node. :vartype port: str - :param ip_address: IP address of the Kubernetes node. - :type ip_address: str + :ivar ip_address: IP address of the Kubernetes node. + :vartype ip_address: str """ _validation = { @@ -2460,6 +2801,10 @@ def __init__( ip_address: Optional[str] = None, **kwargs ): + """ + :keyword ip_address: IP address of the Kubernetes node. + :paramtype ip_address: str + """ super(KubernetesIPConfiguration, self).__init__(**kwargs) self.port = None self.ip_address = ip_address @@ -2478,27 +2823,28 @@ class KubernetesRole(Role): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleTypes + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleTypes :ivar system_data: Role configured on ASE resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - :param host_platform: Host OS supported by the Kubernetes role. Possible values include: + :ivar host_platform: Host OS supported by the Kubernetes role. Possible values include: "Windows", "Linux". - :type host_platform: str or ~azure.mgmt.databoxedge.v2020_09_01.models.PlatformType + :vartype host_platform: str or ~azure.mgmt.databoxedge.v2020_09_01.models.PlatformType :ivar provisioning_state: State of Kubernetes deployment. Possible values include: "Invalid", "Creating", "Created", "Updating", "Reconfiguring", "Failed", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.databoxedge.v2020_09_01.models.KubernetesState :ivar host_platform_type: Platform where the runtime is hosted. Possible values include: "KubernetesCluster", "LinuxVM". :vartype host_platform_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.HostPlatformType - :param kubernetes_cluster_info: Kubernetes cluster configuration. - :type kubernetes_cluster_info: ~azure.mgmt.databoxedge.v2020_09_01.models.KubernetesClusterInfo - :param kubernetes_role_resources: Kubernetes role resources. - :type kubernetes_role_resources: + :ivar kubernetes_cluster_info: Kubernetes cluster configuration. + :vartype kubernetes_cluster_info: + ~azure.mgmt.databoxedge.v2020_09_01.models.KubernetesClusterInfo + :ivar kubernetes_role_resources: Kubernetes role resources. + :vartype kubernetes_role_resources: ~azure.mgmt.databoxedge.v2020_09_01.models.KubernetesRoleResources - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleStatus + :ivar role_status: Role status. Possible values include: "Enabled", "Disabled". + :vartype role_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleStatus """ _validation = { @@ -2534,6 +2880,19 @@ def __init__( role_status: Optional[Union[str, "RoleStatus"]] = None, **kwargs ): + """ + :keyword host_platform: Host OS supported by the Kubernetes role. Possible values include: + "Windows", "Linux". + :paramtype host_platform: str or ~azure.mgmt.databoxedge.v2020_09_01.models.PlatformType + :keyword kubernetes_cluster_info: Kubernetes cluster configuration. + :paramtype kubernetes_cluster_info: + ~azure.mgmt.databoxedge.v2020_09_01.models.KubernetesClusterInfo + :keyword kubernetes_role_resources: Kubernetes role resources. + :paramtype kubernetes_role_resources: + ~azure.mgmt.databoxedge.v2020_09_01.models.KubernetesRoleResources + :keyword role_status: Role status. Possible values include: "Enabled", "Disabled". + :paramtype role_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleStatus + """ super(KubernetesRole, self).__init__(**kwargs) self.kind = 'Kubernetes' # type: str self.host_platform = host_platform @@ -2551,8 +2910,8 @@ class KubernetesRoleCompute(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param vm_profile: Required. VM profile. - :type vm_profile: str + :ivar vm_profile: Required. VM profile. + :vartype vm_profile: str :ivar memory_in_bytes: Memory in bytes. :vartype memory_in_bytes: long :ivar processor_count: Processor count. @@ -2577,6 +2936,10 @@ def __init__( vm_profile: str, **kwargs ): + """ + :keyword vm_profile: Required. VM profile. + :paramtype vm_profile: str + """ super(KubernetesRoleCompute, self).__init__(**kwargs) self.vm_profile = vm_profile self.memory_in_bytes = None @@ -2608,6 +2971,8 @@ def __init__( self, **kwargs ): + """ + """ super(KubernetesRoleNetwork, self).__init__(**kwargs) self.cni_config = None self.load_balancer_config = None @@ -2620,10 +2985,10 @@ class KubernetesRoleResources(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param storage: Kubernetes role storage resource. - :type storage: ~azure.mgmt.databoxedge.v2020_09_01.models.KubernetesRoleStorage - :param compute: Required. Kubernetes role compute resource. - :type compute: ~azure.mgmt.databoxedge.v2020_09_01.models.KubernetesRoleCompute + :ivar storage: Kubernetes role storage resource. + :vartype storage: ~azure.mgmt.databoxedge.v2020_09_01.models.KubernetesRoleStorage + :ivar compute: Required. Kubernetes role compute resource. + :vartype compute: ~azure.mgmt.databoxedge.v2020_09_01.models.KubernetesRoleCompute :ivar network: Kubernetes role network resource. :vartype network: ~azure.mgmt.databoxedge.v2020_09_01.models.KubernetesRoleNetwork """ @@ -2646,6 +3011,12 @@ def __init__( storage: Optional["KubernetesRoleStorage"] = None, **kwargs ): + """ + :keyword storage: Kubernetes role storage resource. + :paramtype storage: ~azure.mgmt.databoxedge.v2020_09_01.models.KubernetesRoleStorage + :keyword compute: Required. Kubernetes role compute resource. + :paramtype compute: ~azure.mgmt.databoxedge.v2020_09_01.models.KubernetesRoleCompute + """ super(KubernetesRoleResources, self).__init__(**kwargs) self.storage = storage self.compute = compute @@ -2660,8 +3031,8 @@ class KubernetesRoleStorage(msrest.serialization.Model): :ivar storage_classes: Kubernetes storage class info. :vartype storage_classes: list[~azure.mgmt.databoxedge.v2020_09_01.models.KubernetesRoleStorageClassInfo] - :param endpoints: Mount points of shares in role(s). - :type endpoints: list[~azure.mgmt.databoxedge.v2020_09_01.models.MountPointMap] + :ivar endpoints: Mount points of shares in role(s). + :vartype endpoints: list[~azure.mgmt.databoxedge.v2020_09_01.models.MountPointMap] """ _validation = { @@ -2679,6 +3050,10 @@ def __init__( endpoints: Optional[List["MountPointMap"]] = None, **kwargs ): + """ + :keyword endpoints: Mount points of shares in role(s). + :paramtype endpoints: list[~azure.mgmt.databoxedge.v2020_09_01.models.MountPointMap] + """ super(KubernetesRoleStorage, self).__init__(**kwargs) self.storage_classes = None self.endpoints = endpoints @@ -2715,6 +3090,8 @@ def __init__( self, **kwargs ): + """ + """ super(KubernetesRoleStorageClassInfo, self).__init__(**kwargs) self.name = None self.type = None @@ -2746,6 +3123,8 @@ def __init__( self, **kwargs ): + """ + """ super(LoadBalancerConfig, self).__init__(**kwargs) self.type = None self.version = None @@ -2764,15 +3143,16 @@ class MECRole(Role): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleTypes + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleTypes :ivar system_data: Role configured on ASE resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - :param connection_string: Activation key of the MEC. - :type connection_string: ~azure.mgmt.databoxedge.v2020_09_01.models.AsymmetricEncryptedSecret - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleStatus + :ivar connection_string: Activation key of the MEC. + :vartype connection_string: + ~azure.mgmt.databoxedge.v2020_09_01.models.AsymmetricEncryptedSecret + :ivar role_status: Role status. Possible values include: "Enabled", "Disabled". + :vartype role_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleStatus """ _validation = { @@ -2800,6 +3180,13 @@ def __init__( role_status: Optional[Union[str, "RoleStatus"]] = None, **kwargs ): + """ + :keyword connection_string: Activation key of the MEC. + :paramtype connection_string: + ~azure.mgmt.databoxedge.v2020_09_01.models.AsymmetricEncryptedSecret + :keyword role_status: Role status. Possible values include: "Enabled", "Disabled". + :paramtype role_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.RoleStatus + """ super(MECRole, self).__init__(**kwargs) self.kind = 'MEC' # type: str self.connection_string = connection_string @@ -2811,15 +3198,15 @@ class MetricConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param resource_id: Required. The Resource ID on which the metrics should be pushed. - :type resource_id: str - :param mdm_account: The MDM account to which the counters should be pushed. - :type mdm_account: str - :param metric_name_space: The MDM namespace to which the counters should be pushed. This is + :ivar resource_id: Required. The Resource ID on which the metrics should be pushed. + :vartype resource_id: str + :ivar mdm_account: The MDM account to which the counters should be pushed. + :vartype mdm_account: str + :ivar metric_name_space: The MDM namespace to which the counters should be pushed. This is required if MDMAccount is specified. - :type metric_name_space: str - :param counter_sets: Required. Host name for the IoT hub associated to the device. - :type counter_sets: list[~azure.mgmt.databoxedge.v2020_09_01.models.MetricCounterSet] + :vartype metric_name_space: str + :ivar counter_sets: Required. Host name for the IoT hub associated to the device. + :vartype counter_sets: list[~azure.mgmt.databoxedge.v2020_09_01.models.MetricCounterSet] """ _validation = { @@ -2843,6 +3230,17 @@ def __init__( metric_name_space: Optional[str] = None, **kwargs ): + """ + :keyword resource_id: Required. The Resource ID on which the metrics should be pushed. + :paramtype resource_id: str + :keyword mdm_account: The MDM account to which the counters should be pushed. + :paramtype mdm_account: str + :keyword metric_name_space: The MDM namespace to which the counters should be pushed. This is + required if MDMAccount is specified. + :paramtype metric_name_space: str + :keyword counter_sets: Required. Host name for the IoT hub associated to the device. + :paramtype counter_sets: list[~azure.mgmt.databoxedge.v2020_09_01.models.MetricCounterSet] + """ super(MetricConfiguration, self).__init__(**kwargs) self.resource_id = resource_id self.mdm_account = mdm_account @@ -2855,14 +3253,15 @@ class MetricCounter(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The counter name. - :type name: str - :param instance: The instance from which counter should be collected. - :type instance: str - :param dimension_filter: The dimension filter. - :type dimension_filter: list[~azure.mgmt.databoxedge.v2020_09_01.models.MetricDimension] - :param additional_dimensions: The additional dimensions to be added to metric. - :type additional_dimensions: list[~azure.mgmt.databoxedge.v2020_09_01.models.MetricDimension] + :ivar name: Required. The counter name. + :vartype name: str + :ivar instance: The instance from which counter should be collected. + :vartype instance: str + :ivar dimension_filter: The dimension filter. + :vartype dimension_filter: list[~azure.mgmt.databoxedge.v2020_09_01.models.MetricDimension] + :ivar additional_dimensions: The additional dimensions to be added to metric. + :vartype additional_dimensions: + list[~azure.mgmt.databoxedge.v2020_09_01.models.MetricDimension] """ _validation = { @@ -2885,6 +3284,17 @@ def __init__( additional_dimensions: Optional[List["MetricDimension"]] = None, **kwargs ): + """ + :keyword name: Required. The counter name. + :paramtype name: str + :keyword instance: The instance from which counter should be collected. + :paramtype instance: str + :keyword dimension_filter: The dimension filter. + :paramtype dimension_filter: list[~azure.mgmt.databoxedge.v2020_09_01.models.MetricDimension] + :keyword additional_dimensions: The additional dimensions to be added to metric. + :paramtype additional_dimensions: + list[~azure.mgmt.databoxedge.v2020_09_01.models.MetricDimension] + """ super(MetricCounter, self).__init__(**kwargs) self.name = name self.instance = instance @@ -2897,8 +3307,8 @@ class MetricCounterSet(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param counters: Required. The counters that should be collected in this set. - :type counters: list[~azure.mgmt.databoxedge.v2020_09_01.models.MetricCounter] + :ivar counters: Required. The counters that should be collected in this set. + :vartype counters: list[~azure.mgmt.databoxedge.v2020_09_01.models.MetricCounter] """ _validation = { @@ -2915,6 +3325,10 @@ def __init__( counters: List["MetricCounter"], **kwargs ): + """ + :keyword counters: Required. The counters that should be collected in this set. + :paramtype counters: list[~azure.mgmt.databoxedge.v2020_09_01.models.MetricCounter] + """ super(MetricCounterSet, self).__init__(**kwargs) self.counters = counters @@ -2924,10 +3338,10 @@ class MetricDimension(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_type: Required. The dimension type. - :type source_type: str - :param source_name: Required. The dimension value. - :type source_name: str + :ivar source_type: Required. The dimension type. + :vartype source_type: str + :ivar source_name: Required. The dimension value. + :vartype source_name: str """ _validation = { @@ -2947,6 +3361,12 @@ def __init__( source_name: str, **kwargs ): + """ + :keyword source_type: Required. The dimension type. + :paramtype source_type: str + :keyword source_name: Required. The dimension value. + :paramtype source_name: str + """ super(MetricDimension, self).__init__(**kwargs) self.source_type = source_type self.source_name = source_name @@ -2955,12 +3375,12 @@ def __init__( class MetricDimensionV1(msrest.serialization.Model): """Metric Dimension v1. - :param name: Name of the metrics dimension. - :type name: str - :param display_name: Display name of the metrics dimension. - :type display_name: str - :param to_be_exported_for_shoebox: To be exported to shoe box. - :type to_be_exported_for_shoebox: bool + :ivar name: Name of the metrics dimension. + :vartype name: str + :ivar display_name: Display name of the metrics dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: To be exported to shoe box. + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -2977,6 +3397,14 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): + """ + :keyword name: Name of the metrics dimension. + :paramtype name: str + :keyword display_name: Display name of the metrics dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: To be exported to shoe box. + :paramtype to_be_exported_for_shoebox: bool + """ super(MetricDimensionV1, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -2986,31 +3414,32 @@ def __init__( class MetricSpecificationV1(msrest.serialization.Model): """Metric specification version 1. - :param name: Name of the metric. - :type name: str - :param display_name: Display name of the metric. - :type display_name: str - :param display_description: Description of the metric to be displayed. - :type display_description: str - :param unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Display name of the metric. + :vartype display_name: str + :ivar display_description: Description of the metric to be displayed. + :vartype display_description: str + :ivar unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", "Seconds", "Milliseconds", "Bytes", "BytesPerSecond", "CountPerSecond". - :type unit: str or ~azure.mgmt.databoxedge.v2020_09_01.models.MetricUnit - :param aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", + :vartype unit: str or ~azure.mgmt.databoxedge.v2020_09_01.models.MetricUnit + :ivar aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", "None", "Average", "Minimum", "Maximum", "Total", "Count". - :type aggregation_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.MetricAggregationType - :param dimensions: Metric dimensions, other than default dimension which is resource. - :type dimensions: list[~azure.mgmt.databoxedge.v2020_09_01.models.MetricDimensionV1] - :param fill_gap_with_zero: Set true to fill the gaps with zero. - :type fill_gap_with_zero: bool - :param category: Metric category. Possible values include: "Capacity", "Transaction". - :type category: str or ~azure.mgmt.databoxedge.v2020_09_01.models.MetricCategory - :param resource_id_dimension_name_override: Resource name override. - :type resource_id_dimension_name_override: str - :param supported_time_grain_types: Support granularity of metrics. - :type supported_time_grain_types: list[str or + :vartype aggregation_type: str or + ~azure.mgmt.databoxedge.v2020_09_01.models.MetricAggregationType + :ivar dimensions: Metric dimensions, other than default dimension which is resource. + :vartype dimensions: list[~azure.mgmt.databoxedge.v2020_09_01.models.MetricDimensionV1] + :ivar fill_gap_with_zero: Set true to fill the gaps with zero. + :vartype fill_gap_with_zero: bool + :ivar category: Metric category. Possible values include: "Capacity", "Transaction". + :vartype category: str or ~azure.mgmt.databoxedge.v2020_09_01.models.MetricCategory + :ivar resource_id_dimension_name_override: Resource name override. + :vartype resource_id_dimension_name_override: str + :ivar supported_time_grain_types: Support granularity of metrics. + :vartype supported_time_grain_types: list[str or ~azure.mgmt.databoxedge.v2020_09_01.models.TimeGrain] - :param supported_aggregation_types: Support metric aggregation type. - :type supported_aggregation_types: list[str or + :ivar supported_aggregation_types: Support metric aggregation type. + :vartype supported_aggregation_types: list[str or ~azure.mgmt.databoxedge.v2020_09_01.models.MetricAggregationType] """ @@ -3044,6 +3473,35 @@ def __init__( supported_aggregation_types: Optional[List[Union[str, "MetricAggregationType"]]] = None, **kwargs ): + """ + :keyword name: Name of the metric. + :paramtype name: str + :keyword display_name: Display name of the metric. + :paramtype display_name: str + :keyword display_description: Description of the metric to be displayed. + :paramtype display_description: str + :keyword unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", + "Seconds", "Milliseconds", "Bytes", "BytesPerSecond", "CountPerSecond". + :paramtype unit: str or ~azure.mgmt.databoxedge.v2020_09_01.models.MetricUnit + :keyword aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", + "None", "Average", "Minimum", "Maximum", "Total", "Count". + :paramtype aggregation_type: str or + ~azure.mgmt.databoxedge.v2020_09_01.models.MetricAggregationType + :keyword dimensions: Metric dimensions, other than default dimension which is resource. + :paramtype dimensions: list[~azure.mgmt.databoxedge.v2020_09_01.models.MetricDimensionV1] + :keyword fill_gap_with_zero: Set true to fill the gaps with zero. + :paramtype fill_gap_with_zero: bool + :keyword category: Metric category. Possible values include: "Capacity", "Transaction". + :paramtype category: str or ~azure.mgmt.databoxedge.v2020_09_01.models.MetricCategory + :keyword resource_id_dimension_name_override: Resource name override. + :paramtype resource_id_dimension_name_override: str + :keyword supported_time_grain_types: Support granularity of metrics. + :paramtype supported_time_grain_types: list[str or + ~azure.mgmt.databoxedge.v2020_09_01.models.TimeGrain] + :keyword supported_aggregation_types: Support metric aggregation type. + :paramtype supported_aggregation_types: list[str or + ~azure.mgmt.databoxedge.v2020_09_01.models.MetricAggregationType] + """ super(MetricSpecificationV1, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -3071,8 +3529,8 @@ class MonitoringMetricConfiguration(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param metric_configurations: Required. The metrics configuration details. - :type metric_configurations: + :ivar metric_configurations: Required. The metrics configuration details. + :vartype metric_configurations: list[~azure.mgmt.databoxedge.v2020_09_01.models.MetricConfiguration] """ @@ -3096,6 +3554,11 @@ def __init__( metric_configurations: List["MetricConfiguration"], **kwargs ): + """ + :keyword metric_configurations: Required. The metrics configuration details. + :paramtype metric_configurations: + list[~azure.mgmt.databoxedge.v2020_09_01.models.MetricConfiguration] + """ super(MonitoringMetricConfiguration, self).__init__(**kwargs) self.metric_configurations = metric_configurations @@ -3125,6 +3588,8 @@ def __init__( self, **kwargs ): + """ + """ super(MonitoringMetricConfigurationList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3137,8 +3602,8 @@ class MountPointMap(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param share_id: Required. ID of the share mounted to the role VM. - :type share_id: str + :ivar share_id: Required. ID of the share mounted to the role VM. + :vartype share_id: str :ivar role_id: ID of the role to which share is mounted. :vartype role_id: str :ivar mount_point: Mount point for the share. @@ -3172,6 +3637,10 @@ def __init__( share_id: str, **kwargs ): + """ + :keyword share_id: Required. ID of the share mounted to the role VM. + :paramtype share_id: str + """ super(MountPointMap, self).__init__(**kwargs) self.share_id = share_id self.role_id = None @@ -3204,12 +3673,14 @@ class NetworkAdapter(msrest.serialization.Model): :ivar status: Value indicating whether this adapter is valid. Possible values include: "Inactive", "Active". :vartype status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.NetworkAdapterStatus - :param rdma_status: Value indicating whether this adapter is RDMA capable. Possible values + :ivar rdma_status: Value indicating whether this adapter is RDMA capable. Possible values include: "Incapable", "Capable". - :type rdma_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.NetworkAdapterRDMAStatus - :param dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values + :vartype rdma_status: str or + ~azure.mgmt.databoxedge.v2020_09_01.models.NetworkAdapterRDMAStatus + :ivar dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values include: "Disabled", "Enabled". - :type dhcp_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.NetworkAdapterDHCPStatus + :vartype dhcp_status: str or + ~azure.mgmt.databoxedge.v2020_09_01.models.NetworkAdapterDHCPStatus :ivar ipv4_configuration: The IPv4 configuration of the network adapter. :vartype ipv4_configuration: ~azure.mgmt.databoxedge.v2020_09_01.models.Ipv4Config :ivar ipv6_configuration: The IPv6 configuration of the network adapter. @@ -3261,6 +3732,16 @@ def __init__( dhcp_status: Optional[Union[str, "NetworkAdapterDHCPStatus"]] = None, **kwargs ): + """ + :keyword rdma_status: Value indicating whether this adapter is RDMA capable. Possible values + include: "Incapable", "Capable". + :paramtype rdma_status: str or + ~azure.mgmt.databoxedge.v2020_09_01.models.NetworkAdapterRDMAStatus + :keyword dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values + include: "Disabled", "Enabled". + :paramtype dhcp_status: str or + ~azure.mgmt.databoxedge.v2020_09_01.models.NetworkAdapterDHCPStatus + """ super(NetworkAdapter, self).__init__(**kwargs) self.adapter_id = None self.adapter_position = None @@ -3304,6 +3785,8 @@ def __init__( self, **kwargs ): + """ + """ super(NetworkAdapterPosition, self).__init__(**kwargs) self.network_group = None self.port = None @@ -3342,6 +3825,8 @@ def __init__( self, **kwargs ): + """ + """ super(NetworkSettings, self).__init__(**kwargs) self.network_adapters = None @@ -3407,6 +3892,8 @@ def __init__( self, **kwargs ): + """ + """ super(Node, self).__init__(**kwargs) self.node_status = None self.node_chassis_serial_number = None @@ -3426,8 +3913,8 @@ class NodeInfo(msrest.serialization.Model): :vartype name: str :ivar type: Node type - Master/Worker. Possible values include: "Invalid", "Master", "Worker". :vartype type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.KubernetesNodeType - :param ip_configuration: IP Configuration of the Kubernetes node. - :type ip_configuration: + :ivar ip_configuration: IP Configuration of the Kubernetes node. + :vartype ip_configuration: list[~azure.mgmt.databoxedge.v2020_09_01.models.KubernetesIPConfiguration] """ @@ -3448,6 +3935,11 @@ def __init__( ip_configuration: Optional[List["KubernetesIPConfiguration"]] = None, **kwargs ): + """ + :keyword ip_configuration: IP Configuration of the Kubernetes node. + :paramtype ip_configuration: + list[~azure.mgmt.databoxedge.v2020_09_01.models.KubernetesIPConfiguration] + """ super(NodeInfo, self).__init__(**kwargs) self.name = None self.type = None @@ -3461,8 +3953,8 @@ class NodeList(msrest.serialization.Model): :ivar value: The list of Nodes. :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01.models.Node] - :param next_link: Link to the next set of results. - :type next_link: str + :ivar next_link: Link to the next set of results. + :vartype next_link: str """ _validation = { @@ -3480,6 +3972,10 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: Link to the next set of results. + :paramtype next_link: str + """ super(NodeList, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -3488,16 +3984,16 @@ def __init__( class Operation(msrest.serialization.Model): """Operations. - :param name: Name of the operation. - :type name: str - :param display: Properties displayed for the operation. - :type display: ~azure.mgmt.databoxedge.v2020_09_01.models.OperationDisplay - :param origin: Origin of the operation. - :type origin: str - :param is_data_action: Indicates whether the operation is a data action. - :type is_data_action: bool - :param service_specification: Service specification. - :type service_specification: ~azure.mgmt.databoxedge.v2020_09_01.models.ServiceSpecification + :ivar name: Name of the operation. + :vartype name: str + :ivar display: Properties displayed for the operation. + :vartype display: ~azure.mgmt.databoxedge.v2020_09_01.models.OperationDisplay + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar service_specification: Service specification. + :vartype service_specification: ~azure.mgmt.databoxedge.v2020_09_01.models.ServiceSpecification """ _attribute_map = { @@ -3518,6 +4014,19 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword name: Name of the operation. + :paramtype name: str + :keyword display: Properties displayed for the operation. + :paramtype display: ~azure.mgmt.databoxedge.v2020_09_01.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + :keyword service_specification: Service specification. + :paramtype service_specification: + ~azure.mgmt.databoxedge.v2020_09_01.models.ServiceSpecification + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -3529,14 +4038,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Operation display properties. - :param provider: Provider name. - :type provider: str - :param resource: The type of resource in which the operation is performed. - :type resource: str - :param operation: Operation to be performed on the resource. - :type operation: str - :param description: Description of the operation to be performed. - :type description: str + :ivar provider: Provider name. + :vartype provider: str + :ivar resource: The type of resource in which the operation is performed. + :vartype resource: str + :ivar operation: Operation to be performed on the resource. + :vartype operation: str + :ivar description: Description of the operation to be performed. + :vartype description: str """ _attribute_map = { @@ -3555,6 +4064,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Provider name. + :paramtype provider: str + :keyword resource: The type of resource in which the operation is performed. + :paramtype resource: str + :keyword operation: Operation to be performed on the resource. + :paramtype operation: str + :keyword description: Description of the operation to be performed. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -3567,10 +4086,10 @@ class OperationsList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The value. - :type value: list[~azure.mgmt.databoxedge.v2020_09_01.models.Operation] - :param next_link: Link to the next set of results. - :type next_link: str + :ivar value: Required. The value. + :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01.models.Operation] + :ivar next_link: Link to the next set of results. + :vartype next_link: str """ _validation = { @@ -3589,6 +4108,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The value. + :paramtype value: list[~azure.mgmt.databoxedge.v2020_09_01.models.Operation] + :keyword next_link: Link to the next set of results. + :paramtype next_link: str + """ super(OperationsList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3605,10 +4130,10 @@ class Order(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param contact_information: The contact details. - :type contact_information: ~azure.mgmt.databoxedge.v2020_09_01.models.ContactDetails - :param shipping_address: The shipping address. - :type shipping_address: ~azure.mgmt.databoxedge.v2020_09_01.models.Address + :ivar contact_information: The contact details. + :vartype contact_information: ~azure.mgmt.databoxedge.v2020_09_01.models.ContactDetails + :ivar shipping_address: The shipping address. + :vartype shipping_address: ~azure.mgmt.databoxedge.v2020_09_01.models.Address :ivar current_status: Current status of the order. :vartype current_status: ~azure.mgmt.databoxedge.v2020_09_01.models.OrderStatus :ivar order_history: List of status changes in the order. @@ -3621,9 +4146,9 @@ class Order(ARMBaseModel): :ivar return_tracking_info: Tracking information for the package returned from the customer whether it has an original or a replacement device. :vartype return_tracking_info: list[~azure.mgmt.databoxedge.v2020_09_01.models.TrackingInfo] - :param shipment_type: ShipmentType of the order. Possible values include: "NotApplicable", + :ivar shipment_type: ShipmentType of the order. Possible values include: "NotApplicable", "ShippedToCustomer", "SelfPickup". - :type shipment_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.ShipmentType + :vartype shipment_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.ShipmentType """ _validation = { @@ -3659,6 +4184,15 @@ def __init__( shipment_type: Optional[Union[str, "ShipmentType"]] = None, **kwargs ): + """ + :keyword contact_information: The contact details. + :paramtype contact_information: ~azure.mgmt.databoxedge.v2020_09_01.models.ContactDetails + :keyword shipping_address: The shipping address. + :paramtype shipping_address: ~azure.mgmt.databoxedge.v2020_09_01.models.Address + :keyword shipment_type: ShipmentType of the order. Possible values include: "NotApplicable", + "ShippedToCustomer", "SelfPickup". + :paramtype shipment_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.ShipmentType + """ super(Order, self).__init__(**kwargs) self.contact_information = contact_information self.shipping_address = shipping_address @@ -3695,6 +4229,8 @@ def __init__( self, **kwargs ): + """ + """ super(OrderList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3707,16 +4243,16 @@ class OrderStatus(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param status: Required. Status of the order as per the allowed status types. Possible values + :ivar status: Required. Status of the order as per the allowed status types. Possible values include: "Untracked", "AwaitingFulfilment", "AwaitingPreparation", "AwaitingShipment", "Shipped", "Arriving", "Delivered", "ReplacementRequested", "LostDevice", "Declined", "ReturnInitiated", "AwaitingReturnShipment", "ShippedBack", "CollectedAtMicrosoft", "AwaitingPickup", "PickupCompleted", "AwaitingDrop". - :type status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.OrderState + :vartype status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.OrderState :ivar update_date_time: Time of status update. :vartype update_date_time: ~datetime.datetime - :param comments: Comments related to this status change. - :type comments: str + :ivar comments: Comments related to this status change. + :vartype comments: str :ivar tracking_information: Tracking information related to the state in the ordering flow. :vartype tracking_information: ~azure.mgmt.databoxedge.v2020_09_01.models.TrackingInfo :ivar additional_order_details: Dictionary to hold generic information which is not stored @@ -3746,6 +4282,16 @@ def __init__( comments: Optional[str] = None, **kwargs ): + """ + :keyword status: Required. Status of the order as per the allowed status types. Possible values + include: "Untracked", "AwaitingFulfilment", "AwaitingPreparation", "AwaitingShipment", + "Shipped", "Arriving", "Delivered", "ReplacementRequested", "LostDevice", "Declined", + "ReturnInitiated", "AwaitingReturnShipment", "ShippedBack", "CollectedAtMicrosoft", + "AwaitingPickup", "PickupCompleted", "AwaitingDrop". + :paramtype status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.OrderState + :keyword comments: Comments related to this status change. + :paramtype comments: str + """ super(OrderStatus, self).__init__(**kwargs) self.status = status self.update_date_time = None @@ -3769,17 +4315,17 @@ class PeriodicTimerEventTrigger(Trigger): :vartype type: str :ivar system_data: Trigger in DataBoxEdge Resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: + :ivar kind: Required. Trigger Kind.Constant filled by server. Possible values include: "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.TriggerEventType - :param source_info: Required. Periodic timer details. - :type source_info: ~azure.mgmt.databoxedge.v2020_09_01.models.PeriodicTimerSourceInfo - :param sink_info: Required. Role Sink information. - :type sink_info: ~azure.mgmt.databoxedge.v2020_09_01.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_09_01.models.TriggerEventType + :ivar source_info: Required. Periodic timer details. + :vartype source_info: ~azure.mgmt.databoxedge.v2020_09_01.models.PeriodicTimerSourceInfo + :ivar sink_info: Required. Role Sink information. + :vartype sink_info: ~azure.mgmt.databoxedge.v2020_09_01.models.RoleSinkInfo + :ivar custom_context_tag: A custom context tag typically used to correlate the trigger against its usage. For example, if a periodic timer trigger is intended for certain specific IoT modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str + :vartype custom_context_tag: str """ _validation = { @@ -3812,6 +4358,16 @@ def __init__( custom_context_tag: Optional[str] = None, **kwargs ): + """ + :keyword source_info: Required. Periodic timer details. + :paramtype source_info: ~azure.mgmt.databoxedge.v2020_09_01.models.PeriodicTimerSourceInfo + :keyword sink_info: Required. Role Sink information. + :paramtype sink_info: ~azure.mgmt.databoxedge.v2020_09_01.models.RoleSinkInfo + :keyword custom_context_tag: A custom context tag typically used to correlate the trigger + against its usage. For example, if a periodic timer trigger is intended for certain specific + IoT modules in the device, the tag can be the name or the image URL of the module. + :paramtype custom_context_tag: str + """ super(PeriodicTimerEventTrigger, self).__init__(**kwargs) self.kind = 'PeriodicTimerEvent' # type: str self.source_info = source_info @@ -3824,15 +4380,15 @@ class PeriodicTimerSourceInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param start_time: Required. The time of the day that results in a valid trigger. Schedule is + :ivar start_time: Required. The time of the day that results in a valid trigger. Schedule is computed with reference to the time specified upto seconds. If timezone is not specified the time will considered to be in device timezone. The value will always be returned as UTC time. - :type start_time: ~datetime.datetime - :param schedule: Required. Periodic frequency at which timer event needs to be raised. Supports + :vartype start_time: ~datetime.datetime + :ivar schedule: Required. Periodic frequency at which timer event needs to be raised. Supports daily, hourly, minutes, and seconds. - :type schedule: str - :param topic: Topic where periodic events are published to IoT device. - :type topic: str + :vartype schedule: str + :ivar topic: Topic where periodic events are published to IoT device. + :vartype topic: str """ _validation = { @@ -3854,6 +4410,17 @@ def __init__( topic: Optional[str] = None, **kwargs ): + """ + :keyword start_time: Required. The time of the day that results in a valid trigger. Schedule is + computed with reference to the time specified upto seconds. If timezone is not specified the + time will considered to be in device timezone. The value will always be returned as UTC time. + :paramtype start_time: ~datetime.datetime + :keyword schedule: Required. Periodic frequency at which timer event needs to be raised. + Supports daily, hourly, minutes, and seconds. + :paramtype schedule: str + :keyword topic: Topic where periodic events are published to IoT device. + :paramtype topic: str + """ super(PeriodicTimerSourceInfo, self).__init__(**kwargs) self.start_time = start_time self.schedule = schedule @@ -3863,21 +4430,21 @@ def __init__( class RefreshDetails(msrest.serialization.Model): """Fields for tracking refresh job on the share or container. - :param in_progress_refresh_job_id: If a refresh job is currently in progress on this share or + :ivar in_progress_refresh_job_id: If a refresh job is currently in progress on this share or container, this field indicates the ARM resource ID of that job. The field is empty if no job is in progress. - :type in_progress_refresh_job_id: str - :param last_completed_refresh_job_time_in_utc: Indicates the completed time for the last - refresh job on this particular share or container, if any.This could be a failed job or a - successful job. - :type last_completed_refresh_job_time_in_utc: ~datetime.datetime - :param error_manifest_file: Indicates the relative path of the error xml for the last refresh + :vartype in_progress_refresh_job_id: str + :ivar last_completed_refresh_job_time_in_utc: Indicates the completed time for the last refresh + job on this particular share or container, if any.This could be a failed job or a successful + job. + :vartype last_completed_refresh_job_time_in_utc: ~datetime.datetime + :ivar error_manifest_file: Indicates the relative path of the error xml for the last refresh job on this particular share or container, if any. This could be a failed job or a successful job. - :type error_manifest_file: str - :param last_job: Indicates the id of the last refresh job on this particular share or + :vartype error_manifest_file: str + :ivar last_job: Indicates the id of the last refresh job on this particular share or container,if any. This could be a failed job or a successful job. - :type last_job: str + :vartype last_job: str """ _attribute_map = { @@ -3896,6 +4463,23 @@ def __init__( last_job: Optional[str] = None, **kwargs ): + """ + :keyword in_progress_refresh_job_id: If a refresh job is currently in progress on this share or + container, this field indicates the ARM resource ID of that job. The field is empty if no job + is in progress. + :paramtype in_progress_refresh_job_id: str + :keyword last_completed_refresh_job_time_in_utc: Indicates the completed time for the last + refresh job on this particular share or container, if any.This could be a failed job or a + successful job. + :paramtype last_completed_refresh_job_time_in_utc: ~datetime.datetime + :keyword error_manifest_file: Indicates the relative path of the error xml for the last refresh + job on this particular share or container, if any. This could be a failed job or a successful + job. + :paramtype error_manifest_file: str + :keyword last_job: Indicates the id of the last refresh job on this particular share or + container,if any. This could be a failed job or a successful job. + :paramtype last_job: str + """ super(RefreshDetails, self).__init__(**kwargs) self.in_progress_refresh_job_id = in_progress_refresh_job_id self.last_completed_refresh_job_time_in_utc = last_completed_refresh_job_time_in_utc @@ -3908,8 +4492,8 @@ class ResourceIdentity(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param type: Identity type. Possible values include: "None", "SystemAssigned", "UserAssigned". - :type type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.MsiIdentityType + :ivar type: Identity type. Possible values include: "None", "SystemAssigned", "UserAssigned". + :vartype type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.MsiIdentityType :ivar principal_id: Service Principal Id backing the Msi. :vartype principal_id: str :ivar tenant_id: Home Tenant Id. @@ -3933,6 +4517,11 @@ def __init__( type: Optional[Union[str, "MsiIdentityType"]] = None, **kwargs ): + """ + :keyword type: Identity type. Possible values include: "None", "SystemAssigned", + "UserAssigned". + :paramtype type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.MsiIdentityType + """ super(ResourceIdentity, self).__init__(**kwargs) self.type = type self.principal_id = None @@ -3942,13 +4531,13 @@ def __init__( class ResourceMoveDetails(msrest.serialization.Model): """Fields for tracking resource move. - :param operation_in_progress: Denotes whether move operation is in progress. Possible values + :ivar operation_in_progress: Denotes whether move operation is in progress. Possible values include: "None", "ResourceMoveInProgress", "ResourceMoveFailed". - :type operation_in_progress: str or + :vartype operation_in_progress: str or ~azure.mgmt.databoxedge.v2020_09_01.models.ResourceMoveStatus - :param operation_in_progress_lock_timeout_in_utc: Denotes the timeout of the operation to + :ivar operation_in_progress_lock_timeout_in_utc: Denotes the timeout of the operation to finish. - :type operation_in_progress_lock_timeout_in_utc: ~datetime.datetime + :vartype operation_in_progress_lock_timeout_in_utc: ~datetime.datetime """ _attribute_map = { @@ -3963,6 +4552,15 @@ def __init__( operation_in_progress_lock_timeout_in_utc: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword operation_in_progress: Denotes whether move operation is in progress. Possible values + include: "None", "ResourceMoveInProgress", "ResourceMoveFailed". + :paramtype operation_in_progress: str or + ~azure.mgmt.databoxedge.v2020_09_01.models.ResourceMoveStatus + :keyword operation_in_progress_lock_timeout_in_utc: Denotes the timeout of the operation to + finish. + :paramtype operation_in_progress_lock_timeout_in_utc: ~datetime.datetime + """ super(ResourceMoveDetails, self).__init__(**kwargs) self.operation_in_progress = operation_in_progress self.operation_in_progress_lock_timeout_in_utc = operation_in_progress_lock_timeout_in_utc @@ -3993,6 +4591,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceTypeSku, self).__init__(**kwargs) self.resource_type = None self.skus = None @@ -4023,6 +4623,8 @@ def __init__( self, **kwargs ): + """ + """ super(RoleList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4033,8 +4635,8 @@ class RoleSinkInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param role_id: Required. Compute role ID. - :type role_id: str + :ivar role_id: Required. Compute role ID. + :vartype role_id: str """ _validation = { @@ -4051,6 +4653,10 @@ def __init__( role_id: str, **kwargs ): + """ + :keyword role_id: Required. Compute role ID. + :paramtype role_id: str + """ super(RoleSinkInfo, self).__init__(**kwargs) self.role_id = role_id @@ -4068,11 +4674,11 @@ class SecuritySettings(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param device_admin_password: Required. Device administrator password as an encrypted string + :ivar device_admin_password: Required. Device administrator password as an encrypted string (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual password should have at least 8 characters that are a combination of uppercase, lowercase, numeric, and special characters. - :type device_admin_password: + :vartype device_admin_password: ~azure.mgmt.databoxedge.v2020_09_01.models.AsymmetricEncryptedSecret """ @@ -4096,6 +4702,14 @@ def __init__( device_admin_password: "AsymmetricEncryptedSecret", **kwargs ): + """ + :keyword device_admin_password: Required. Device administrator password as an encrypted string + (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual + password should have at least 8 characters that are a combination of uppercase, lowercase, + numeric, and special characters. + :paramtype device_admin_password: + ~azure.mgmt.databoxedge.v2020_09_01.models.AsymmetricEncryptedSecret + """ super(SecuritySettings, self).__init__(**kwargs) self.device_admin_password = device_admin_password @@ -4103,8 +4717,8 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """Service specification. - :param metric_specifications: Metric specification as defined by shoebox. - :type metric_specifications: + :ivar metric_specifications: Metric specification as defined by shoebox. + :vartype metric_specifications: list[~azure.mgmt.databoxedge.v2020_09_01.models.MetricSpecificationV1] """ @@ -4118,6 +4732,11 @@ def __init__( metric_specifications: Optional[List["MetricSpecificationV1"]] = None, **kwargs ): + """ + :keyword metric_specifications: Metric specification as defined by shoebox. + :paramtype metric_specifications: + list[~azure.mgmt.databoxedge.v2020_09_01.models.MetricSpecificationV1] + """ super(ServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications @@ -4137,31 +4756,32 @@ class Share(ARMBaseModel): :vartype type: str :ivar system_data: Share on ASE device. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - :param description: Description for the share. - :type description: str - :param share_status: Required. Current status of the share. Possible values include: "Offline", + :ivar description: Description for the share. + :vartype description: str + :ivar share_status: Required. Current status of the share. Possible values include: "Offline", "Unknown", "OK", "Updating", "NeedsAttention". - :type share_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.ShareStatus - :param monitoring_status: Required. Current monitoring status of the share. Possible values + :vartype share_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.ShareStatus + :ivar monitoring_status: Required. Current monitoring status of the share. Possible values include: "Enabled", "Disabled". - :type monitoring_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.MonitoringStatus - :param azure_container_info: Azure container mapping for the share. - :type azure_container_info: ~azure.mgmt.databoxedge.v2020_09_01.models.AzureContainerInfo - :param access_protocol: Required. Access protocol to be used by the share. Possible values + :vartype monitoring_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.MonitoringStatus + :ivar azure_container_info: Azure container mapping for the share. + :vartype azure_container_info: ~azure.mgmt.databoxedge.v2020_09_01.models.AzureContainerInfo + :ivar access_protocol: Required. Access protocol to be used by the share. Possible values include: "SMB", "NFS". - :type access_protocol: str or ~azure.mgmt.databoxedge.v2020_09_01.models.ShareAccessProtocol - :param user_access_rights: Mapping of users and corresponding access rights on the share + :vartype access_protocol: str or ~azure.mgmt.databoxedge.v2020_09_01.models.ShareAccessProtocol + :ivar user_access_rights: Mapping of users and corresponding access rights on the share (required for SMB protocol). - :type user_access_rights: list[~azure.mgmt.databoxedge.v2020_09_01.models.UserAccessRight] - :param client_access_rights: List of IP addresses and corresponding access rights on the + :vartype user_access_rights: list[~azure.mgmt.databoxedge.v2020_09_01.models.UserAccessRight] + :ivar client_access_rights: List of IP addresses and corresponding access rights on the share(required for NFS protocol). - :type client_access_rights: list[~azure.mgmt.databoxedge.v2020_09_01.models.ClientAccessRight] - :param refresh_details: Details of the refresh job on this share. - :type refresh_details: ~azure.mgmt.databoxedge.v2020_09_01.models.RefreshDetails + :vartype client_access_rights: + list[~azure.mgmt.databoxedge.v2020_09_01.models.ClientAccessRight] + :ivar refresh_details: Details of the refresh job on this share. + :vartype refresh_details: ~azure.mgmt.databoxedge.v2020_09_01.models.RefreshDetails :ivar share_mappings: Share mount point to the role. :vartype share_mappings: list[~azure.mgmt.databoxedge.v2020_09_01.models.MountPointMap] - :param data_policy: Data policy of the share. Possible values include: "Cloud", "Local". - :type data_policy: str or ~azure.mgmt.databoxedge.v2020_09_01.models.DataPolicy + :ivar data_policy: Data policy of the share. Possible values include: "Cloud", "Local". + :vartype data_policy: str or ~azure.mgmt.databoxedge.v2020_09_01.models.DataPolicy """ _validation = { @@ -4206,6 +4826,34 @@ def __init__( data_policy: Optional[Union[str, "DataPolicy"]] = None, **kwargs ): + """ + :keyword description: Description for the share. + :paramtype description: str + :keyword share_status: Required. Current status of the share. Possible values include: + "Offline", "Unknown", "OK", "Updating", "NeedsAttention". + :paramtype share_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.ShareStatus + :keyword monitoring_status: Required. Current monitoring status of the share. Possible values + include: "Enabled", "Disabled". + :paramtype monitoring_status: str or + ~azure.mgmt.databoxedge.v2020_09_01.models.MonitoringStatus + :keyword azure_container_info: Azure container mapping for the share. + :paramtype azure_container_info: ~azure.mgmt.databoxedge.v2020_09_01.models.AzureContainerInfo + :keyword access_protocol: Required. Access protocol to be used by the share. Possible values + include: "SMB", "NFS". + :paramtype access_protocol: str or + ~azure.mgmt.databoxedge.v2020_09_01.models.ShareAccessProtocol + :keyword user_access_rights: Mapping of users and corresponding access rights on the share + (required for SMB protocol). + :paramtype user_access_rights: list[~azure.mgmt.databoxedge.v2020_09_01.models.UserAccessRight] + :keyword client_access_rights: List of IP addresses and corresponding access rights on the + share(required for NFS protocol). + :paramtype client_access_rights: + list[~azure.mgmt.databoxedge.v2020_09_01.models.ClientAccessRight] + :keyword refresh_details: Details of the refresh job on this share. + :paramtype refresh_details: ~azure.mgmt.databoxedge.v2020_09_01.models.RefreshDetails + :keyword data_policy: Data policy of the share. Possible values include: "Cloud", "Local". + :paramtype data_policy: str or ~azure.mgmt.databoxedge.v2020_09_01.models.DataPolicy + """ super(Share, self).__init__(**kwargs) self.system_data = None self.description = description @@ -4225,11 +4873,11 @@ class ShareAccessRight(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param share_id: Required. The share ID. - :type share_id: str - :param access_type: Required. Type of access to be allowed on the share for this user. Possible + :ivar share_id: Required. The share ID. + :vartype share_id: str + :ivar access_type: Required. Type of access to be allowed on the share for this user. Possible values include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.ShareAccessType + :vartype access_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.ShareAccessType """ _validation = { @@ -4249,6 +4897,13 @@ def __init__( access_type: Union[str, "ShareAccessType"], **kwargs ): + """ + :keyword share_id: Required. The share ID. + :paramtype share_id: str + :keyword access_type: Required. Type of access to be allowed on the share for this user. + Possible values include: "Change", "Read", "Custom". + :paramtype access_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.ShareAccessType + """ super(ShareAccessRight, self).__init__(**kwargs) self.share_id = share_id self.access_type = access_type @@ -4279,6 +4934,8 @@ def __init__( self, **kwargs ): + """ + """ super(ShareList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4287,13 +4944,13 @@ def __init__( class Sku(msrest.serialization.Model): """The SKU type. - :param name: SKU name. Possible values include: "Gateway", "Edge", "TEA_1Node", - "TEA_1Node_UPS", "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", - "TEA_4Node_UPS_Heater", "TMA", "TDC", "TCA_Small", "GPU", "TCA_Large", "EdgeP_Base", - "EdgeP_High", "EdgePR_Base", "EdgePR_Base_UPS", "EdgeMR_Mini", "RCA_Small", "RCA_Large", "RDC". - :type name: str or ~azure.mgmt.databoxedge.v2020_09_01.models.SkuName - :param tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard". - :type tier: str or ~azure.mgmt.databoxedge.v2020_09_01.models.SkuTier + :ivar name: SKU name. Possible values include: "Gateway", "Edge", "TEA_1Node", "TEA_1Node_UPS", + "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", "TEA_4Node_UPS_Heater", "TMA", + "TDC", "TCA_Small", "GPU", "TCA_Large", "EdgeP_Base", "EdgeP_High", "EdgePR_Base", + "EdgePR_Base_UPS", "EdgeMR_Mini", "RCA_Small", "RCA_Large", "RDC". + :vartype name: str or ~azure.mgmt.databoxedge.v2020_09_01.models.SkuName + :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard". + :vartype tier: str or ~azure.mgmt.databoxedge.v2020_09_01.models.SkuTier """ _attribute_map = { @@ -4308,6 +4965,16 @@ def __init__( tier: Optional[Union[str, "SkuTier"]] = None, **kwargs ): + """ + :keyword name: SKU name. Possible values include: "Gateway", "Edge", "TEA_1Node", + "TEA_1Node_UPS", "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", + "TEA_4Node_UPS_Heater", "TMA", "TDC", "TCA_Small", "GPU", "TCA_Large", "EdgeP_Base", + "EdgeP_High", "EdgePR_Base", "EdgePR_Base_UPS", "EdgeMR_Mini", "RCA_Small", "RCA_Large", "RDC". + :paramtype name: str or ~azure.mgmt.databoxedge.v2020_09_01.models.SkuName + :keyword tier: The SKU tier. This is based on the SKU name. Possible values include: + "Standard". + :paramtype tier: str or ~azure.mgmt.databoxedge.v2020_09_01.models.SkuTier + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -4342,6 +5009,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuCost, self).__init__(**kwargs) self.meter_id = None self.quantity = None @@ -4401,6 +5070,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuInformation, self).__init__(**kwargs) self.name = None self.tier = None @@ -4438,6 +5109,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuInformationList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4472,6 +5145,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuLocationInfo, self).__init__(**kwargs) self.location = None self.zones = None @@ -4493,17 +5168,17 @@ class StorageAccount(ARMBaseModel): :vartype type: str :ivar system_data: StorageAccount object on ASE device. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - :param description: Description for the storage Account. - :type description: str - :param storage_account_status: Current status of the storage account. Possible values include: + :ivar description: Description for the storage Account. + :vartype description: str + :ivar storage_account_status: Current status of the storage account. Possible values include: "OK", "Offline", "Unknown", "Updating", "NeedsAttention". - :type storage_account_status: str or + :vartype storage_account_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.StorageAccountStatus - :param data_policy: Required. Data policy of the storage Account. Possible values include: + :ivar data_policy: Required. Data policy of the storage Account. Possible values include: "Cloud", "Local". - :type data_policy: str or ~azure.mgmt.databoxedge.v2020_09_01.models.DataPolicy - :param storage_account_credential_id: Storage Account Credential Id. - :type storage_account_credential_id: str + :vartype data_policy: str or ~azure.mgmt.databoxedge.v2020_09_01.models.DataPolicy + :ivar storage_account_credential_id: Storage Account Credential Id. + :vartype storage_account_credential_id: str :ivar blob_endpoint: BlobEndpoint of Storage Account. :vartype blob_endpoint: str :ivar container_count: The Container Count. Present only for Storage Accounts with DataPolicy @@ -4543,6 +5218,19 @@ def __init__( storage_account_credential_id: Optional[str] = None, **kwargs ): + """ + :keyword description: Description for the storage Account. + :paramtype description: str + :keyword storage_account_status: Current status of the storage account. Possible values + include: "OK", "Offline", "Unknown", "Updating", "NeedsAttention". + :paramtype storage_account_status: str or + ~azure.mgmt.databoxedge.v2020_09_01.models.StorageAccountStatus + :keyword data_policy: Required. Data policy of the storage Account. Possible values include: + "Cloud", "Local". + :paramtype data_policy: str or ~azure.mgmt.databoxedge.v2020_09_01.models.DataPolicy + :keyword storage_account_credential_id: Storage Account Credential Id. + :paramtype storage_account_credential_id: str + """ super(StorageAccount, self).__init__(**kwargs) self.system_data = None self.description = description @@ -4568,25 +5256,25 @@ class StorageAccountCredential(ARMBaseModel): :vartype type: str :ivar system_data: StorageAccountCredential object. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - :param alias: Required. Alias for the storage account. - :type alias: str - :param user_name: Username for the storage account. - :type user_name: str - :param account_key: Encrypted storage key. - :type account_key: ~azure.mgmt.databoxedge.v2020_09_01.models.AsymmetricEncryptedSecret - :param connection_string: Connection string for the storage account. Use this string if - username and account key are not specified. - :type connection_string: str - :param ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible values + :ivar alias: Required. Alias for the storage account. + :vartype alias: str + :ivar user_name: Username for the storage account. + :vartype user_name: str + :ivar account_key: Encrypted storage key. + :vartype account_key: ~azure.mgmt.databoxedge.v2020_09_01.models.AsymmetricEncryptedSecret + :ivar connection_string: Connection string for the storage account. Use this string if username + and account key are not specified. + :vartype connection_string: str + :ivar ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible values include: "Enabled", "Disabled". - :type ssl_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.SSLStatus - :param blob_domain_name: Blob end point for private clouds. - :type blob_domain_name: str - :param account_type: Required. Type of storage accessed on the storage account. Possible values + :vartype ssl_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.SSLStatus + :ivar blob_domain_name: Blob end point for private clouds. + :vartype blob_domain_name: str + :ivar account_type: Required. Type of storage accessed on the storage account. Possible values include: "GeneralPurposeStorage", "BlobStorage". - :type account_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.AccountType - :param storage_account_id: Id of the storage account. - :type storage_account_id: str + :vartype account_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.AccountType + :ivar storage_account_id: Id of the storage account. + :vartype storage_account_id: str """ _validation = { @@ -4627,6 +5315,27 @@ def __init__( storage_account_id: Optional[str] = None, **kwargs ): + """ + :keyword alias: Required. Alias for the storage account. + :paramtype alias: str + :keyword user_name: Username for the storage account. + :paramtype user_name: str + :keyword account_key: Encrypted storage key. + :paramtype account_key: ~azure.mgmt.databoxedge.v2020_09_01.models.AsymmetricEncryptedSecret + :keyword connection_string: Connection string for the storage account. Use this string if + username and account key are not specified. + :paramtype connection_string: str + :keyword ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible + values include: "Enabled", "Disabled". + :paramtype ssl_status: str or ~azure.mgmt.databoxedge.v2020_09_01.models.SSLStatus + :keyword blob_domain_name: Blob end point for private clouds. + :paramtype blob_domain_name: str + :keyword account_type: Required. Type of storage accessed on the storage account. Possible + values include: "GeneralPurposeStorage", "BlobStorage". + :paramtype account_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.AccountType + :keyword storage_account_id: Id of the storage account. + :paramtype storage_account_id: str + """ super(StorageAccountCredential, self).__init__(**kwargs) self.system_data = None self.alias = alias @@ -4664,6 +5373,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountCredentialList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4694,6 +5405,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4702,10 +5415,10 @@ def __init__( class SubscriptionRegisteredFeatures(msrest.serialization.Model): """SubscriptionRegisteredFeatures. - :param name: - :type name: str - :param state: - :type state: str + :ivar name: + :vartype name: str + :ivar state: + :vartype state: str """ _attribute_map = { @@ -4720,6 +5433,12 @@ def __init__( state: Optional[str] = None, **kwargs ): + """ + :keyword name: + :paramtype name: str + :keyword state: + :paramtype state: str + """ super(SubscriptionRegisteredFeatures, self).__init__(**kwargs) self.name = name self.state = state @@ -4728,8 +5447,9 @@ def __init__( class SymmetricKey(msrest.serialization.Model): """Symmetric key for authentication. - :param connection_string: Connection string based on the symmetric key. - :type connection_string: ~azure.mgmt.databoxedge.v2020_09_01.models.AsymmetricEncryptedSecret + :ivar connection_string: Connection string based on the symmetric key. + :vartype connection_string: + ~azure.mgmt.databoxedge.v2020_09_01.models.AsymmetricEncryptedSecret """ _attribute_map = { @@ -4742,6 +5462,11 @@ def __init__( connection_string: Optional["AsymmetricEncryptedSecret"] = None, **kwargs ): + """ + :keyword connection_string: Connection string based on the symmetric key. + :paramtype connection_string: + ~azure.mgmt.databoxedge.v2020_09_01.models.AsymmetricEncryptedSecret + """ super(SymmetricKey, self).__init__(**kwargs) self.connection_string = connection_string @@ -4749,20 +5474,20 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.CreatedByType - :param last_modified_at: The type of identity that last modified the resource. - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.CreatedByType + :ivar last_modified_at: The type of identity that last modified the resource. + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -4785,6 +5510,23 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.databoxedge.v2020_09_01.models.CreatedByType + :keyword last_modified_at: The type of identity that last modified the resource. + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -4797,14 +5539,14 @@ def __init__( class TrackingInfo(msrest.serialization.Model): """Tracking courier information. - :param serial_number: Serial number of the device being tracked. - :type serial_number: str - :param carrier_name: Name of the carrier used in the delivery. - :type carrier_name: str - :param tracking_id: Tracking ID of the shipment. - :type tracking_id: str - :param tracking_url: Tracking URL of the shipment. - :type tracking_url: str + :ivar serial_number: Serial number of the device being tracked. + :vartype serial_number: str + :ivar carrier_name: Name of the carrier used in the delivery. + :vartype carrier_name: str + :ivar tracking_id: Tracking ID of the shipment. + :vartype tracking_id: str + :ivar tracking_url: Tracking URL of the shipment. + :vartype tracking_url: str """ _attribute_map = { @@ -4823,6 +5565,16 @@ def __init__( tracking_url: Optional[str] = None, **kwargs ): + """ + :keyword serial_number: Serial number of the device being tracked. + :paramtype serial_number: str + :keyword carrier_name: Name of the carrier used in the delivery. + :paramtype carrier_name: str + :keyword tracking_id: Tracking ID of the shipment. + :paramtype tracking_id: str + :keyword tracking_url: Tracking URL of the shipment. + :paramtype tracking_url: str + """ super(TrackingInfo, self).__init__(**kwargs) self.serial_number = serial_number self.carrier_name = carrier_name @@ -4855,6 +5607,8 @@ def __init__( self, **kwargs ): + """ + """ super(TriggerList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4902,6 +5656,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateDownloadProgress, self).__init__(**kwargs) self.download_phase = None self.percent_complete = None @@ -4940,6 +5696,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateInstallProgress, self).__init__(**kwargs) self.percent_complete = None self.number_of_updates_to_install = None @@ -4957,15 +5715,15 @@ class UpdateSummary(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param device_version_number: The current version of the device in format: 1.2.17312.13.",. - :type device_version_number: str - :param friendly_device_version_name: The current version of the device in text format. - :type friendly_device_version_name: str - :param device_last_scanned_date_time: The last time when a scan was done on the device. - :type device_last_scanned_date_time: ~datetime.datetime - :param last_completed_scan_job_date_time: The time when the last scan job was completed + :ivar device_version_number: The current version of the device in format: 1.2.17312.13.",. + :vartype device_version_number: str + :ivar friendly_device_version_name: The current version of the device in text format. + :vartype friendly_device_version_name: str + :ivar device_last_scanned_date_time: The last time when a scan was done on the device. + :vartype device_last_scanned_date_time: ~datetime.datetime + :ivar last_completed_scan_job_date_time: The time when the last scan job was completed (success/cancelled/failed) on the appliance. - :type last_completed_scan_job_date_time: ~datetime.datetime + :vartype last_completed_scan_job_date_time: ~datetime.datetime :ivar last_completed_download_job_date_time: The time when the last Download job was completed (success/cancelled/failed) on the appliance. :vartype last_completed_download_job_date_time: ~datetime.datetime @@ -5054,6 +5812,17 @@ def __init__( last_completed_scan_job_date_time: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword device_version_number: The current version of the device in format: 1.2.17312.13.",. + :paramtype device_version_number: str + :keyword friendly_device_version_name: The current version of the device in text format. + :paramtype friendly_device_version_name: str + :keyword device_last_scanned_date_time: The last time when a scan was done on the device. + :paramtype device_last_scanned_date_time: ~datetime.datetime + :keyword last_completed_scan_job_date_time: The time when the last scan job was completed + (success/cancelled/failed) on the appliance. + :paramtype last_completed_scan_job_date_time: ~datetime.datetime + """ super(UpdateSummary, self).__init__(**kwargs) self.device_version_number = device_version_number self.friendly_device_version_name = friendly_device_version_name @@ -5079,11 +5848,12 @@ class UploadCertificateRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param authentication_type: The authentication type. Possible values include: "Invalid", + :ivar authentication_type: The authentication type. Possible values include: "Invalid", "AzureActiveDirectory". - :type authentication_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.AuthenticationType - :param certificate: Required. The base64 encoded certificate raw data. - :type certificate: str + :vartype authentication_type: str or + ~azure.mgmt.databoxedge.v2020_09_01.models.AuthenticationType + :ivar certificate: Required. The base64 encoded certificate raw data. + :vartype certificate: str """ _validation = { @@ -5102,6 +5872,14 @@ def __init__( authentication_type: Optional[Union[str, "AuthenticationType"]] = None, **kwargs ): + """ + :keyword authentication_type: The authentication type. Possible values include: "Invalid", + "AzureActiveDirectory". + :paramtype authentication_type: str or + ~azure.mgmt.databoxedge.v2020_09_01.models.AuthenticationType + :keyword certificate: Required. The base64 encoded certificate raw data. + :paramtype certificate: str + """ super(UploadCertificateRequest, self).__init__(**kwargs) self.authentication_type = authentication_type self.certificate = certificate @@ -5112,9 +5890,9 @@ class UploadCertificateResponse(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param auth_type: Specifies authentication type. Possible values include: "Invalid", + :ivar auth_type: Specifies authentication type. Possible values include: "Invalid", "AzureActiveDirectory". - :type auth_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.AuthenticationType + :vartype auth_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.AuthenticationType :ivar resource_id: The resource ID of the Data Box Edge/Gateway device. :vartype resource_id: str :ivar aad_authority: Azure Active Directory tenant authority. @@ -5159,6 +5937,11 @@ def __init__( auth_type: Optional[Union[str, "AuthenticationType"]] = None, **kwargs ): + """ + :keyword auth_type: Specifies authentication type. Possible values include: "Invalid", + "AzureActiveDirectory". + :paramtype auth_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.AuthenticationType + """ super(UploadCertificateResponse, self).__init__(**kwargs) self.auth_type = auth_type self.resource_id = None @@ -5183,13 +5966,14 @@ class User(ARMBaseModel): :vartype type: str :ivar system_data: User in DataBoxEdge Resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01.models.SystemData - :param encrypted_password: The password details. - :type encrypted_password: ~azure.mgmt.databoxedge.v2020_09_01.models.AsymmetricEncryptedSecret + :ivar encrypted_password: The password details. + :vartype encrypted_password: + ~azure.mgmt.databoxedge.v2020_09_01.models.AsymmetricEncryptedSecret :ivar share_access_rights: List of shares that the user has rights on. This field should not be specified during user creation. :vartype share_access_rights: list[~azure.mgmt.databoxedge.v2020_09_01.models.ShareAccessRight] - :param user_type: Type of the user. Possible values include: "Share", "LocalManagement", "ARM". - :type user_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.UserType + :ivar user_type: Type of the user. Possible values include: "Share", "LocalManagement", "ARM". + :vartype user_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.UserType """ _validation = { @@ -5217,6 +6001,14 @@ def __init__( user_type: Optional[Union[str, "UserType"]] = None, **kwargs ): + """ + :keyword encrypted_password: The password details. + :paramtype encrypted_password: + ~azure.mgmt.databoxedge.v2020_09_01.models.AsymmetricEncryptedSecret + :keyword user_type: Type of the user. Possible values include: "Share", "LocalManagement", + "ARM". + :paramtype user_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.UserType + """ super(User, self).__init__(**kwargs) self.system_data = None self.encrypted_password = encrypted_password @@ -5229,11 +6021,11 @@ class UserAccessRight(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param user_id: Required. User ID (already existing in the device). - :type user_id: str - :param access_type: Required. Type of access to be allowed for the user. Possible values + :ivar user_id: Required. User ID (already existing in the device). + :vartype user_id: str + :ivar access_type: Required. Type of access to be allowed for the user. Possible values include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.ShareAccessType + :vartype access_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.ShareAccessType """ _validation = { @@ -5253,6 +6045,13 @@ def __init__( access_type: Union[str, "ShareAccessType"], **kwargs ): + """ + :keyword user_id: Required. User ID (already existing in the device). + :paramtype user_id: str + :keyword access_type: Required. Type of access to be allowed for the user. Possible values + include: "Change", "Read", "Custom". + :paramtype access_type: str or ~azure.mgmt.databoxedge.v2020_09_01.models.ShareAccessType + """ super(UserAccessRight, self).__init__(**kwargs) self.user_id = user_id self.access_type = access_type @@ -5283,6 +6082,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserList, self).__init__(**kwargs) self.value = None self.next_link = None diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_addons_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_addons_operations.py index 32c85be90393..8e8d6c2c1c92 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_addons_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_addons_operations.py @@ -5,25 +5,191 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_role_request( + device_name: str, + role_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + role_name: str, + addon_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "addonName": _SERIALIZER.url("addon_name", addon_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + role_name: str, + addon_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "addonName": _SERIALIZER.url("addon_name", addon_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + role_name: str, + addon_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "addonName": _SERIALIZER.url("addon_name", addon_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AddonsOperations(object): """AddonsOperations operations. @@ -47,14 +213,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_role( self, - device_name, # type: str - role_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AddonList"] + device_name: str, + role_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.AddonList"]: """Lists all the addons configured in the role. :param device_name: The device name. @@ -73,37 +239,35 @@ def list_by_role( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_role.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_role_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_role.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_role_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AddonList', pipeline_response) + deserialized = self._deserialize("AddonList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -121,20 +285,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_role.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - role_name, # type: str - addon_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Addon" + device_name: str, + role_name: str, + addon_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Addon": """Gets a specific addon by name. :param device_name: The device name. @@ -155,29 +320,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -191,51 +346,42 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - role_name, # type: str - addon_name, # type: str - resource_group_name, # type: str - addon, # type: "_models.Addon" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Addon"] + device_name: str, + role_name: str, + addon_name: str, + resource_group_name: str, + addon: "_models.Addon", + **kwargs: Any + ) -> Optional["_models.Addon"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Addon"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(addon, 'Addon') + + request = build_create_or_update_request_initial( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(addon, 'Addon') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -251,18 +397,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - role_name, # type: str - addon_name, # type: str - resource_group_name, # type: str - addon, # type: "_models.Addon" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Addon"] + device_name: str, + role_name: str, + addon_name: str, + resource_group_name: str, + addon: "_models.Addon", + **kwargs: Any + ) -> LROPoller["_models.Addon"]: """Create or update a addon. :param device_name: The device name. @@ -277,15 +425,18 @@ def begin_create_or_update( :type addon: ~azure.mgmt.databoxedge.v2020_09_01.models.Addon :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Addon or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.Addon] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Addon"] lro_delay = kwargs.pop( 'polling_interval', @@ -299,29 +450,21 @@ def begin_create_or_update( addon_name=addon_name, resource_group_name=resource_group_name, addon=addon, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Addon', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -333,45 +476,35 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore def _delete_initial( self, - device_name, # type: str - role_name, # type: str - addon_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + role_name: str, + addon_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -384,15 +517,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - role_name, # type: str - addon_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + role_name: str, + addon_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the addon on the device. :param device_name: The device name. @@ -405,15 +539,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -429,23 +565,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -457,4 +584,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_alerts_operations.py index 5e475c8ca70b..f628efdc4732 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_alerts_operations.py @@ -5,23 +5,97 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AlertsOperations(object): """AlertsOperations operations. @@ -45,13 +119,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AlertList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.AlertList"]: """Gets all the alerts for a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -68,36 +142,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AlertList', pipeline_response) + deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,19 +186,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Alert" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Alert": """Gets an alert by name. Gets an alert by name. @@ -148,28 +220,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,4 +245,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_available_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_available_skus_operations.py index 739f14c52a86..4a173a23aeef 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_available_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_available_skus_operations.py @@ -5,23 +5,56 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/availableSkus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AvailableSkusOperations(object): """AvailableSkusOperations operations. @@ -45,18 +78,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DataBoxEdgeSkuList"] + **kwargs: Any + ) -> Iterable["_models.DataBoxEdgeSkuList"]: """List all the available Skus and information related to them. List all the available Skus and information related to them. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DataBoxEdgeSkuList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.DataBoxEdgeSkuList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.DataBoxEdgeSkuList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeSkuList"] @@ -64,34 +98,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeSkuList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeSkuList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -109,6 +138,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_bandwidth_schedules_operations.py index c08125370b0a..5e526aa3bd97 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_bandwidth_schedules_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class BandwidthSchedulesOperations(object): """BandwidthSchedulesOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BandwidthSchedulesList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.BandwidthSchedulesList"]: """Gets all the bandwidth schedules for a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -61,8 +219,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BandwidthSchedulesList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.BandwidthSchedulesList] + :return: An iterator like instance of either BandwidthSchedulesList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.BandwidthSchedulesList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedulesList"] @@ -70,36 +230,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BandwidthSchedulesList', pipeline_response) + deserialized = self._deserialize("BandwidthSchedulesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,19 +274,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BandwidthSchedule" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.BandwidthSchedule": """Gets the properties of the specified bandwidth schedule. :param device_name: The device name. @@ -148,28 +306,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,49 +331,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.BandwidthSchedule" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.BandwidthSchedule"] + device_name: str, + name: str, + resource_group_name: str, + parameters: "_models.BandwidthSchedule", + **kwargs: Any + ) -> Optional["_models.BandwidthSchedule"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BandwidthSchedule"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BandwidthSchedule') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BandwidthSchedule') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -241,17 +380,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.BandwidthSchedule" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BandwidthSchedule"] + device_name: str, + name: str, + resource_group_name: str, + parameters: "_models.BandwidthSchedule", + **kwargs: Any + ) -> LROPoller["_models.BandwidthSchedule"]: """Creates or updates a bandwidth schedule. :param device_name: The device name. @@ -264,15 +405,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.databoxedge.v2020_09_01.models.BandwidthSchedule :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either BandwidthSchedule or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.BandwidthSchedule] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BandwidthSchedule or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.BandwidthSchedule] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedule"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +431,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BandwidthSchedule', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -318,43 +457,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -367,14 +496,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the specified bandwidth schedule. :param device_name: The device name. @@ -385,15 +515,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -408,22 +540,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -435,4 +559,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_containers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_containers_operations.py index 18514cba48b2..bb4aefddd2f3 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_containers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_containers_operations.py @@ -5,25 +5,230 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_storage_account_request( + device_name: str, + storage_account_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + storage_account_name: str, + container_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + storage_account_name: str, + container_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + storage_account_name: str, + container_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_refresh_request_initial( + device_name: str, + storage_account_name: str, + container_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ContainersOperations(object): """ContainersOperations operations. @@ -47,14 +252,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_storage_account( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ContainerList"] + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ContainerList"]: """Lists all the containers of a storage Account in a Data Box Edge/Data Box Gateway device. Lists all the containers of a storage Account in a Data Box Edge/Data Box Gateway device. @@ -75,37 +280,35 @@ def list_by_storage_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_storage_account.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_account_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_storage_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_account_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ContainerList', pipeline_response) + deserialized = self._deserialize("ContainerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -123,20 +326,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_storage_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Container" + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Container": """Gets a container by name. Gets a container by name. @@ -159,29 +363,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -195,51 +389,42 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - container, # type: "_models.Container" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Container"] + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + container: "_models.Container", + **kwargs: Any + ) -> Optional["_models.Container"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Container"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(container, 'Container') + + request = build_create_or_update_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(container, 'Container') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -255,18 +440,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - container, # type: "_models.Container" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Container"] + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + container: "_models.Container", + **kwargs: Any + ) -> LROPoller["_models.Container"]: """Creates a new container or updates an existing container on the device. Creates a new container or updates an existing container on the device. @@ -283,15 +470,18 @@ def begin_create_or_update( :type container: ~azure.mgmt.databoxedge.v2020_09_01.models.Container :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Container or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.Container] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Container"] lro_delay = kwargs.pop( 'polling_interval', @@ -305,29 +495,21 @@ def begin_create_or_update( container_name=container_name, resource_group_name=resource_group_name, container=container, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Container', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -339,45 +521,35 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore def _delete_initial( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -390,15 +562,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the container on the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -411,15 +584,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -435,23 +610,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -463,45 +629,35 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore def _refresh_initial( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -514,15 +670,16 @@ def _refresh_initial( _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh'} # type: ignore + + @distributed_trace def begin_refresh( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Refreshes the container metadata with the data from the cloud. Refreshes the container metadata with the data from the cloud. @@ -537,15 +694,17 @@ def begin_refresh( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -561,23 +720,14 @@ def begin_refresh( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -589,4 +739,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_devices_operations.py index 376eeb43c44f..79f5f38dd866 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_devices_operations.py @@ -5,25 +5,635 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_subscription_request( + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_download_updates_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_generate_certificate_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/generateCertificate') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_extended_information_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_install_updates_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_network_settings_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/networkSettings/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_scan_for_updates_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_security_settings_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_extended_information_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateExtendedInformation') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_update_summary_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_upload_certificate_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/uploadCertificate') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class DevicesOperations(object): """DevicesOperations operations. @@ -47,20 +657,22 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DataBoxEdgeDeviceList"] + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.DataBoxEdgeDeviceList"]: """Gets all the Data Box Edge/Data Box Gateway devices in a subscription. :param expand: Specify $expand=details to populate additional fields related to the resource or Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -68,36 +680,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,18 +722,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DataBoxEdgeDeviceList"] + resource_group_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.DataBoxEdgeDeviceList"]: """Gets all the Data Box Edge/Data Box Gateway devices in a resource group. :param resource_group_name: The resource group name. @@ -135,8 +743,10 @@ def list_by_resource_group( Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -144,37 +754,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -192,18 +798,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDevice" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DataBoxEdgeDevice": """Gets the properties of the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -220,27 +827,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -254,47 +851,38 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - resource_group_name, # type: str - data_box_edge_device, # type: "_models.DataBoxEdgeDevice" - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDevice" + device_name: str, + resource_group_name: str, + data_box_edge_device: "_models.DataBoxEdgeDevice", + **kwargs: Any + ) -> "_models.DataBoxEdgeDevice": cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') + + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -308,16 +896,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - resource_group_name, # type: str - data_box_edge_device, # type: "_models.DataBoxEdgeDevice" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DataBoxEdgeDevice"] + device_name: str, + resource_group_name: str, + data_box_edge_device: "_models.DataBoxEdgeDevice", + **kwargs: Any + ) -> LROPoller["_models.DataBoxEdgeDevice"]: """Creates or updates a Data Box Edge/Data Box Gateway resource. :param device_name: The device name. @@ -328,15 +918,20 @@ def begin_create_or_update( :type data_box_edge_device: ~azure.mgmt.databoxedge.v2020_09_01.models.DataBoxEdgeDevice :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DataBoxEdgeDevice or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.DataBoxEdgeDevice] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DataBoxEdgeDevice or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.DataBoxEdgeDevice] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] lro_delay = kwargs.pop( 'polling_interval', @@ -348,27 +943,21 @@ def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, data_box_edge_device=data_box_edge_device, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DataBoxEdgeDevice', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -380,41 +969,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore def _delete_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -427,13 +1006,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -442,15 +1022,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -464,21 +1046,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -490,16 +1065,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + @distributed_trace def update( self, - device_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.DataBoxEdgeDevicePatch" - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDevice" + device_name: str, + resource_group_name: str, + parameters: "_models.DataBoxEdgeDevicePatch", + **kwargs: Any + ) -> "_models.DataBoxEdgeDevice": """Modifies a Data Box Edge/Data Box Gateway resource. :param device_name: The device name. @@ -518,32 +1094,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -557,41 +1123,32 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + def _download_updates_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._download_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_download_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._download_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -604,13 +1161,14 @@ def _download_updates_initial( _download_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + + @distributed_trace def begin_download_updates( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Downloads the updates on a Data Box Edge/Data Box Gateway device. Downloads the updates on a Data Box Edge/Data Box Gateway device. @@ -621,15 +1179,17 @@ def begin_download_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -643,21 +1203,14 @@ def begin_download_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -669,15 +1222,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_download_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + @distributed_trace def generate_certificate( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.GenerateCertResponse" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.GenerateCertResponse": """Generates certificate for activation key. :param device_name: The device name. @@ -694,27 +1248,17 @@ def generate_certificate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.generate_certificate.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_generate_certificate_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.generate_certificate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -728,15 +1272,17 @@ def generate_certificate( return cls(pipeline_response, deserialized, {}) return deserialized + generate_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/generateCertificate'} # type: ignore + + @distributed_trace def get_extended_information( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDeviceExtendedInfo" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DataBoxEdgeDeviceExtendedInfo": """Gets additional information for the specified Azure Stack Edge/Data Box Gateway device. :param device_name: The device name. @@ -753,27 +1299,17 @@ def get_extended_information( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get_extended_information.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_extended_information_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_extended_information.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -787,41 +1323,32 @@ def get_extended_information( return cls(pipeline_response, deserialized, {}) return deserialized + get_extended_information.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation'} # type: ignore + def _install_updates_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._install_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_install_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._install_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -834,13 +1361,14 @@ def _install_updates_initial( _install_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + + @distributed_trace def begin_install_updates( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Installs the updates on the Data Box Edge/Data Box Gateway device. Installs the updates on the Data Box Edge/Data Box Gateway device. @@ -851,15 +1379,17 @@ def begin_install_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -873,21 +1403,14 @@ def begin_install_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -899,15 +1422,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_install_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + @distributed_trace def get_network_settings( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.NetworkSettings" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.NetworkSettings": """Gets the network settings of the specified Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -924,27 +1448,17 @@ def get_network_settings( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get_network_settings.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_network_settings_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_network_settings.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -958,41 +1472,32 @@ def get_network_settings( return cls(pipeline_response, deserialized, {}) return deserialized + get_network_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/networkSettings/default'} # type: ignore + def _scan_for_updates_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._scan_for_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_scan_for_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._scan_for_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1005,13 +1510,14 @@ def _scan_for_updates_initial( _scan_for_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore + + @distributed_trace def begin_scan_for_updates( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Scans for updates on a Data Box Edge/Data Box Gateway device. Scans for updates on a Data Box Edge/Data Box Gateway device. @@ -1022,15 +1528,17 @@ def begin_scan_for_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1044,21 +1552,14 @@ def begin_scan_for_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1070,47 +1571,37 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_scan_for_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore def _create_or_update_security_settings_initial( self, - device_name, # type: str - resource_group_name, # type: str - security_settings, # type: "_models.SecuritySettings" - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + security_settings: "_models.SecuritySettings", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_security_settings_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(security_settings, 'SecuritySettings') + + request = build_create_or_update_security_settings_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_security_settings_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(security_settings, 'SecuritySettings') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1123,14 +1614,15 @@ def _create_or_update_security_settings_initial( _create_or_update_security_settings_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + + @distributed_trace def begin_create_or_update_security_settings( self, - device_name, # type: str - resource_group_name, # type: str - security_settings, # type: "_models.SecuritySettings" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + security_settings: "_models.SecuritySettings", + **kwargs: Any + ) -> LROPoller[None]: """Updates the security settings on a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -1141,15 +1633,18 @@ def begin_create_or_update_security_settings( :type security_settings: ~azure.mgmt.databoxedge.v2020_09_01.models.SecuritySettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1161,24 +1656,18 @@ def begin_create_or_update_security_settings( device_name=device_name, resource_group_name=resource_group_name, security_settings=security_settings, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1190,16 +1679,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_security_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + @distributed_trace def update_extended_information( self, - device_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.DataBoxEdgeDeviceExtendedInfoPatch" - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDeviceExtendedInfo" + device_name: str, + resource_group_name: str, + parameters: "_models.DataBoxEdgeDeviceExtendedInfoPatch", + **kwargs: Any + ) -> "_models.DataBoxEdgeDeviceExtendedInfo": """Gets additional information for the specified Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -1218,32 +1708,22 @@ def update_extended_information( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update_extended_information.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'DataBoxEdgeDeviceExtendedInfoPatch') + + request = build_update_extended_information_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.update_extended_information.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataBoxEdgeDeviceExtendedInfoPatch') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1257,16 +1737,19 @@ def update_extended_information( return cls(pipeline_response, deserialized, {}) return deserialized + update_extended_information.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateExtendedInformation'} # type: ignore + + @distributed_trace def get_update_summary( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.UpdateSummary" - """Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.UpdateSummary": + """Gets information about the availability of updates based on the last scan of the device. It + also gets information about any ongoing download or install jobs on the device. Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. @@ -1285,27 +1768,17 @@ def get_update_summary( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get_update_summary.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_update_summary_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_update_summary.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1319,16 +1792,18 @@ def get_update_summary( return cls(pipeline_response, deserialized, {}) return deserialized + get_update_summary.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default'} # type: ignore + + @distributed_trace def upload_certificate( self, - device_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.UploadCertificateRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.UploadCertificateResponse" + device_name: str, + resource_group_name: str, + parameters: "_models.UploadCertificateRequest", + **kwargs: Any + ) -> "_models.UploadCertificateResponse": """Uploads registration certificate for the device. :param device_name: The device name. @@ -1347,32 +1822,22 @@ def upload_certificate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.upload_certificate.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'UploadCertificateRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_upload_certificate_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.upload_certificate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'UploadCertificateRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1386,4 +1851,6 @@ def upload_certificate( return cls(pipeline_response, deserialized, {}) return deserialized + upload_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/uploadCertificate'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_jobs_operations.py index b9023fcd83e1..93c6f2720ecb 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_jobs_operations.py @@ -5,22 +5,61 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class JobsOperations(object): """JobsOperations operations. @@ -44,14 +83,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Job" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Job": """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. @@ -72,28 +111,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -107,4 +136,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_monitoring_config_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_monitoring_config_operations.py index 5036dd1df3ef..c1fcd2b89245 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_monitoring_config_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_monitoring_config_operations.py @@ -5,25 +5,185 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + device_name: str, + role_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + role_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + role_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + role_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class MonitoringConfigOperations(object): """MonitoringConfigOperations operations. @@ -47,14 +207,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - device_name, # type: str - role_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.MonitoringMetricConfigurationList"] + device_name: str, + role_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.MonitoringMetricConfigurationList"]: """Lists metric configurations in a role. Lists metric configurations in a role. @@ -66,8 +226,10 @@ def list( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MonitoringMetricConfigurationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.MonitoringMetricConfigurationList] + :return: An iterator like instance of either MonitoringMetricConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.MonitoringMetricConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringMetricConfigurationList"] @@ -75,37 +237,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('MonitoringMetricConfigurationList', pipeline_response) + deserialized = self._deserialize("MonitoringMetricConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -123,19 +283,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - role_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.MonitoringMetricConfiguration" + device_name: str, + role_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.MonitoringMetricConfiguration": """Gets a metric configuration of a role. Gets a metric configuration of a role. @@ -156,28 +317,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -191,49 +342,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - role_name, # type: str - resource_group_name, # type: str - monitoring_metric_configuration, # type: "_models.MonitoringMetricConfiguration" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.MonitoringMetricConfiguration"] + device_name: str, + role_name: str, + resource_group_name: str, + monitoring_metric_configuration: "_models.MonitoringMetricConfiguration", + **kwargs: Any + ) -> Optional["_models.MonitoringMetricConfiguration"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MonitoringMetricConfiguration"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(monitoring_metric_configuration, 'MonitoringMetricConfiguration') + + request = build_create_or_update_request_initial( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(monitoring_metric_configuration, 'MonitoringMetricConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -249,17 +391,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - role_name, # type: str - resource_group_name, # type: str - monitoring_metric_configuration, # type: "_models.MonitoringMetricConfiguration" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.MonitoringMetricConfiguration"] + device_name: str, + role_name: str, + resource_group_name: str, + monitoring_metric_configuration: "_models.MonitoringMetricConfiguration", + **kwargs: Any + ) -> LROPoller["_models.MonitoringMetricConfiguration"]: """Creates a new metric configuration or updates an existing one for a role. Creates a new metric configuration or updates an existing one for a role. @@ -271,18 +415,24 @@ def begin_create_or_update( :param resource_group_name: The resource group name. :type resource_group_name: str :param monitoring_metric_configuration: The metric configuration. - :type monitoring_metric_configuration: ~azure.mgmt.databoxedge.v2020_09_01.models.MonitoringMetricConfiguration + :type monitoring_metric_configuration: + ~azure.mgmt.databoxedge.v2020_09_01.models.MonitoringMetricConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either MonitoringMetricConfiguration or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.MonitoringMetricConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringMetricConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.MonitoringMetricConfiguration] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringMetricConfiguration"] lro_delay = kwargs.pop( 'polling_interval', @@ -295,28 +445,21 @@ def begin_create_or_update( role_name=role_name, resource_group_name=resource_group_name, monitoring_metric_configuration=monitoring_metric_configuration, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MonitoringMetricConfiguration', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -328,43 +471,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore def _delete_initial( self, - device_name, # type: str - role_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + role_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -377,14 +510,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - role_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + role_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """deletes a new metric configuration for a role. deletes a new metric configuration for a role. @@ -397,15 +531,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -420,22 +556,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -447,4 +575,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_nodes_operations.py index 098069c8a553..0e9497095875 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_nodes_operations.py @@ -5,23 +5,60 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/nodes') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class NodesOperations(object): """NodesOperations operations. @@ -45,13 +82,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.NodeList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.NodeList"]: """Gets all the nodes currently configured under this Data Box Edge device. :param device_name: The device name. @@ -68,36 +105,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('NodeList', pipeline_response) + deserialized = self._deserialize("NodeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,6 +149,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_operations.py index f1df400f6fca..c31e9546b1f6 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.DataBoxEdge/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,11 +72,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationsList"] + **kwargs: Any + ) -> Iterable["_models.OperationsList"]: """List all the supported operations. List all the supported operations. @@ -64,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationsList', pipeline_response) + deserialized = self._deserialize("OperationsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -105,6 +129,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_operations_status_operations.py index a99b8e94cea7..aaf56e877fc6 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_operations_status_operations.py @@ -5,22 +5,61 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/operationsStatus/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class OperationsStatusOperations(object): """OperationsStatusOperations operations. @@ -44,14 +83,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Job" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Job": """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. @@ -72,28 +111,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -107,4 +136,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/operationsStatus/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_orders_operations.py index d580b845a6da..748bbca2936d 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_orders_operations.py @@ -5,25 +5,212 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_dc_access_code_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default/listDCAccessCode') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class OrdersOperations(object): """OrdersOperations operations. @@ -47,13 +234,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OrderList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.OrderList"]: """Lists all the orders related to a Data Box Edge/Data Box Gateway device. Lists all the orders related to a Data Box Edge/Data Box Gateway device. @@ -72,36 +259,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OrderList', pipeline_response) + deserialized = self._deserialize("OrderList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,18 +303,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Order" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Order": """Gets a specific order by name. Gets a specific order by name. @@ -149,27 +334,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,47 +358,38 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - resource_group_name, # type: str - order, # type: "_models.Order" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Order"] + device_name: str, + resource_group_name: str, + order: "_models.Order", + **kwargs: Any + ) -> Optional["_models.Order"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Order"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(order, 'Order') + + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(order, 'Order') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,16 +405,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - resource_group_name, # type: str - order, # type: "_models.Order" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Order"] + device_name: str, + resource_group_name: str, + order: "_models.Order", + **kwargs: Any + ) -> LROPoller["_models.Order"]: """Creates or updates an order. Creates or updates an order. @@ -261,15 +429,18 @@ def begin_create_or_update( :type order: ~azure.mgmt.databoxedge.v2020_09_01.models.Order :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Order or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.Order] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Order"] lro_delay = kwargs.pop( 'polling_interval', @@ -281,27 +452,21 @@ def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, order=order, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Order', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -313,41 +478,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore def _delete_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -360,13 +515,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the order related to the device. Deletes the order related to the device. @@ -377,15 +533,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -399,21 +557,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -425,15 +576,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + @distributed_trace def list_dc_access_code( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DCAccessCode" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DCAccessCode": """Gets the DCAccess Code. Gets the DCAccess Code. @@ -452,27 +604,17 @@ def list_dc_access_code( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.list_dc_access_code.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_dc_access_code_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_dc_access_code.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -486,4 +628,6 @@ def list_dc_access_code( return cls(pipeline_response, deserialized, {}) return deserialized + list_dc_access_code.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default/listDCAccessCode'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_roles_operations.py index d885cd2fbb11..f405301d6733 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_roles_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class RolesOperations(object): """RolesOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RoleList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.RoleList"]: """Lists all the roles configured in a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -70,36 +228,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RoleList', pipeline_response) + deserialized = self._deserialize("RoleList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,19 +272,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Role" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Role": """Gets a specific role by name. :param device_name: The device name. @@ -148,28 +304,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,49 +329,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - role, # type: "_models.Role" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Role"] + device_name: str, + name: str, + resource_group_name: str, + role: "_models.Role", + **kwargs: Any + ) -> Optional["_models.Role"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Role"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(role, 'Role') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(role, 'Role') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -241,17 +378,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - role, # type: "_models.Role" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Role"] + device_name: str, + name: str, + resource_group_name: str, + role: "_models.Role", + **kwargs: Any + ) -> LROPoller["_models.Role"]: """Create or update a role. :param device_name: The device name. @@ -264,15 +403,18 @@ def begin_create_or_update( :type role: ~azure.mgmt.databoxedge.v2020_09_01.models.Role :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Role or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.Role] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Role"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +427,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, role=role, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Role', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -318,43 +453,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -367,14 +492,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the role on the device. :param device_name: The device name. @@ -385,15 +511,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -408,22 +536,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -435,4 +555,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_shares_operations.py index 03b97b7f9625..4091149e8245 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_shares_operations.py @@ -5,25 +5,220 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_refresh_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SharesOperations(object): """SharesOperations operations. @@ -47,13 +242,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ShareList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ShareList"]: """Lists all the shares in a Data Box Edge/Data Box Gateway device. Lists all the shares in a Data Box Edge/Data Box Gateway device. @@ -72,36 +267,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ShareList', pipeline_response) + deserialized = self._deserialize("ShareList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +311,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Share" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Share": """Gets a share by name. Gets a share by name. @@ -152,28 +345,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -187,49 +370,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - share, # type: "_models.Share" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Share"] + device_name: str, + name: str, + resource_group_name: str, + share: "_models.Share", + **kwargs: Any + ) -> Optional["_models.Share"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Share"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(share, 'Share') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(share, 'Share') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,17 +419,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - share, # type: "_models.Share" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Share"] + device_name: str, + name: str, + resource_group_name: str, + share: "_models.Share", + **kwargs: Any + ) -> LROPoller["_models.Share"]: """Creates a new share or updates an existing share on the device. Creates a new share or updates an existing share on the device. @@ -270,15 +446,18 @@ def begin_create_or_update( :type share: ~azure.mgmt.databoxedge.v2020_09_01.models.Share :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Share or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.Share] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Share"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +470,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, share=share, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Share', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -324,43 +496,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,14 +535,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the share on the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -391,15 +554,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -414,22 +579,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -441,43 +598,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore def _refresh_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -490,14 +637,15 @@ def _refresh_initial( _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore + + @distributed_trace def begin_refresh( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Refreshes the share metadata with the data from the cloud. Refreshes the share metadata with the data from the cloud. @@ -510,15 +658,17 @@ def begin_refresh( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -533,22 +683,14 @@ def begin_refresh( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -560,4 +702,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_storage_account_credentials_operations.py index cd19b75ebc50..a9304d1bd5de 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_storage_account_credentials_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class StorageAccountCredentialsOperations(object): """StorageAccountCredentialsOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountCredentialList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountCredentialList"]: """Gets all the storage account credentials in a Data Box Edge/Data Box Gateway device. Gets all the storage account credentials in a Data Box Edge/Data Box Gateway device. @@ -63,8 +221,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountCredentialList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.StorageAccountCredentialList] + :return: An iterator like instance of either StorageAccountCredentialList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.StorageAccountCredentialList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredentialList"] @@ -72,36 +232,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('StorageAccountCredentialList', pipeline_response) + deserialized = self._deserialize("StorageAccountCredentialList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +276,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountCredential" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.StorageAccountCredential": """Gets the properties of the specified storage account credential. :param device_name: The device name. @@ -150,28 +308,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,49 +333,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - storage_account_credential, # type: "_models.StorageAccountCredential" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageAccountCredential"] + device_name: str, + name: str, + resource_group_name: str, + storage_account_credential: "_models.StorageAccountCredential", + **kwargs: Any + ) -> Optional["_models.StorageAccountCredential"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccountCredential"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(storage_account_credential, 'StorageAccountCredential') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_account_credential, 'StorageAccountCredential') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -243,17 +382,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - storage_account_credential, # type: "_models.StorageAccountCredential" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageAccountCredential"] + device_name: str, + name: str, + resource_group_name: str, + storage_account_credential: "_models.StorageAccountCredential", + **kwargs: Any + ) -> LROPoller["_models.StorageAccountCredential"]: """Creates or updates the storage account credential. :param device_name: The device name. @@ -263,18 +404,24 @@ def begin_create_or_update( :param resource_group_name: The resource group name. :type resource_group_name: str :param storage_account_credential: The storage account credential. - :type storage_account_credential: ~azure.mgmt.databoxedge.v2020_09_01.models.StorageAccountCredential + :type storage_account_credential: + ~azure.mgmt.databoxedge.v2020_09_01.models.StorageAccountCredential :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either StorageAccountCredential or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.StorageAccountCredential] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either StorageAccountCredential or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.StorageAccountCredential] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredential"] lro_delay = kwargs.pop( 'polling_interval', @@ -287,28 +434,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, storage_account_credential=storage_account_credential, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccountCredential', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -320,43 +460,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -369,14 +499,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the storage account credential. :param device_name: The device name. @@ -387,15 +518,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -410,22 +543,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -437,4 +562,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_storage_accounts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_storage_accounts_operations.py index 4d5ae80068de..717f4237c0c0 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_storage_accounts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_storage_accounts_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + storage_account_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + storage_account_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + storage_account_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountList"]: """Lists all the StorageAccounts in a Data Box Edge/Data Box Gateway device. Lists all the StorageAccounts in a Data Box Edge/Data Box Gateway device. @@ -64,7 +222,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either StorageAccountList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.StorageAccountList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01.models.StorageAccountList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountList"] @@ -72,36 +231,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('StorageAccountList', pipeline_response) + deserialized = self._deserialize("StorageAccountList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +275,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.StorageAccount": """Gets a StorageAccount by name. Gets a StorageAccount by name. @@ -152,28 +309,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -187,49 +334,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - storage_account, # type: "_models.StorageAccount" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageAccount"] + device_name: str, + storage_account_name: str, + resource_group_name: str, + storage_account: "_models.StorageAccount", + **kwargs: Any + ) -> Optional["_models.StorageAccount"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(storage_account, 'StorageAccount') + + request = build_create_or_update_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_account, 'StorageAccount') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,17 +383,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - storage_account, # type: "_models.StorageAccount" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageAccount"] + device_name: str, + storage_account_name: str, + resource_group_name: str, + storage_account: "_models.StorageAccount", + **kwargs: Any + ) -> LROPoller["_models.StorageAccount"]: """Creates a new StorageAccount or updates an existing StorageAccount on the device. Creates a new StorageAccount or updates an existing StorageAccount on the device. @@ -270,15 +410,20 @@ def begin_create_or_update( :type storage_account: ~azure.mgmt.databoxedge.v2020_09_01.models.StorageAccount :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either StorageAccount or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +436,21 @@ def begin_create_or_update( storage_account_name=storage_account_name, resource_group_name=resource_group_name, storage_account=storage_account, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -324,43 +462,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore def _delete_initial( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,14 +501,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the StorageAccount on the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -391,15 +520,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -414,22 +545,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -441,4 +564,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_triggers_operations.py index f6b42b941e51..68820581fccd 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_triggers_operations.py @@ -5,25 +5,187 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class TriggersOperations(object): """TriggersOperations operations. @@ -47,14 +209,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.TriggerList"] + device_name: str, + resource_group_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.TriggerList"]: """Lists all the triggers configured in the device. :param device_name: The device name. @@ -74,38 +236,35 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TriggerList', pipeline_response) + deserialized = self._deserialize("TriggerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -123,19 +282,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Trigger" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Trigger": """Get a specific trigger by name. :param device_name: The device name. @@ -154,28 +314,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -189,49 +339,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - trigger, # type: "_models.Trigger" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Trigger"] + device_name: str, + name: str, + resource_group_name: str, + trigger: "_models.Trigger", + **kwargs: Any + ) -> Optional["_models.Trigger"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Trigger"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(trigger, 'Trigger') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(trigger, 'Trigger') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,17 +388,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - trigger, # type: "_models.Trigger" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Trigger"] + device_name: str, + name: str, + resource_group_name: str, + trigger: "_models.Trigger", + **kwargs: Any + ) -> LROPoller["_models.Trigger"]: """Creates or updates a trigger. :param device_name: Creates or updates a trigger. @@ -270,15 +413,18 @@ def begin_create_or_update( :type trigger: ~azure.mgmt.databoxedge.v2020_09_01.models.Trigger :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Trigger or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.Trigger] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Trigger"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +437,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, trigger=trigger, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Trigger', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -324,43 +463,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,14 +502,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the trigger on the gateway device. :param device_name: The device name. @@ -391,15 +521,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -414,22 +546,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -441,4 +565,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_users_operations.py index aa8c34b50bf4..aedf17966522 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_users_operations.py @@ -5,25 +5,187 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class UsersOperations(object): """UsersOperations operations. @@ -47,14 +209,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UserList"] + device_name: str, + resource_group_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.UserList"]: """Gets all the users registered on a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -74,38 +236,35 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('UserList', pipeline_response) + deserialized = self._deserialize("UserList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -123,19 +282,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.User" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.User": """Gets the properties of the specified user. :param device_name: The device name. @@ -154,28 +314,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -189,49 +339,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - user, # type: "_models.User" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.User"] + device_name: str, + name: str, + resource_group_name: str, + user: "_models.User", + **kwargs: Any + ) -> Optional["_models.User"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.User"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(user, 'User') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(user, 'User') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,17 +388,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - user, # type: "_models.User" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.User"] + device_name: str, + name: str, + resource_group_name: str, + user: "_models.User", + **kwargs: Any + ) -> LROPoller["_models.User"]: """Creates a new user or updates an existing user's information on a Data Box Edge/Data Box Gateway device. @@ -271,15 +414,18 @@ def begin_create_or_update( :type user: ~azure.mgmt.databoxedge.v2020_09_01.models.User :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either User or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01.models.User] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.User"] lro_delay = kwargs.pop( 'polling_interval', @@ -292,28 +438,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, user=user, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('User', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -325,43 +464,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -374,14 +503,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the user on a databox edge/gateway device. :param device_name: The device name. @@ -392,15 +522,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -415,22 +547,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -442,4 +566,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/__init__.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/__init__.py index e63196b6b98f..577ebf317c02 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/__init__.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/__init__.py @@ -7,10 +7,12 @@ # -------------------------------------------------------------------------- from ._data_box_edge_management_client import DataBoxEdgeManagementClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['DataBoxEdgeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_configuration.py index 47c80b2e85dc..414026184139 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_configuration.py @@ -6,19 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential -VERSION = "unknown" class DataBoxEdgeManagementClientConfiguration(Configuration): """Configuration for DataBoxEdgeManagementClient. @@ -34,16 +33,15 @@ class DataBoxEdgeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -67,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_data_box_edge_management_client.py index 71d0d3a836f6..0c8ca2936001 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_data_box_edge_management_client.py @@ -6,59 +6,43 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import DataBoxEdgeManagementClientConfiguration +from .operations import AddonsOperations, AlertsOperations, AvailableSkusOperations, BandwidthSchedulesOperations, ContainersOperations, DevicesOperations, JobsOperations, MonitoringConfigOperations, NodesOperations, Operations, OperationsStatusOperations, OrdersOperations, RolesOperations, SharesOperations, StorageAccountCredentialsOperations, StorageAccountsOperations, TriggersOperations, UsersOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import DataBoxEdgeManagementClientConfiguration -from .operations import Operations -from .operations import AvailableSkusOperations -from .operations import DevicesOperations -from .operations import AlertsOperations -from .operations import BandwidthSchedulesOperations -from .operations import JobsOperations -from .operations import NodesOperations -from .operations import OperationsStatusOperations -from .operations import OrdersOperations -from .operations import RolesOperations -from .operations import AddonsOperations -from .operations import MonitoringConfigOperations -from .operations import SharesOperations -from .operations import StorageAccountCredentialsOperations -from .operations import StorageAccountsOperations -from .operations import ContainersOperations -from .operations import TriggersOperations -from .operations import UsersOperations -from . import models - -class DataBoxEdgeManagementClient(object): +class DataBoxEdgeManagementClient: """The DataBoxEdge Client. :ivar operations: Operations operations :vartype operations: azure.mgmt.databoxedge.v2020_09_01_preview.operations.Operations :ivar available_skus: AvailableSkusOperations operations - :vartype available_skus: azure.mgmt.databoxedge.v2020_09_01_preview.operations.AvailableSkusOperations + :vartype available_skus: + azure.mgmt.databoxedge.v2020_09_01_preview.operations.AvailableSkusOperations :ivar devices: DevicesOperations operations :vartype devices: azure.mgmt.databoxedge.v2020_09_01_preview.operations.DevicesOperations :ivar alerts: AlertsOperations operations :vartype alerts: azure.mgmt.databoxedge.v2020_09_01_preview.operations.AlertsOperations :ivar bandwidth_schedules: BandwidthSchedulesOperations operations - :vartype bandwidth_schedules: azure.mgmt.databoxedge.v2020_09_01_preview.operations.BandwidthSchedulesOperations + :vartype bandwidth_schedules: + azure.mgmt.databoxedge.v2020_09_01_preview.operations.BandwidthSchedulesOperations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.databoxedge.v2020_09_01_preview.operations.JobsOperations :ivar nodes: NodesOperations operations :vartype nodes: azure.mgmt.databoxedge.v2020_09_01_preview.operations.NodesOperations :ivar operations_status: OperationsStatusOperations operations - :vartype operations_status: azure.mgmt.databoxedge.v2020_09_01_preview.operations.OperationsStatusOperations + :vartype operations_status: + azure.mgmt.databoxedge.v2020_09_01_preview.operations.OperationsStatusOperations :ivar orders: OrdersOperations operations :vartype orders: azure.mgmt.databoxedge.v2020_09_01_preview.operations.OrdersOperations :ivar roles: RolesOperations operations @@ -66,13 +50,16 @@ class DataBoxEdgeManagementClient(object): :ivar addons: AddonsOperations operations :vartype addons: azure.mgmt.databoxedge.v2020_09_01_preview.operations.AddonsOperations :ivar monitoring_config: MonitoringConfigOperations operations - :vartype monitoring_config: azure.mgmt.databoxedge.v2020_09_01_preview.operations.MonitoringConfigOperations + :vartype monitoring_config: + azure.mgmt.databoxedge.v2020_09_01_preview.operations.MonitoringConfigOperations :ivar shares: SharesOperations operations :vartype shares: azure.mgmt.databoxedge.v2020_09_01_preview.operations.SharesOperations :ivar storage_account_credentials: StorageAccountCredentialsOperations operations - :vartype storage_account_credentials: azure.mgmt.databoxedge.v2020_09_01_preview.operations.StorageAccountCredentialsOperations + :vartype storage_account_credentials: + azure.mgmt.databoxedge.v2020_09_01_preview.operations.StorageAccountCredentialsOperations :ivar storage_accounts: StorageAccountsOperations operations - :vartype storage_accounts: azure.mgmt.databoxedge.v2020_09_01_preview.operations.StorageAccountsOperations + :vartype storage_accounts: + azure.mgmt.databoxedge.v2020_09_01_preview.operations.StorageAccountsOperations :ivar containers: ContainersOperations operations :vartype containers: azure.mgmt.databoxedge.v2020_09_01_preview.operations.ContainersOperations :ivar triggers: TriggersOperations operations @@ -83,82 +70,71 @@ class DataBoxEdgeManagementClient(object): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = DataBoxEdgeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = DataBoxEdgeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.available_skus = AvailableSkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.orders = OrdersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.addons = AddonsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.monitoring_config = MonitoringConfigOperations( - self._client, self._config, self._serialize, self._deserialize) - self.shares = SharesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.containers = ContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.available_skus = AvailableSkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bandwidth_schedules = BandwidthSchedulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations_status = OperationsStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) + self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize) + self.monitoring_config = MonitoringConfigOperations(self._client, self._config, self._serialize, self._deserialize) + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_account_credentials = StorageAccountCredentialsOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_metadata.json b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_metadata.json index 8f4872654ff2..7ffca4be9688 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_metadata.json +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_metadata.json @@ -5,13 +5,13 @@ "name": "DataBoxEdgeManagementClient", "filename": "_data_box_edge_management_client", "description": "The DataBoxEdge Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "operations": "Operations", diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_patch.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_vendor.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_version.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/__init__.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/__init__.py index c33d46ee91d8..f33cac1fd9b0 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/__init__.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._data_box_edge_management_client import DataBoxEdgeManagementClient __all__ = ['DataBoxEdgeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/_configuration.py index b545e589e3d1..3d4072e52544 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/_configuration.py @@ -10,13 +10,14 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class DataBoxEdgeManagementClientConfiguration(Configuration): """Configuration for DataBoxEdgeManagementClient. @@ -36,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -63,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/_data_box_edge_management_client.py index 7b23ab727068..aea0fa00e09c 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/_data_box_edge_management_client.py @@ -6,57 +6,43 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import DataBoxEdgeManagementClientConfiguration +from .operations import AddonsOperations, AlertsOperations, AvailableSkusOperations, BandwidthSchedulesOperations, ContainersOperations, DevicesOperations, JobsOperations, MonitoringConfigOperations, NodesOperations, Operations, OperationsStatusOperations, OrdersOperations, RolesOperations, SharesOperations, StorageAccountCredentialsOperations, StorageAccountsOperations, TriggersOperations, UsersOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import DataBoxEdgeManagementClientConfiguration -from .operations import Operations -from .operations import AvailableSkusOperations -from .operations import DevicesOperations -from .operations import AlertsOperations -from .operations import BandwidthSchedulesOperations -from .operations import JobsOperations -from .operations import NodesOperations -from .operations import OperationsStatusOperations -from .operations import OrdersOperations -from .operations import RolesOperations -from .operations import AddonsOperations -from .operations import MonitoringConfigOperations -from .operations import SharesOperations -from .operations import StorageAccountCredentialsOperations -from .operations import StorageAccountsOperations -from .operations import ContainersOperations -from .operations import TriggersOperations -from .operations import UsersOperations -from .. import models - - -class DataBoxEdgeManagementClient(object): +class DataBoxEdgeManagementClient: """The DataBoxEdge Client. :ivar operations: Operations operations :vartype operations: azure.mgmt.databoxedge.v2020_09_01_preview.aio.operations.Operations :ivar available_skus: AvailableSkusOperations operations - :vartype available_skus: azure.mgmt.databoxedge.v2020_09_01_preview.aio.operations.AvailableSkusOperations + :vartype available_skus: + azure.mgmt.databoxedge.v2020_09_01_preview.aio.operations.AvailableSkusOperations :ivar devices: DevicesOperations operations :vartype devices: azure.mgmt.databoxedge.v2020_09_01_preview.aio.operations.DevicesOperations :ivar alerts: AlertsOperations operations :vartype alerts: azure.mgmt.databoxedge.v2020_09_01_preview.aio.operations.AlertsOperations :ivar bandwidth_schedules: BandwidthSchedulesOperations operations - :vartype bandwidth_schedules: azure.mgmt.databoxedge.v2020_09_01_preview.aio.operations.BandwidthSchedulesOperations + :vartype bandwidth_schedules: + azure.mgmt.databoxedge.v2020_09_01_preview.aio.operations.BandwidthSchedulesOperations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.databoxedge.v2020_09_01_preview.aio.operations.JobsOperations :ivar nodes: NodesOperations operations :vartype nodes: azure.mgmt.databoxedge.v2020_09_01_preview.aio.operations.NodesOperations :ivar operations_status: OperationsStatusOperations operations - :vartype operations_status: azure.mgmt.databoxedge.v2020_09_01_preview.aio.operations.OperationsStatusOperations + :vartype operations_status: + azure.mgmt.databoxedge.v2020_09_01_preview.aio.operations.OperationsStatusOperations :ivar orders: OrdersOperations operations :vartype orders: azure.mgmt.databoxedge.v2020_09_01_preview.aio.operations.OrdersOperations :ivar roles: RolesOperations operations @@ -64,15 +50,19 @@ class DataBoxEdgeManagementClient(object): :ivar addons: AddonsOperations operations :vartype addons: azure.mgmt.databoxedge.v2020_09_01_preview.aio.operations.AddonsOperations :ivar monitoring_config: MonitoringConfigOperations operations - :vartype monitoring_config: azure.mgmt.databoxedge.v2020_09_01_preview.aio.operations.MonitoringConfigOperations + :vartype monitoring_config: + azure.mgmt.databoxedge.v2020_09_01_preview.aio.operations.MonitoringConfigOperations :ivar shares: SharesOperations operations :vartype shares: azure.mgmt.databoxedge.v2020_09_01_preview.aio.operations.SharesOperations :ivar storage_account_credentials: StorageAccountCredentialsOperations operations - :vartype storage_account_credentials: azure.mgmt.databoxedge.v2020_09_01_preview.aio.operations.StorageAccountCredentialsOperations + :vartype storage_account_credentials: + azure.mgmt.databoxedge.v2020_09_01_preview.aio.operations.StorageAccountCredentialsOperations :ivar storage_accounts: StorageAccountsOperations operations - :vartype storage_accounts: azure.mgmt.databoxedge.v2020_09_01_preview.aio.operations.StorageAccountsOperations + :vartype storage_accounts: + azure.mgmt.databoxedge.v2020_09_01_preview.aio.operations.StorageAccountsOperations :ivar containers: ContainersOperations operations - :vartype containers: azure.mgmt.databoxedge.v2020_09_01_preview.aio.operations.ContainersOperations + :vartype containers: + azure.mgmt.databoxedge.v2020_09_01_preview.aio.operations.ContainersOperations :ivar triggers: TriggersOperations operations :vartype triggers: azure.mgmt.databoxedge.v2020_09_01_preview.aio.operations.TriggersOperations :ivar users: UsersOperations operations @@ -81,80 +71,71 @@ class DataBoxEdgeManagementClient(object): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = DataBoxEdgeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = DataBoxEdgeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.available_skus = AvailableSkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bandwidth_schedules = BandwidthSchedulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations_status = OperationsStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) + self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize) + self.monitoring_config = MonitoringConfigOperations(self._client, self._config, self._serialize, self._deserialize) + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_account_credentials = StorageAccountCredentialsOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) + - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.available_skus = AvailableSkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.orders = OrdersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.addons = AddonsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.monitoring_config = MonitoringConfigOperations( - self._client, self._config, self._serialize, self._deserialize) - self.shares = SharesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.containers = ContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/_patch.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_addons_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_addons_operations.py index 86490d757f0c..1be43ac51073 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_addons_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_addons_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._addons_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_role_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_role( self, device_name: str, role_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.AddonList"]: """Lists all the addons configured in the role. @@ -60,7 +66,8 @@ def list_by_role( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AddonList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.AddonList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.AddonList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AddonList"] @@ -68,37 +75,35 @@ def list_by_role( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_role.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_role_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_role.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_role_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AddonList', pipeline_response) + deserialized = self._deserialize("AddonList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -116,18 +121,20 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_role.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, role_name: str, addon_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Addon": """Gets a specific addon by name. @@ -149,29 +156,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,8 +182,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, @@ -194,41 +193,31 @@ async def _create_or_update_initial( addon_name: str, resource_group_name: str, addon: "_models.Addon", - **kwargs + **kwargs: Any ) -> Optional["_models.Addon"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Addon"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(addon, 'Addon') + + request = build_create_or_update_request_initial( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(addon, 'Addon') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -244,8 +233,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, @@ -253,7 +245,7 @@ async def begin_create_or_update( addon_name: str, resource_group_name: str, addon: "_models.Addon", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Addon"]: """Create or update a addon. @@ -269,15 +261,19 @@ async def begin_create_or_update( :type addon: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.Addon :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Addon or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Addon] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Addon] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Addon"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,29 +287,21 @@ async def begin_create_or_update( addon_name=addon_name, resource_group_name=resource_group_name, addon=addon, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Addon', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -325,6 +313,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore async def _delete_initial( @@ -333,36 +322,26 @@ async def _delete_initial( role_name: str, addon_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -375,13 +354,15 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, role_name: str, addon_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the addon on the device. @@ -395,15 +376,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -419,23 +402,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -447,4 +421,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_alerts_operations.py index 1df491e86495..9c3729cff3a1 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_alerts_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._alerts_operations import build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,11 +46,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.AlertList"]: """Gets all the alerts for a Data Box Edge/Data Box Gateway device. @@ -55,7 +61,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AlertList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.AlertList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.AlertList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertList"] @@ -63,36 +70,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AlertList', pipeline_response) + deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,17 +114,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Alert": """Gets an alert by name. @@ -142,28 +148,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,4 +173,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_available_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_available_skus_operations.py index 4e0b2b5bcddf..fc01c7fce569 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_available_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_available_skus_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._available_skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,9 +46,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.DataBoxEdgeSkuList"]: """List all the available Skus and information related to them. @@ -51,7 +57,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DataBoxEdgeSkuList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeSkuList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeSkuList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeSkuList"] @@ -59,34 +66,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeSkuList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeSkuList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -104,6 +106,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_bandwidth_schedules_operations.py index 8885812017bd..5b71165466b0 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_bandwidth_schedules_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._bandwidth_schedules_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.BandwidthSchedulesList"]: """Gets all the bandwidth schedules for a Data Box Edge/Data Box Gateway device. @@ -56,8 +62,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BandwidthSchedulesList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.BandwidthSchedulesList] + :return: An iterator like instance of either BandwidthSchedulesList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.BandwidthSchedulesList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedulesList"] @@ -65,36 +73,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BandwidthSchedulesList', pipeline_response) + deserialized = self._deserialize("BandwidthSchedulesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,17 +117,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.BandwidthSchedule": """Gets the properties of the specified bandwidth schedule. @@ -142,28 +149,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,48 +174,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, parameters: "_models.BandwidthSchedule", - **kwargs + **kwargs: Any ) -> Optional["_models.BandwidthSchedule"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BandwidthSchedule"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BandwidthSchedule') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BandwidthSchedule') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -234,15 +223,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, parameters: "_models.BandwidthSchedule", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.BandwidthSchedule"]: """Creates or updates a bandwidth schedule. @@ -256,15 +248,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.BandwidthSchedule :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BandwidthSchedule or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.BandwidthSchedule] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BandwidthSchedule or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.BandwidthSchedule] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedule"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,28 +274,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BandwidthSchedule', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -310,6 +300,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore async def _delete_initial( @@ -317,35 +308,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -358,12 +339,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the specified bandwidth schedule. @@ -375,15 +358,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -398,22 +383,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -425,4 +402,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_containers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_containers_operations.py index 0d8b3454251d..ed506e447213 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_containers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_containers_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._containers_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_storage_account_request, build_refresh_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_storage_account( self, device_name: str, storage_account_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ContainerList"]: """Lists all the containers of a storage Account in a Data Box Edge/Data Box Gateway device. @@ -62,7 +68,8 @@ def list_by_storage_account( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ContainerList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.ContainerList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.ContainerList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerList"] @@ -70,37 +77,35 @@ def list_by_storage_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_storage_account.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_account_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_storage_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_account_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ContainerList', pipeline_response) + deserialized = self._deserialize("ContainerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,18 +123,20 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_storage_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, storage_account_name: str, container_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Container": """Gets a container by name. @@ -153,29 +160,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -189,8 +186,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, @@ -198,41 +197,31 @@ async def _create_or_update_initial( container_name: str, resource_group_name: str, container: "_models.Container", - **kwargs + **kwargs: Any ) -> Optional["_models.Container"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Container"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(container, 'Container') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(container, 'Container') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -248,8 +237,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, @@ -257,7 +249,7 @@ async def begin_create_or_update( container_name: str, resource_group_name: str, container: "_models.Container", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Container"]: """Creates a new container or updates an existing container on the device. @@ -275,15 +267,20 @@ async def begin_create_or_update( :type container: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.Container :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Container or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Container] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Container or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Container] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Container"] lro_delay = kwargs.pop( 'polling_interval', @@ -297,29 +294,21 @@ async def begin_create_or_update( container_name=container_name, resource_group_name=resource_group_name, container=container, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Container', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -331,6 +320,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore async def _delete_initial( @@ -339,36 +329,26 @@ async def _delete_initial( storage_account_name: str, container_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -381,13 +361,15 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, storage_account_name: str, container_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the container on the Data Box Edge/Data Box Gateway device. @@ -401,15 +383,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -425,23 +409,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -453,6 +428,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore async def _refresh_initial( @@ -461,36 +437,26 @@ async def _refresh_initial( storage_account_name: str, container_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -503,13 +469,15 @@ async def _refresh_initial( _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh'} # type: ignore + + @distributed_trace_async async def begin_refresh( self, device_name: str, storage_account_name: str, container_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Refreshes the container metadata with the data from the cloud. @@ -525,15 +493,17 @@ async def begin_refresh( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -549,23 +519,14 @@ async def begin_refresh( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -577,4 +538,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_devices_operations.py index 52cdbc54ff00..f28d331fb8c6 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_devices_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._devices_operations import build_create_or_update_request_initial, build_create_or_update_security_settings_request_initial, build_delete_request_initial, build_download_updates_request_initial, build_generate_certificate_request, build_get_extended_information_request, build_get_network_settings_request, build_get_request, build_get_update_summary_request, build_install_updates_request_initial, build_list_by_resource_group_request, build_list_by_subscription_request, build_scan_for_updates_request_initial, build_update_extended_information_request, build_update_request, build_upload_certificate_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,10 +48,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, expand: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.DataBoxEdgeDeviceList"]: """Gets all the Data Box Edge/Data Box Gateway devices in a subscription. @@ -54,8 +60,10 @@ def list_by_subscription( Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -63,36 +71,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,16 +113,18 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, expand: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.DataBoxEdgeDeviceList"]: """Gets all the Data Box Edge/Data Box Gateway devices in a resource group. @@ -129,8 +134,10 @@ def list_by_resource_group( Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -138,37 +145,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -186,16 +189,18 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDevice": """Gets the properties of the Data Box Edge/Data Box Gateway device. @@ -213,27 +218,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,46 +242,38 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, resource_group_name: str, data_box_edge_device: "_models.DataBoxEdgeDevice", - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDevice": cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') + + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -300,14 +287,17 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, resource_group_name: str, data_box_edge_device: "_models.DataBoxEdgeDevice", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.DataBoxEdgeDevice"]: """Creates or updates a Data Box Edge/Data Box Gateway resource. @@ -316,18 +306,24 @@ async def begin_create_or_update( :param resource_group_name: The resource group name. :type resource_group_name: str :param data_box_edge_device: The resource object. - :type data_box_edge_device: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeDevice + :type data_box_edge_device: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeDevice :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DataBoxEdgeDevice or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeDevice] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DataBoxEdgeDevice or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeDevice] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] lro_delay = kwargs.pop( 'polling_interval', @@ -339,27 +335,21 @@ async def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, data_box_edge_device=data_box_edge_device, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DataBoxEdgeDevice', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -371,40 +361,31 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore async def _delete_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -417,11 +398,13 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the Data Box Edge/Data Box Gateway device. @@ -431,15 +414,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -453,21 +438,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -479,14 +457,16 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + @distributed_trace_async async def update( self, device_name: str, resource_group_name: str, parameters: "_models.DataBoxEdgeDevicePatch", - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDevice": """Modifies a Data Box Edge/Data Box Gateway resource. @@ -506,32 +486,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -545,40 +515,32 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + async def _download_updates_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._download_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_download_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._download_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -591,11 +553,13 @@ async def _download_updates_initial( _download_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + + @distributed_trace_async async def begin_download_updates( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Downloads the updates on a Data Box Edge/Data Box Gateway device. @@ -607,15 +571,17 @@ async def begin_download_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -629,21 +595,14 @@ async def begin_download_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -655,13 +614,15 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_download_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + @distributed_trace_async async def generate_certificate( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.GenerateCertResponse": """Generates certificate for activation key. @@ -679,27 +640,17 @@ async def generate_certificate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.generate_certificate.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_generate_certificate_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.generate_certificate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -713,13 +664,16 @@ async def generate_certificate( return cls(pipeline_response, deserialized, {}) return deserialized + generate_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/generateCertificate'} # type: ignore + + @distributed_trace_async async def get_extended_information( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDeviceExtendedInfo": """Gets additional information for the specified Azure Stack Edge/Data Box Gateway device. @@ -737,27 +691,17 @@ async def get_extended_information( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_extended_information.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_extended_information_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_extended_information.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -771,40 +715,32 @@ async def get_extended_information( return cls(pipeline_response, deserialized, {}) return deserialized + get_extended_information.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation'} # type: ignore + async def _install_updates_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._install_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_install_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._install_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -817,11 +753,13 @@ async def _install_updates_initial( _install_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + + @distributed_trace_async async def begin_install_updates( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Installs the updates on the Data Box Edge/Data Box Gateway device. @@ -833,15 +771,17 @@ async def begin_install_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -855,21 +795,14 @@ async def begin_install_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -881,13 +814,15 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_install_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + @distributed_trace_async async def get_network_settings( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.NetworkSettings": """Gets the network settings of the specified Data Box Edge/Data Box Gateway device. @@ -905,27 +840,17 @@ async def get_network_settings( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_network_settings.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_network_settings_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_network_settings.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -939,40 +864,32 @@ async def get_network_settings( return cls(pipeline_response, deserialized, {}) return deserialized + get_network_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/networkSettings/default'} # type: ignore + async def _scan_for_updates_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._scan_for_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_scan_for_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._scan_for_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -985,11 +902,13 @@ async def _scan_for_updates_initial( _scan_for_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore + + @distributed_trace_async async def begin_scan_for_updates( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Scans for updates on a Data Box Edge/Data Box Gateway device. @@ -1001,15 +920,17 @@ async def begin_scan_for_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1023,21 +944,14 @@ async def begin_scan_for_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1049,6 +963,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_scan_for_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore async def _create_or_update_security_settings_initial( @@ -1056,39 +971,29 @@ async def _create_or_update_security_settings_initial( device_name: str, resource_group_name: str, security_settings: "_models.SecuritySettings", - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_security_settings_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(security_settings, 'SecuritySettings') + + request = build_create_or_update_security_settings_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_security_settings_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(security_settings, 'SecuritySettings') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1101,12 +1006,14 @@ async def _create_or_update_security_settings_initial( _create_or_update_security_settings_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + + @distributed_trace_async async def begin_create_or_update_security_settings( self, device_name: str, resource_group_name: str, security_settings: "_models.SecuritySettings", - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Updates the security settings on a Data Box Edge/Data Box Gateway device. @@ -1118,15 +1025,18 @@ async def begin_create_or_update_security_settings( :type security_settings: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SecuritySettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1138,24 +1048,18 @@ async def begin_create_or_update_security_settings( device_name=device_name, resource_group_name=resource_group_name, security_settings=security_settings, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1167,14 +1071,16 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_security_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + @distributed_trace_async async def update_extended_information( self, device_name: str, resource_group_name: str, parameters: "_models.DataBoxEdgeDeviceExtendedInfoPatch", - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDeviceExtendedInfo": """Gets additional information for the specified Data Box Edge/Data Box Gateway device. @@ -1183,7 +1089,8 @@ async def update_extended_information( :param resource_group_name: The resource group name. :type resource_group_name: str :param parameters: The patch object. - :type parameters: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeDeviceExtendedInfoPatch + :type parameters: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeDeviceExtendedInfoPatch :keyword callable cls: A custom type or function that will be passed the direct response :return: DataBoxEdgeDeviceExtendedInfo, or the result of cls(response) :rtype: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeDeviceExtendedInfo @@ -1194,32 +1101,22 @@ async def update_extended_information( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update_extended_information.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'DataBoxEdgeDeviceExtendedInfoPatch') + + request = build_update_extended_information_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.update_extended_information.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataBoxEdgeDeviceExtendedInfoPatch') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1233,15 +1130,19 @@ async def update_extended_information( return cls(pipeline_response, deserialized, {}) return deserialized + update_extended_information.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateExtendedInformation'} # type: ignore + + @distributed_trace_async async def get_update_summary( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.UpdateSummary": - """Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. + """Gets information about the availability of updates based on the last scan of the device. It + also gets information about any ongoing download or install jobs on the device. Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. @@ -1260,27 +1161,17 @@ async def get_update_summary( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_update_summary.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_update_summary_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_update_summary.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1294,14 +1185,17 @@ async def get_update_summary( return cls(pipeline_response, deserialized, {}) return deserialized + get_update_summary.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default'} # type: ignore + + @distributed_trace_async async def upload_certificate( self, device_name: str, resource_group_name: str, parameters: "_models.UploadCertificateRequest", - **kwargs + **kwargs: Any ) -> "_models.UploadCertificateResponse": """Uploads registration certificate for the device. @@ -1321,32 +1215,22 @@ async def upload_certificate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.upload_certificate.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'UploadCertificateRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_upload_certificate_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.upload_certificate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'UploadCertificateRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1360,4 +1244,6 @@ async def upload_certificate( return cls(pipeline_response, deserialized, {}) return deserialized + upload_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/uploadCertificate'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_jobs_operations.py index 8d1ef9d46a12..6a06f2026571 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_jobs_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._jobs_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,12 +44,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Job": """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. @@ -67,28 +72,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -102,4 +97,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_monitoring_config_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_monitoring_config_operations.py index 01e65834f526..361d206ac5a1 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_monitoring_config_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_monitoring_config_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._monitoring_config_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, device_name: str, role_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.MonitoringMetricConfigurationList"]: """Lists metric configurations in a role. @@ -61,8 +67,10 @@ def list( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MonitoringMetricConfigurationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MonitoringMetricConfigurationList] + :return: An iterator like instance of either MonitoringMetricConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MonitoringMetricConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringMetricConfigurationList"] @@ -70,37 +78,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('MonitoringMetricConfigurationList', pipeline_response) + deserialized = self._deserialize("MonitoringMetricConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,17 +124,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, role_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.MonitoringMetricConfiguration": """Gets a metric configuration of a role. @@ -150,28 +158,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,48 +183,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + async def _create_or_update_initial( self, device_name: str, role_name: str, resource_group_name: str, monitoring_metric_configuration: "_models.MonitoringMetricConfiguration", - **kwargs + **kwargs: Any ) -> Optional["_models.MonitoringMetricConfiguration"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MonitoringMetricConfiguration"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(monitoring_metric_configuration, 'MonitoringMetricConfiguration') + + request = build_create_or_update_request_initial( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(monitoring_metric_configuration, 'MonitoringMetricConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -242,15 +232,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, role_name: str, resource_group_name: str, monitoring_metric_configuration: "_models.MonitoringMetricConfiguration", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.MonitoringMetricConfiguration"]: """Creates a new metric configuration or updates an existing one for a role. @@ -263,18 +256,24 @@ async def begin_create_or_update( :param resource_group_name: The resource group name. :type resource_group_name: str :param monitoring_metric_configuration: The metric configuration. - :type monitoring_metric_configuration: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.MonitoringMetricConfiguration + :type monitoring_metric_configuration: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.MonitoringMetricConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MonitoringMetricConfiguration or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MonitoringMetricConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringMetricConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MonitoringMetricConfiguration] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringMetricConfiguration"] lro_delay = kwargs.pop( 'polling_interval', @@ -287,28 +286,21 @@ async def begin_create_or_update( role_name=role_name, resource_group_name=resource_group_name, monitoring_metric_configuration=monitoring_metric_configuration, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MonitoringMetricConfiguration', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -320,6 +312,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore async def _delete_initial( @@ -327,35 +320,25 @@ async def _delete_initial( device_name: str, role_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -368,12 +351,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, role_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """deletes a new metric configuration for a role. @@ -387,15 +372,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -410,22 +397,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -437,4 +416,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_nodes_operations.py index 16b1502c3c01..8d5007fc3ef8 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_nodes_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._nodes_operations import build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,11 +46,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.NodeList"]: """Gets all the nodes currently configured under this Data Box Edge device. @@ -55,7 +61,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either NodeList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.NodeList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.NodeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeList"] @@ -63,36 +70,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('NodeList', pipeline_response) + deserialized = self._deserialize("NodeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,6 +114,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_operations.py index e95f2b13a318..efdd902d4d9b 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,9 +46,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OperationsList"]: """List all the supported operations. @@ -51,7 +57,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.OperationsList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.OperationsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationsList"] @@ -59,30 +66,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationsList', pipeline_response) + deserialized = self._deserialize("OperationsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -100,6 +104,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_operations_status_operations.py index 950f863461ed..1fb8ceaada0a 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_operations_status_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations_status_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,12 +44,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Job": """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. @@ -67,28 +72,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -102,4 +97,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/operationsStatus/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_orders_operations.py index 1e665d55ec85..97a7aac45e88 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_orders_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._orders_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request, build_list_dc_access_code_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OrderList"]: """Lists all the orders related to a Data Box Edge/Data Box Gateway device. @@ -59,7 +65,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OrderList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.OrderList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.OrderList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OrderList"] @@ -67,36 +74,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OrderList', pipeline_response) + deserialized = self._deserialize("OrderList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,16 +118,18 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Order": """Gets a specific order by name. @@ -143,27 +149,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,46 +173,38 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + async def _create_or_update_initial( self, device_name: str, resource_group_name: str, order: "_models.Order", - **kwargs + **kwargs: Any ) -> Optional["_models.Order"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Order"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(order, 'Order') + + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(order, 'Order') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -232,14 +220,17 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, resource_group_name: str, order: "_models.Order", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Order"]: """Creates or updates an order. @@ -253,15 +244,19 @@ async def begin_create_or_update( :type order: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.Order :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Order or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Order] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Order] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Order"] lro_delay = kwargs.pop( 'polling_interval', @@ -273,27 +268,21 @@ async def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, order=order, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Order', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -305,40 +294,31 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore async def _delete_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -351,11 +331,13 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the order related to the device. @@ -367,15 +349,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -389,21 +373,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -415,13 +392,15 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + @distributed_trace_async async def list_dc_access_code( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.DCAccessCode": """Gets the DCAccess Code. @@ -441,27 +420,17 @@ async def list_dc_access_code( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_dc_access_code.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_dc_access_code_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_dc_access_code.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -475,4 +444,6 @@ async def list_dc_access_code( return cls(pipeline_response, deserialized, {}) return deserialized + list_dc_access_code.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default/listDCAccessCode'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_roles_operations.py index 6b88bc8be448..72dca27225f5 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_roles_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._roles_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.RoleList"]: """Lists all the roles configured in a Data Box Edge/Data Box Gateway device. @@ -57,7 +63,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RoleList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleList"] @@ -65,36 +72,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RoleList', pipeline_response) + deserialized = self._deserialize("RoleList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,17 +116,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Role": """Gets a specific role by name. @@ -142,28 +148,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,48 +173,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, role: "_models.Role", - **kwargs + **kwargs: Any ) -> Optional["_models.Role"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Role"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(role, 'Role') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(role, 'Role') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -234,15 +222,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, role: "_models.Role", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Role"]: """Create or update a role. @@ -256,15 +247,19 @@ async def begin_create_or_update( :type role: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.Role :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Role or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Role] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Role] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Role"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,28 +272,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, role=role, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Role', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -310,6 +298,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore async def _delete_initial( @@ -317,35 +306,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -358,12 +337,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the role on the device. @@ -375,15 +356,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -398,22 +381,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -425,4 +400,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_shares_operations.py index d70a74348b59..06b2fe1de3ba 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_shares_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._shares_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request, build_refresh_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ShareList"]: """Lists all the shares in a Data Box Edge/Data Box Gateway device. @@ -59,7 +65,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ShareList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.ShareList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.ShareList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ShareList"] @@ -67,36 +74,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ShareList', pipeline_response) + deserialized = self._deserialize("ShareList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,17 +118,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Share": """Gets a share by name. @@ -146,28 +152,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -181,48 +177,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, share: "_models.Share", - **kwargs + **kwargs: Any ) -> Optional["_models.Share"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Share"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(share, 'Share') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(share, 'Share') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -238,15 +226,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, share: "_models.Share", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Share"]: """Creates a new share or updates an existing share on the device. @@ -262,15 +253,19 @@ async def begin_create_or_update( :type share: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.Share :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Share or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Share] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Share] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Share"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,28 +278,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, share=share, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Share', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -316,6 +304,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore async def _delete_initial( @@ -323,35 +312,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,12 +343,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the share on the Data Box Edge/Data Box Gateway device. @@ -381,15 +362,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -404,22 +387,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -431,6 +406,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore async def _refresh_initial( @@ -438,35 +414,25 @@ async def _refresh_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -479,12 +445,14 @@ async def _refresh_initial( _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore + + @distributed_trace_async async def begin_refresh( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Refreshes the share metadata with the data from the cloud. @@ -498,15 +466,17 @@ async def begin_refresh( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -521,22 +491,14 @@ async def begin_refresh( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -548,4 +510,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_storage_account_credentials_operations.py index 40c4cd4f3593..a7023f4f90c8 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_storage_account_credentials_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._storage_account_credentials_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.StorageAccountCredentialList"]: """Gets all the storage account credentials in a Data Box Edge/Data Box Gateway device. @@ -58,8 +64,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountCredentialList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.StorageAccountCredentialList] + :return: An iterator like instance of either StorageAccountCredentialList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.StorageAccountCredentialList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredentialList"] @@ -67,36 +75,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('StorageAccountCredentialList', pipeline_response) + deserialized = self._deserialize("StorageAccountCredentialList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,17 +119,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.StorageAccountCredential": """Gets the properties of the specified storage account credential. @@ -144,28 +151,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -179,48 +176,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, storage_account_credential: "_models.StorageAccountCredential", - **kwargs + **kwargs: Any ) -> Optional["_models.StorageAccountCredential"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccountCredential"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(storage_account_credential, 'StorageAccountCredential') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_account_credential, 'StorageAccountCredential') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -236,15 +225,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, storage_account_credential: "_models.StorageAccountCredential", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.StorageAccountCredential"]: """Creates or updates the storage account credential. @@ -255,18 +247,24 @@ async def begin_create_or_update( :param resource_group_name: The resource group name. :type resource_group_name: str :param storage_account_credential: The storage account credential. - :type storage_account_credential: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.StorageAccountCredential + :type storage_account_credential: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.StorageAccountCredential :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either StorageAccountCredential or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.StorageAccountCredential] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageAccountCredential or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.StorageAccountCredential] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredential"] lro_delay = kwargs.pop( 'polling_interval', @@ -279,28 +277,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, storage_account_credential=storage_account_credential, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccountCredential', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -312,6 +303,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore async def _delete_initial( @@ -319,35 +311,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -360,12 +342,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the storage account credential. @@ -377,15 +361,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -400,22 +386,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -427,4 +405,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_storage_accounts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_storage_accounts_operations.py index 188f3555a9cd..135e98f167ff 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_storage_accounts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_storage_accounts_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._storage_accounts_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.StorageAccountList"]: """Lists all the StorageAccounts in a Data Box Edge/Data Box Gateway device. @@ -59,7 +65,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either StorageAccountList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.StorageAccountList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.StorageAccountList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountList"] @@ -67,36 +74,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('StorageAccountList', pipeline_response) + deserialized = self._deserialize("StorageAccountList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,17 +118,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, storage_account_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.StorageAccount": """Gets a StorageAccount by name. @@ -146,28 +152,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -181,48 +177,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, storage_account_name: str, resource_group_name: str, storage_account: "_models.StorageAccount", - **kwargs + **kwargs: Any ) -> Optional["_models.StorageAccount"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(storage_account, 'StorageAccount') + + request = build_create_or_update_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_account, 'StorageAccount') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -238,15 +226,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, storage_account_name: str, resource_group_name: str, storage_account: "_models.StorageAccount", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.StorageAccount"]: """Creates a new StorageAccount or updates an existing StorageAccount on the device. @@ -262,15 +253,20 @@ async def begin_create_or_update( :type storage_account: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.StorageAccount :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either StorageAccount or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,28 +279,21 @@ async def begin_create_or_update( storage_account_name=storage_account_name, resource_group_name=resource_group_name, storage_account=storage_account, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -316,6 +305,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore async def _delete_initial( @@ -323,35 +313,25 @@ async def _delete_initial( device_name: str, storage_account_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,12 +344,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, storage_account_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the StorageAccount on the Data Box Edge/Data Box Gateway device. @@ -381,15 +363,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -404,22 +388,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -431,4 +407,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_triggers_operations.py index ed62fda82f71..092a2a47f448 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_triggers_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._triggers_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, filter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.TriggerList"]: """Lists all the triggers configured in the device. @@ -61,7 +67,8 @@ def list_by_data_box_edge_device( :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TriggerList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.TriggerList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.TriggerList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TriggerList"] @@ -69,38 +76,35 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TriggerList', pipeline_response) + deserialized = self._deserialize("TriggerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,17 +122,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Trigger": """Get a specific trigger by name. @@ -148,28 +154,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,48 +179,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, trigger: "_models.Trigger", - **kwargs + **kwargs: Any ) -> Optional["_models.Trigger"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Trigger"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(trigger, 'Trigger') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(trigger, 'Trigger') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,15 +228,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, trigger: "_models.Trigger", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Trigger"]: """Creates or updates a trigger. @@ -262,15 +253,20 @@ async def begin_create_or_update( :type trigger: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.Trigger :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Trigger or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Trigger] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Trigger or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Trigger] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Trigger"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,28 +279,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, trigger=trigger, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Trigger', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -316,6 +305,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore async def _delete_initial( @@ -323,35 +313,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,12 +344,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the trigger on the gateway device. @@ -381,15 +363,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -404,22 +388,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -431,4 +407,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_users_operations.py index f3eee3cf5521..36b53bc75e09 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_users_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._users_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, expand: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.UserList"]: """Gets all the users registered on a Data Box Edge/Data Box Gateway device. @@ -61,7 +67,8 @@ def list_by_data_box_edge_device( :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.UserList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.UserList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UserList"] @@ -69,38 +76,35 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('UserList', pipeline_response) + deserialized = self._deserialize("UserList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,17 +122,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.User": """Gets the properties of the specified user. @@ -148,28 +154,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,48 +179,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, user: "_models.User", - **kwargs + **kwargs: Any ) -> Optional["_models.User"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.User"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(user, 'User') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(user, 'User') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,15 +228,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, user: "_models.User", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.User"]: """Creates a new user or updates an existing user's information on a Data Box Edge/Data Box Gateway device. @@ -263,15 +254,19 @@ async def begin_create_or_update( :type user: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.User :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either User or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.User] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.User] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.User"] lro_delay = kwargs.pop( 'polling_interval', @@ -284,28 +279,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, user=user, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('User', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -317,6 +305,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore async def _delete_initial( @@ -324,35 +313,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -365,12 +344,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the user on a databox edge/gateway device. @@ -382,15 +363,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -405,22 +388,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -432,4 +407,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/models/__init__.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/models/__init__.py index 8b331ada40a8..6941eeba099b 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/models/__init__.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/models/__init__.py @@ -6,240 +6,123 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ARMBaseModel - from ._models_py3 import Addon - from ._models_py3 import AddonList - from ._models_py3 import Address - from ._models_py3 import Alert - from ._models_py3 import AlertErrorDetails - from ._models_py3 import AlertList - from ._models_py3 import ArcAddon - from ._models_py3 import AsymmetricEncryptedSecret - from ._models_py3 import Authentication - from ._models_py3 import AzureContainerInfo - from ._models_py3 import BandwidthSchedule - from ._models_py3 import BandwidthSchedulesList - from ._models_py3 import ClientAccessRight - from ._models_py3 import CloudEdgeManagementRole - from ._models_py3 import CloudErrorBody - from ._models_py3 import CniConfig - from ._models_py3 import ComputeResource - from ._models_py3 import ContactDetails - from ._models_py3 import Container - from ._models_py3 import ContainerList - from ._models_py3 import DCAccessCode - from ._models_py3 import DataBoxEdgeDevice - from ._models_py3 import DataBoxEdgeDeviceExtendedInfo - from ._models_py3 import DataBoxEdgeDeviceExtendedInfoPatch - from ._models_py3 import DataBoxEdgeDeviceList - from ._models_py3 import DataBoxEdgeDevicePatch - from ._models_py3 import DataBoxEdgeMoveRequest - from ._models_py3 import DataBoxEdgeSku - from ._models_py3 import DataBoxEdgeSkuList - from ._models_py3 import EdgeProfile - from ._models_py3 import EdgeProfilePatch - from ._models_py3 import EdgeProfileSubscription - from ._models_py3 import EdgeProfileSubscriptionPatch - from ._models_py3 import EtcdInfo - from ._models_py3 import FileEventTrigger - from ._models_py3 import FileSourceInfo - from ._models_py3 import GenerateCertResponse - from ._models_py3 import ImageRepositoryCredential - from ._models_py3 import IoTAddon - from ._models_py3 import IoTDeviceInfo - from ._models_py3 import IoTEdgeAgentInfo - from ._models_py3 import IoTRole - from ._models_py3 import Ipv4Config - from ._models_py3 import Ipv6Config - from ._models_py3 import Job - from ._models_py3 import JobErrorDetails - from ._models_py3 import JobErrorItem - from ._models_py3 import KubernetesClusterInfo - from ._models_py3 import KubernetesIPConfiguration - from ._models_py3 import KubernetesRole - from ._models_py3 import KubernetesRoleCompute - from ._models_py3 import KubernetesRoleNetwork - from ._models_py3 import KubernetesRoleResources - from ._models_py3 import KubernetesRoleStorage - from ._models_py3 import KubernetesRoleStorageClassInfo - from ._models_py3 import LoadBalancerConfig - from ._models_py3 import MECRole - from ._models_py3 import MetricConfiguration - from ._models_py3 import MetricCounter - from ._models_py3 import MetricCounterSet - from ._models_py3 import MetricDimension - from ._models_py3 import MetricDimensionV1 - from ._models_py3 import MetricSpecificationV1 - from ._models_py3 import MonitoringMetricConfiguration - from ._models_py3 import MonitoringMetricConfigurationList - from ._models_py3 import MountPointMap - from ._models_py3 import NetworkAdapter - from ._models_py3 import NetworkAdapterPosition - from ._models_py3 import NetworkSettings - from ._models_py3 import Node - from ._models_py3 import NodeInfo - from ._models_py3 import NodeList - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationsList - from ._models_py3 import Order - from ._models_py3 import OrderList - from ._models_py3 import OrderStatus - from ._models_py3 import PeriodicTimerEventTrigger - from ._models_py3 import PeriodicTimerSourceInfo - from ._models_py3 import RefreshDetails - from ._models_py3 import ResourceIdentity - from ._models_py3 import ResourceMoveDetails - from ._models_py3 import ResourceTypeSku - from ._models_py3 import Role - from ._models_py3 import RoleList - from ._models_py3 import RoleSinkInfo - from ._models_py3 import SecuritySettings - from ._models_py3 import ServiceSpecification - from ._models_py3 import Share - from ._models_py3 import ShareAccessRight - from ._models_py3 import ShareList - from ._models_py3 import Sku - from ._models_py3 import SkuCost - from ._models_py3 import SkuInformation - from ._models_py3 import SkuInformationList - from ._models_py3 import SkuLocationInfo - from ._models_py3 import StorageAccount - from ._models_py3 import StorageAccountCredential - from ._models_py3 import StorageAccountCredentialList - from ._models_py3 import StorageAccountList - from ._models_py3 import SubscriptionRegisteredFeatures - from ._models_py3 import SymmetricKey - from ._models_py3 import SystemData - from ._models_py3 import TrackingInfo - from ._models_py3 import Trigger - from ._models_py3 import TriggerList - from ._models_py3 import UpdateDownloadProgress - from ._models_py3 import UpdateInstallProgress - from ._models_py3 import UpdateSummary - from ._models_py3 import UploadCertificateRequest - from ._models_py3 import UploadCertificateResponse - from ._models_py3 import User - from ._models_py3 import UserAccessRight - from ._models_py3 import UserList -except (SyntaxError, ImportError): - from ._models import ARMBaseModel # type: ignore - from ._models import Addon # type: ignore - from ._models import AddonList # type: ignore - from ._models import Address # type: ignore - from ._models import Alert # type: ignore - from ._models import AlertErrorDetails # type: ignore - from ._models import AlertList # type: ignore - from ._models import ArcAddon # type: ignore - from ._models import AsymmetricEncryptedSecret # type: ignore - from ._models import Authentication # type: ignore - from ._models import AzureContainerInfo # type: ignore - from ._models import BandwidthSchedule # type: ignore - from ._models import BandwidthSchedulesList # type: ignore - from ._models import ClientAccessRight # type: ignore - from ._models import CloudEdgeManagementRole # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import CniConfig # type: ignore - from ._models import ComputeResource # type: ignore - from ._models import ContactDetails # type: ignore - from ._models import Container # type: ignore - from ._models import ContainerList # type: ignore - from ._models import DCAccessCode # type: ignore - from ._models import DataBoxEdgeDevice # type: ignore - from ._models import DataBoxEdgeDeviceExtendedInfo # type: ignore - from ._models import DataBoxEdgeDeviceExtendedInfoPatch # type: ignore - from ._models import DataBoxEdgeDeviceList # type: ignore - from ._models import DataBoxEdgeDevicePatch # type: ignore - from ._models import DataBoxEdgeMoveRequest # type: ignore - from ._models import DataBoxEdgeSku # type: ignore - from ._models import DataBoxEdgeSkuList # type: ignore - from ._models import EdgeProfile # type: ignore - from ._models import EdgeProfilePatch # type: ignore - from ._models import EdgeProfileSubscription # type: ignore - from ._models import EdgeProfileSubscriptionPatch # type: ignore - from ._models import EtcdInfo # type: ignore - from ._models import FileEventTrigger # type: ignore - from ._models import FileSourceInfo # type: ignore - from ._models import GenerateCertResponse # type: ignore - from ._models import ImageRepositoryCredential # type: ignore - from ._models import IoTAddon # type: ignore - from ._models import IoTDeviceInfo # type: ignore - from ._models import IoTEdgeAgentInfo # type: ignore - from ._models import IoTRole # type: ignore - from ._models import Ipv4Config # type: ignore - from ._models import Ipv6Config # type: ignore - from ._models import Job # type: ignore - from ._models import JobErrorDetails # type: ignore - from ._models import JobErrorItem # type: ignore - from ._models import KubernetesClusterInfo # type: ignore - from ._models import KubernetesIPConfiguration # type: ignore - from ._models import KubernetesRole # type: ignore - from ._models import KubernetesRoleCompute # type: ignore - from ._models import KubernetesRoleNetwork # type: ignore - from ._models import KubernetesRoleResources # type: ignore - from ._models import KubernetesRoleStorage # type: ignore - from ._models import KubernetesRoleStorageClassInfo # type: ignore - from ._models import LoadBalancerConfig # type: ignore - from ._models import MECRole # type: ignore - from ._models import MetricConfiguration # type: ignore - from ._models import MetricCounter # type: ignore - from ._models import MetricCounterSet # type: ignore - from ._models import MetricDimension # type: ignore - from ._models import MetricDimensionV1 # type: ignore - from ._models import MetricSpecificationV1 # type: ignore - from ._models import MonitoringMetricConfiguration # type: ignore - from ._models import MonitoringMetricConfigurationList # type: ignore - from ._models import MountPointMap # type: ignore - from ._models import NetworkAdapter # type: ignore - from ._models import NetworkAdapterPosition # type: ignore - from ._models import NetworkSettings # type: ignore - from ._models import Node # type: ignore - from ._models import NodeInfo # type: ignore - from ._models import NodeList # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationsList # type: ignore - from ._models import Order # type: ignore - from ._models import OrderList # type: ignore - from ._models import OrderStatus # type: ignore - from ._models import PeriodicTimerEventTrigger # type: ignore - from ._models import PeriodicTimerSourceInfo # type: ignore - from ._models import RefreshDetails # type: ignore - from ._models import ResourceIdentity # type: ignore - from ._models import ResourceMoveDetails # type: ignore - from ._models import ResourceTypeSku # type: ignore - from ._models import Role # type: ignore - from ._models import RoleList # type: ignore - from ._models import RoleSinkInfo # type: ignore - from ._models import SecuritySettings # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Share # type: ignore - from ._models import ShareAccessRight # type: ignore - from ._models import ShareList # type: ignore - from ._models import Sku # type: ignore - from ._models import SkuCost # type: ignore - from ._models import SkuInformation # type: ignore - from ._models import SkuInformationList # type: ignore - from ._models import SkuLocationInfo # type: ignore - from ._models import StorageAccount # type: ignore - from ._models import StorageAccountCredential # type: ignore - from ._models import StorageAccountCredentialList # type: ignore - from ._models import StorageAccountList # type: ignore - from ._models import SubscriptionRegisteredFeatures # type: ignore - from ._models import SymmetricKey # type: ignore - from ._models import SystemData # type: ignore - from ._models import TrackingInfo # type: ignore - from ._models import Trigger # type: ignore - from ._models import TriggerList # type: ignore - from ._models import UpdateDownloadProgress # type: ignore - from ._models import UpdateInstallProgress # type: ignore - from ._models import UpdateSummary # type: ignore - from ._models import UploadCertificateRequest # type: ignore - from ._models import UploadCertificateResponse # type: ignore - from ._models import User # type: ignore - from ._models import UserAccessRight # type: ignore - from ._models import UserList # type: ignore +from ._models_py3 import ARMBaseModel +from ._models_py3 import Addon +from ._models_py3 import AddonList +from ._models_py3 import Address +from ._models_py3 import Alert +from ._models_py3 import AlertErrorDetails +from ._models_py3 import AlertList +from ._models_py3 import ArcAddon +from ._models_py3 import AsymmetricEncryptedSecret +from ._models_py3 import Authentication +from ._models_py3 import AzureContainerInfo +from ._models_py3 import BandwidthSchedule +from ._models_py3 import BandwidthSchedulesList +from ._models_py3 import ClientAccessRight +from ._models_py3 import CloudEdgeManagementRole +from ._models_py3 import CloudErrorBody +from ._models_py3 import CniConfig +from ._models_py3 import ComputeResource +from ._models_py3 import ContactDetails +from ._models_py3 import Container +from ._models_py3 import ContainerList +from ._models_py3 import DCAccessCode +from ._models_py3 import DataBoxEdgeDevice +from ._models_py3 import DataBoxEdgeDeviceExtendedInfo +from ._models_py3 import DataBoxEdgeDeviceExtendedInfoPatch +from ._models_py3 import DataBoxEdgeDeviceList +from ._models_py3 import DataBoxEdgeDevicePatch +from ._models_py3 import DataBoxEdgeMoveRequest +from ._models_py3 import DataBoxEdgeSku +from ._models_py3 import DataBoxEdgeSkuList +from ._models_py3 import EdgeProfile +from ._models_py3 import EdgeProfilePatch +from ._models_py3 import EdgeProfileSubscription +from ._models_py3 import EdgeProfileSubscriptionPatch +from ._models_py3 import EtcdInfo +from ._models_py3 import FileEventTrigger +from ._models_py3 import FileSourceInfo +from ._models_py3 import GenerateCertResponse +from ._models_py3 import ImageRepositoryCredential +from ._models_py3 import IoTAddon +from ._models_py3 import IoTDeviceInfo +from ._models_py3 import IoTEdgeAgentInfo +from ._models_py3 import IoTRole +from ._models_py3 import Ipv4Config +from ._models_py3 import Ipv6Config +from ._models_py3 import Job +from ._models_py3 import JobErrorDetails +from ._models_py3 import JobErrorItem +from ._models_py3 import KubernetesClusterInfo +from ._models_py3 import KubernetesIPConfiguration +from ._models_py3 import KubernetesRole +from ._models_py3 import KubernetesRoleCompute +from ._models_py3 import KubernetesRoleNetwork +from ._models_py3 import KubernetesRoleResources +from ._models_py3 import KubernetesRoleStorage +from ._models_py3 import KubernetesRoleStorageClassInfo +from ._models_py3 import LoadBalancerConfig +from ._models_py3 import MECRole +from ._models_py3 import MetricConfiguration +from ._models_py3 import MetricCounter +from ._models_py3 import MetricCounterSet +from ._models_py3 import MetricDimension +from ._models_py3 import MetricDimensionV1 +from ._models_py3 import MetricSpecificationV1 +from ._models_py3 import MonitoringMetricConfiguration +from ._models_py3 import MonitoringMetricConfigurationList +from ._models_py3 import MountPointMap +from ._models_py3 import NetworkAdapter +from ._models_py3 import NetworkAdapterPosition +from ._models_py3 import NetworkSettings +from ._models_py3 import Node +from ._models_py3 import NodeInfo +from ._models_py3 import NodeList +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationsList +from ._models_py3 import Order +from ._models_py3 import OrderList +from ._models_py3 import OrderStatus +from ._models_py3 import PeriodicTimerEventTrigger +from ._models_py3 import PeriodicTimerSourceInfo +from ._models_py3 import RefreshDetails +from ._models_py3 import ResourceIdentity +from ._models_py3 import ResourceMoveDetails +from ._models_py3 import ResourceTypeSku +from ._models_py3 import Role +from ._models_py3 import RoleList +from ._models_py3 import RoleSinkInfo +from ._models_py3 import SecuritySettings +from ._models_py3 import ServiceSpecification +from ._models_py3 import Share +from ._models_py3 import ShareAccessRight +from ._models_py3 import ShareList +from ._models_py3 import Sku +from ._models_py3 import SkuCost +from ._models_py3 import SkuInformation +from ._models_py3 import SkuInformationList +from ._models_py3 import SkuLocationInfo +from ._models_py3 import StorageAccount +from ._models_py3 import StorageAccountCredential +from ._models_py3 import StorageAccountCredentialList +from ._models_py3 import StorageAccountList +from ._models_py3 import SubscriptionRegisteredFeatures +from ._models_py3 import SymmetricKey +from ._models_py3 import SystemData +from ._models_py3 import TrackingInfo +from ._models_py3 import Trigger +from ._models_py3 import TriggerList +from ._models_py3 import UpdateDownloadProgress +from ._models_py3 import UpdateInstallProgress +from ._models_py3 import UpdateSummary +from ._models_py3 import UploadCertificateRequest +from ._models_py3 import UploadCertificateResponse +from ._models_py3 import User +from ._models_py3 import UserAccessRight +from ._models_py3 import UserList + from ._data_box_edge_management_client_enums import ( AccountType, diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/models/_data_box_edge_management_client_enums.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/models/_data_box_edge_management_client_enums.py index 0cec6392e961..25c4872a93ae 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/models/_data_box_edge_management_client_enums.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/models/_data_box_edge_management_client_enums.py @@ -6,34 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccountType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of storage accessed on the storage account. """ GENERAL_PURPOSE_STORAGE = "GeneralPurposeStorage" BLOB_STORAGE = "BlobStorage" -class AddonState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AddonState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Addon Provisioning State """ @@ -45,14 +30,14 @@ class AddonState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" DELETING = "Deleting" -class AddonType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AddonType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Addon type. """ IOT_EDGE = "IotEdge" ARC_FOR_KUBERNETES = "ArcForKubernetes" -class AlertSeverity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AlertSeverity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Severity of the alert. """ @@ -60,14 +45,14 @@ class AlertSeverity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" CRITICAL = "Critical" -class AuthenticationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AuthenticationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The authentication type. """ INVALID = "Invalid" AZURE_ACTIVE_DIRECTORY = "AzureActiveDirectory" -class AzureContainerDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AzureContainerDataFormat(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Storage format used for the file represented by the share. """ @@ -75,7 +60,7 @@ class AzureContainerDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu PAGE_BLOB = "PageBlob" AZURE_FILE = "AzureFile" -class ClientPermissionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ClientPermissionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of access to be allowed for the client. """ @@ -83,7 +68,7 @@ class ClientPermissionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ_ONLY = "ReadOnly" READ_WRITE = "ReadWrite" -class ContainerStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ContainerStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current status of the container. """ @@ -93,7 +78,7 @@ class ContainerStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UPDATING = "Updating" NEEDS_ATTENTION = "NeedsAttention" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -102,7 +87,7 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class DataBoxEdgeDeviceKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DataBoxEdgeDeviceKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The etag for the devices. """ @@ -111,7 +96,7 @@ class DataBoxEdgeDeviceKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) AZURE_STACK_HUB = "AzureStackHub" AZURE_MODULAR_DATA_CENTRE = "AzureModularDataCentre" -class DataBoxEdgeDeviceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DataBoxEdgeDeviceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the Data Box Edge/Gateway device. """ @@ -123,14 +108,14 @@ class DataBoxEdgeDeviceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum PARTIALLY_DISCONNECTED = "PartiallyDisconnected" MAINTENANCE = "Maintenance" -class DataPolicy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DataPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Data policy of the share. """ CLOUD = "Cloud" LOCAL = "Local" -class DayOfWeek(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DayOfWeek(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SUNDAY = "Sunday" MONDAY = "Monday" @@ -140,13 +125,13 @@ class DayOfWeek(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FRIDAY = "Friday" SATURDAY = "Saturday" -class DeviceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeviceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the Data Box Edge/Gateway device. """ DATA_BOX_EDGE_DEVICE = "DataBoxEdgeDevice" -class DownloadPhase(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DownloadPhase(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The download phase. """ @@ -155,7 +140,7 @@ class DownloadPhase(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DOWNLOADING = "Downloading" VERIFYING = "Verifying" -class EncryptionAlgorithm(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The algorithm used to encrypt "Value". """ @@ -163,14 +148,14 @@ class EncryptionAlgorithm(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AES256 = "AES256" RSAES_PKCS1_V1_5 = "RSAES_PKCS1_v_1_5" -class HostPlatformType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HostPlatformType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Platform where the runtime is hosted. """ KUBERNETES_CLUSTER = "KubernetesCluster" LINUX_VM = "LinuxVM" -class InstallRebootBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InstallRebootBehavior(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates if updates are available and at least one of the updates needs a reboot. """ @@ -178,7 +163,7 @@ class InstallRebootBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) REQUIRES_REBOOT = "RequiresReboot" REQUEST_REBOOT = "RequestReboot" -class JobStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JobStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current status of the job. """ @@ -190,7 +175,7 @@ class JobStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PAUSED = "Paused" SCHEDULED = "Scheduled" -class JobType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JobType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the job. """ @@ -204,7 +189,7 @@ class JobType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESTORE = "Restore" TRIGGER_SUPPORT_PACKAGE = "TriggerSupportPackage" -class KubernetesNodeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KubernetesNodeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Node type - Master/Worker """ @@ -212,7 +197,7 @@ class KubernetesNodeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MASTER = "Master" WORKER = "Worker" -class KubernetesState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KubernetesState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """State of Kubernetes deployment """ @@ -224,7 +209,7 @@ class KubernetesState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" DELETING = "Deleting" -class MetricAggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricAggregationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Metric aggregation type. """ @@ -236,14 +221,14 @@ class MetricAggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) TOTAL = "Total" COUNT = "Count" -class MetricCategory(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricCategory(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Metric category. """ CAPACITY = "Capacity" TRANSACTION = "Transaction" -class MetricUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Metric units. """ @@ -256,21 +241,21 @@ class MetricUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BYTES_PER_SECOND = "BytesPerSecond" COUNT_PER_SECOND = "CountPerSecond" -class MonitoringStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MonitoringStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current monitoring status of the share. """ ENABLED = "Enabled" DISABLED = "Disabled" -class MountType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MountType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Mounting type. """ VOLUME = "Volume" HOST_PATH = "HostPath" -class MsiIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MsiIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Identity type """ @@ -278,28 +263,28 @@ class MsiIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED = "SystemAssigned" USER_ASSIGNED = "UserAssigned" -class NetworkAdapterDHCPStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkAdapterDHCPStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Value indicating whether this adapter has DHCP enabled. """ DISABLED = "Disabled" ENABLED = "Enabled" -class NetworkAdapterRDMAStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkAdapterRDMAStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Value indicating whether this adapter is RDMA capable. """ INCAPABLE = "Incapable" CAPABLE = "Capable" -class NetworkAdapterStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkAdapterStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Value indicating whether this adapter is valid. """ INACTIVE = "Inactive" ACTIVE = "Active" -class NetworkGroup(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkGroup(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The network group. """ @@ -307,7 +292,7 @@ class NetworkGroup(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): NON_RDMA = "NonRDMA" RDMA = "RDMA" -class NodeStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NodeStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current status of the individual node """ @@ -317,7 +302,7 @@ class NodeStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): REBOOTING = "Rebooting" SHUTTING_DOWN = "ShuttingDown" -class OrderState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OrderState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the order as per the allowed status types. """ @@ -339,14 +324,14 @@ class OrderState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PICKUP_COMPLETED = "PickupCompleted" AWAITING_DROP = "AwaitingDrop" -class PlatformType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PlatformType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Host OS supported by the Arc addon. """ WINDOWS = "Windows" LINUX = "Linux" -class PosixComplianceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PosixComplianceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """If provisioned storage is posix compliant. """ @@ -354,7 +339,7 @@ class PosixComplianceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) ENABLED = "Enabled" DISABLED = "Disabled" -class ResourceMoveStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceMoveStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Denotes whether move operation is in progress """ @@ -362,14 +347,14 @@ class ResourceMoveStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESOURCE_MOVE_IN_PROGRESS = "ResourceMoveInProgress" RESOURCE_MOVE_FAILED = "ResourceMoveFailed" -class RoleStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RoleStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Local Edge Management Status """ ENABLED = "Enabled" DISABLED = "Disabled" -class RoleTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RoleTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): IOT = "IOT" ASA = "ASA" @@ -379,14 +364,14 @@ class RoleTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): CLOUD_EDGE_MANAGEMENT = "CloudEdgeManagement" KUBERNETES = "Kubernetes" -class ShareAccessProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareAccessProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Access protocol to be used by the share. """ SMB = "SMB" NFS = "NFS" -class ShareAccessType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareAccessType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of access to be allowed on the share for this user. """ @@ -394,7 +379,7 @@ class ShareAccessType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ = "Read" CUSTOM = "Custom" -class ShareStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current status of the share. """ @@ -404,20 +389,20 @@ class ShareStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UPDATING = "Updating" NEEDS_ATTENTION = "NeedsAttention" -class ShipmentType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShipmentType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NOT_APPLICABLE = "NotApplicable" SHIPPED_TO_CUSTOMER = "ShippedToCustomer" SELF_PICKUP = "SelfPickup" -class SkuAvailability(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuAvailability(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Links to the next set of results """ AVAILABLE = "Available" UNAVAILABLE = "Unavailable" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Sku name. """ @@ -443,34 +428,34 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RCA_LARGE = "RCA_Large" RDC = "RDC" -class SkuSignupOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuSignupOption(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Sku can be signed up by customer or not. """ NONE = "None" AVAILABLE = "Available" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Sku tier. """ STANDARD = "Standard" -class SkuVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Availability of the Sku as preview/stable. """ STABLE = "Stable" PREVIEW = "Preview" -class SSLStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SSLStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Signifies whether SSL needs to be enabled or not. """ ENABLED = "Enabled" DISABLED = "Disabled" -class StorageAccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current status of the storage account """ @@ -480,7 +465,7 @@ class StorageAccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UPDATING = "Updating" NEEDS_ATTENTION = "NeedsAttention" -class SubscriptionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SubscriptionState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REGISTERED = "Registered" WARNED = "Warned" @@ -488,7 +473,7 @@ class SubscriptionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DELETED = "Deleted" UNREGISTERED = "Unregistered" -class TimeGrain(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TimeGrain(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PT1_M = "PT1M" PT5_M = "PT5M" @@ -499,14 +484,14 @@ class TimeGrain(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PT12_H = "PT12H" PT1_D = "PT1D" -class TriggerEventType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TriggerEventType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Trigger Kind. """ FILE_EVENT = "FileEvent" PERIODIC_TIMER_EVENT = "PeriodicTimerEvent" -class UpdateOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpdateOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current update operation. """ @@ -515,7 +500,7 @@ class UpdateOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DOWNLOAD = "Download" INSTALL = "Install" -class UpdateOperationStage(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpdateOperationStage(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current stage of the update operation. """ @@ -537,7 +522,7 @@ class UpdateOperationStage(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESCAN_COMPLETE = "RescanComplete" RESCAN_FAILED = "RescanFailed" -class UserType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UserType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the user. """ diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/models/_models.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/models/_models.py deleted file mode 100644 index d4b0f61fd347..000000000000 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/models/_models.py +++ /dev/null @@ -1,5037 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class ARMBaseModel(msrest.serialization.Model): - """Represents the base class for all object models. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ARMBaseModel, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class Addon(ARMBaseModel): - """Role Addon. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ArcAddon, IoTAddon. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Addon type.Constant filled by server. Possible values include: - "IotEdge", "ArcForKubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AddonType - :ivar system_data: Addon type. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - _subtype_map = { - 'kind': {'ArcForKubernetes': 'ArcAddon', 'IotEdge': 'IoTAddon'} - } - - def __init__( - self, - **kwargs - ): - super(Addon, self).__init__(**kwargs) - self.kind = 'Addon' # type: str - self.system_data = None - - -class AddonList(msrest.serialization.Model): - """Collection of all the Role addon on the Azure Stack Edge device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The Value. - :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Addon] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Addon]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AddonList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class Address(msrest.serialization.Model): - """The shipping address of the customer. - - All required parameters must be populated in order to send to Azure. - - :param address_line1: The address line1. - :type address_line1: str - :param address_line2: The address line2. - :type address_line2: str - :param address_line3: The address line3. - :type address_line3: str - :param postal_code: The postal code. - :type postal_code: str - :param city: The city name. - :type city: str - :param state: The state name. - :type state: str - :param country: Required. The country name. - :type country: str - """ - - _validation = { - 'country': {'required': True}, - } - - _attribute_map = { - 'address_line1': {'key': 'addressLine1', 'type': 'str'}, - 'address_line2': {'key': 'addressLine2', 'type': 'str'}, - 'address_line3': {'key': 'addressLine3', 'type': 'str'}, - 'postal_code': {'key': 'postalCode', 'type': 'str'}, - 'city': {'key': 'city', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'country': {'key': 'country', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Address, self).__init__(**kwargs) - self.address_line1 = kwargs.get('address_line1', None) - self.address_line2 = kwargs.get('address_line2', None) - self.address_line3 = kwargs.get('address_line3', None) - self.postal_code = kwargs.get('postal_code', None) - self.city = kwargs.get('city', None) - self.state = kwargs.get('state', None) - self.country = kwargs['country'] - - -class Alert(ARMBaseModel): - """Alert on the data box edge/gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar system_data: Alert generated in the resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - :ivar title: Alert title. - :vartype title: str - :ivar alert_type: Alert type. - :vartype alert_type: str - :ivar appeared_at_date_time: UTC time when the alert appeared. - :vartype appeared_at_date_time: ~datetime.datetime - :ivar recommendation: Alert recommendation. - :vartype recommendation: str - :ivar severity: Severity of the alert. Possible values include: "Informational", "Warning", - "Critical". - :vartype severity: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AlertSeverity - :ivar error_details: Error details of the alert. - :vartype error_details: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AlertErrorDetails - :ivar detailed_information: Alert details. - :vartype detailed_information: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'title': {'readonly': True}, - 'alert_type': {'readonly': True}, - 'appeared_at_date_time': {'readonly': True}, - 'recommendation': {'readonly': True}, - 'severity': {'readonly': True}, - 'error_details': {'readonly': True}, - 'detailed_information': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'title': {'key': 'properties.title', 'type': 'str'}, - 'alert_type': {'key': 'properties.alertType', 'type': 'str'}, - 'appeared_at_date_time': {'key': 'properties.appearedAtDateTime', 'type': 'iso-8601'}, - 'recommendation': {'key': 'properties.recommendation', 'type': 'str'}, - 'severity': {'key': 'properties.severity', 'type': 'str'}, - 'error_details': {'key': 'properties.errorDetails', 'type': 'AlertErrorDetails'}, - 'detailed_information': {'key': 'properties.detailedInformation', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(Alert, self).__init__(**kwargs) - self.system_data = None - self.title = None - self.alert_type = None - self.appeared_at_date_time = None - self.recommendation = None - self.severity = None - self.error_details = None - self.detailed_information = None - - -class AlertErrorDetails(msrest.serialization.Model): - """Error details for the alert. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error_code: Error code. - :vartype error_code: str - :ivar error_message: Error Message. - :vartype error_message: str - :ivar occurrences: Number of occurrences. - :vartype occurrences: int - """ - - _validation = { - 'error_code': {'readonly': True}, - 'error_message': {'readonly': True}, - 'occurrences': {'readonly': True}, - } - - _attribute_map = { - 'error_code': {'key': 'errorCode', 'type': 'str'}, - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - 'occurrences': {'key': 'occurrences', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(AlertErrorDetails, self).__init__(**kwargs) - self.error_code = None - self.error_message = None - self.occurrences = None - - -class AlertList(msrest.serialization.Model): - """Collection of alerts. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The value. - :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Alert] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Alert]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AlertList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ArcAddon(Addon): - """Arc Addon. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Addon type.Constant filled by server. Possible values include: - "IotEdge", "ArcForKubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AddonType - :ivar system_data: Addon type. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - :param subscription_id: Required. Arc resource subscription Id. - :type subscription_id: str - :param resource_group_name: Required. Arc resource group name. - :type resource_group_name: str - :param resource_name: Required. Arc resource Name. - :type resource_name: str - :param resource_location: Required. Arc resource location. - :type resource_location: str - :ivar version: Arc resource version. - :vartype version: str - :ivar host_platform: Host OS supported by the Arc addon. Possible values include: "Windows", - "Linux". - :vartype host_platform: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.PlatformType - :ivar host_platform_type: Platform where the runtime is hosted. Possible values include: - "KubernetesCluster", "LinuxVM". - :vartype host_platform_type: str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.HostPlatformType - :ivar provisioning_state: Addon Provisioning State. Possible values include: "Invalid", - "Creating", "Created", "Updating", "Reconfiguring", "Failed", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AddonState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - 'subscription_id': {'required': True}, - 'resource_group_name': {'required': True}, - 'resource_name': {'required': True}, - 'resource_location': {'required': True}, - 'version': {'readonly': True}, - 'host_platform': {'readonly': True}, - 'host_platform_type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'subscription_id': {'key': 'properties.subscriptionId', 'type': 'str'}, - 'resource_group_name': {'key': 'properties.resourceGroupName', 'type': 'str'}, - 'resource_name': {'key': 'properties.resourceName', 'type': 'str'}, - 'resource_location': {'key': 'properties.resourceLocation', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'host_platform': {'key': 'properties.hostPlatform', 'type': 'str'}, - 'host_platform_type': {'key': 'properties.hostPlatformType', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ArcAddon, self).__init__(**kwargs) - self.kind = 'ArcForKubernetes' # type: str - self.subscription_id = kwargs['subscription_id'] - self.resource_group_name = kwargs['resource_group_name'] - self.resource_name = kwargs['resource_name'] - self.resource_location = kwargs['resource_location'] - self.version = None - self.host_platform = None - self.host_platform_type = None - self.provisioning_state = None - - -class AsymmetricEncryptedSecret(msrest.serialization.Model): - """Represent the secrets intended for encryption with asymmetric key pair. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The value of the secret. - :type value: str - :param encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the - value is unencrypted, it will be null. - :type encryption_cert_thumbprint: str - :param encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values - include: "None", "AES256", "RSAES_PKCS1_v_1_5". - :type encryption_algorithm: str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.EncryptionAlgorithm - """ - - _validation = { - 'value': {'required': True}, - 'encryption_algorithm': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'encryption_cert_thumbprint': {'key': 'encryptionCertThumbprint', 'type': 'str'}, - 'encryption_algorithm': {'key': 'encryptionAlgorithm', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AsymmetricEncryptedSecret, self).__init__(**kwargs) - self.value = kwargs['value'] - self.encryption_cert_thumbprint = kwargs.get('encryption_cert_thumbprint', None) - self.encryption_algorithm = kwargs['encryption_algorithm'] - - -class Authentication(msrest.serialization.Model): - """Authentication mechanism for IoT devices. - - :param symmetric_key: Symmetric key for authentication. - :type symmetric_key: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SymmetricKey - """ - - _attribute_map = { - 'symmetric_key': {'key': 'symmetricKey', 'type': 'SymmetricKey'}, - } - - def __init__( - self, - **kwargs - ): - super(Authentication, self).__init__(**kwargs) - self.symmetric_key = kwargs.get('symmetric_key', None) - - -class AzureContainerInfo(msrest.serialization.Model): - """Azure container mapping of the endpoint. - - All required parameters must be populated in order to send to Azure. - - :param storage_account_credential_id: Required. ID of the storage account credential used to - access storage. - :type storage_account_credential_id: str - :param container_name: Required. Container name (Based on the data format specified, this - represents the name of Azure Files/Page blob/Block blob). - :type container_name: str - :param data_format: Required. Storage format used for the file represented by the share. - Possible values include: "BlockBlob", "PageBlob", "AzureFile". - :type data_format: str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AzureContainerDataFormat - """ - - _validation = { - 'storage_account_credential_id': {'required': True}, - 'container_name': {'required': True}, - 'data_format': {'required': True}, - } - - _attribute_map = { - 'storage_account_credential_id': {'key': 'storageAccountCredentialId', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'data_format': {'key': 'dataFormat', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureContainerInfo, self).__init__(**kwargs) - self.storage_account_credential_id = kwargs['storage_account_credential_id'] - self.container_name = kwargs['container_name'] - self.data_format = kwargs['data_format'] - - -class BandwidthSchedule(ARMBaseModel): - """The bandwidth schedule details. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar system_data: Bandwidth object related to ASE resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - :param start: Required. The start time of the schedule in UTC. - :type start: str - :param stop: Required. The stop time of the schedule in UTC. - :type stop: str - :param rate_in_mbps: Required. The bandwidth rate in Mbps. - :type rate_in_mbps: int - :param days: Required. The days of the week when this schedule is applicable. - :type days: list[str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.DayOfWeek] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'start': {'required': True}, - 'stop': {'required': True}, - 'rate_in_mbps': {'required': True}, - 'days': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'start': {'key': 'properties.start', 'type': 'str'}, - 'stop': {'key': 'properties.stop', 'type': 'str'}, - 'rate_in_mbps': {'key': 'properties.rateInMbps', 'type': 'int'}, - 'days': {'key': 'properties.days', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(BandwidthSchedule, self).__init__(**kwargs) - self.system_data = None - self.start = kwargs['start'] - self.stop = kwargs['stop'] - self.rate_in_mbps = kwargs['rate_in_mbps'] - self.days = kwargs['days'] - - -class BandwidthSchedulesList(msrest.serialization.Model): - """The collection of bandwidth schedules. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of bandwidth schedules. - :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.BandwidthSchedule] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BandwidthSchedule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BandwidthSchedulesList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ClientAccessRight(msrest.serialization.Model): - """The mapping between a particular client IP and the type of access client has on the NFS share. - - All required parameters must be populated in order to send to Azure. - - :param client: Required. IP of the client. - :type client: str - :param access_permission: Required. Type of access to be allowed for the client. Possible - values include: "NoAccess", "ReadOnly", "ReadWrite". - :type access_permission: str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ClientPermissionType - """ - - _validation = { - 'client': {'required': True}, - 'access_permission': {'required': True}, - } - - _attribute_map = { - 'client': {'key': 'client', 'type': 'str'}, - 'access_permission': {'key': 'accessPermission', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClientAccessRight, self).__init__(**kwargs) - self.client = kwargs['client'] - self.access_permission = kwargs['access_permission'] - - -class Role(ARMBaseModel): - """Compute role. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: CloudEdgeManagementRole, IoTRole, KubernetesRole, MECRole. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", - "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleTypes - :ivar system_data: Role configured on ASE resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - _subtype_map = { - 'kind': {'CloudEdgeManagement': 'CloudEdgeManagementRole', 'IOT': 'IoTRole', 'Kubernetes': 'KubernetesRole', 'MEC': 'MECRole'} - } - - def __init__( - self, - **kwargs - ): - super(Role, self).__init__(**kwargs) - self.kind = 'Role' # type: str - self.system_data = None - - -class CloudEdgeManagementRole(Role): - """CloudEdgeManagementRole role. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", - "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleTypes - :ivar system_data: Role configured on ASE resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - :ivar local_management_status: Local Edge Management Status. Possible values include: - "Enabled", "Disabled". - :vartype local_management_status: str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleStatus - :ivar edge_profile: Edge Profile of the resource. - :vartype edge_profile: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.EdgeProfile - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - 'local_management_status': {'readonly': True}, - 'edge_profile': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'local_management_status': {'key': 'properties.localManagementStatus', 'type': 'str'}, - 'edge_profile': {'key': 'properties.edgeProfile', 'type': 'EdgeProfile'}, - 'role_status': {'key': 'properties.roleStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudEdgeManagementRole, self).__init__(**kwargs) - self.kind = 'CloudEdgeManagement' # type: str - self.local_management_status = None - self.edge_profile = None - self.role_status = kwargs.get('role_status', None) - - -class CloudErrorBody(msrest.serialization.Model): - """An error response from the service. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.CloudErrorBody] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudErrorBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.details = kwargs.get('details', None) - - -class CniConfig(msrest.serialization.Model): - """Cni configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: Cni type. - :vartype type: str - :ivar version: Cni version. - :vartype version: str - :ivar pod_subnet: Pod Subnet. - :vartype pod_subnet: str - :ivar service_subnet: Service subnet. - :vartype service_subnet: str - """ - - _validation = { - 'type': {'readonly': True}, - 'version': {'readonly': True}, - 'pod_subnet': {'readonly': True}, - 'service_subnet': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'pod_subnet': {'key': 'podSubnet', 'type': 'str'}, - 'service_subnet': {'key': 'serviceSubnet', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CniConfig, self).__init__(**kwargs) - self.type = None - self.version = None - self.pod_subnet = None - self.service_subnet = None - - -class ComputeResource(msrest.serialization.Model): - """Compute infrastructure Resource. - - All required parameters must be populated in order to send to Azure. - - :param processor_count: Required. Processor count. - :type processor_count: int - :param memory_in_gb: Required. Memory in GB. - :type memory_in_gb: long - """ - - _validation = { - 'processor_count': {'required': True}, - 'memory_in_gb': {'required': True}, - } - - _attribute_map = { - 'processor_count': {'key': 'processorCount', 'type': 'int'}, - 'memory_in_gb': {'key': 'memoryInGB', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(ComputeResource, self).__init__(**kwargs) - self.processor_count = kwargs['processor_count'] - self.memory_in_gb = kwargs['memory_in_gb'] - - -class ContactDetails(msrest.serialization.Model): - """Contains all the contact details of the customer. - - All required parameters must be populated in order to send to Azure. - - :param contact_person: Required. The contact person name. - :type contact_person: str - :param company_name: Required. The name of the company. - :type company_name: str - :param phone: Required. The phone number. - :type phone: str - :param email_list: Required. The email list. - :type email_list: list[str] - """ - - _validation = { - 'contact_person': {'required': True}, - 'company_name': {'required': True}, - 'phone': {'required': True}, - 'email_list': {'required': True}, - } - - _attribute_map = { - 'contact_person': {'key': 'contactPerson', 'type': 'str'}, - 'company_name': {'key': 'companyName', 'type': 'str'}, - 'phone': {'key': 'phone', 'type': 'str'}, - 'email_list': {'key': 'emailList', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ContactDetails, self).__init__(**kwargs) - self.contact_person = kwargs['contact_person'] - self.company_name = kwargs['company_name'] - self.phone = kwargs['phone'] - self.email_list = kwargs['email_list'] - - -class Container(ARMBaseModel): - """Represents a container on the Data Box Edge/Gateway device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar system_data: Container in DataBoxEdge Resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - :ivar container_status: Current status of the container. Possible values include: "OK", - "Offline", "Unknown", "Updating", "NeedsAttention". - :vartype container_status: str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ContainerStatus - :param data_format: Required. DataFormat for Container. Possible values include: "BlockBlob", - "PageBlob", "AzureFile". - :type data_format: str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AzureContainerDataFormat - :ivar refresh_details: Details of the refresh job on this container. - :vartype refresh_details: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RefreshDetails - :ivar created_date_time: The UTC time when container got created. - :vartype created_date_time: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'container_status': {'readonly': True}, - 'data_format': {'required': True}, - 'refresh_details': {'readonly': True}, - 'created_date_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'container_status': {'key': 'properties.containerStatus', 'type': 'str'}, - 'data_format': {'key': 'properties.dataFormat', 'type': 'str'}, - 'refresh_details': {'key': 'properties.refreshDetails', 'type': 'RefreshDetails'}, - 'created_date_time': {'key': 'properties.createdDateTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(Container, self).__init__(**kwargs) - self.system_data = None - self.container_status = None - self.data_format = kwargs['data_format'] - self.refresh_details = None - self.created_date_time = None - - -class ContainerList(msrest.serialization.Model): - """Collection of all the containers on the Data Box Edge/Gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of containers. - :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Container] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Container]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContainerList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class DataBoxEdgeDevice(ARMBaseModel): - """The Data Box Edge/Gateway device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param location: Required. The location of the device. This is a supported and registered Azure - geographical region (for example, West US, East US, or Southeast Asia). The geographical region - of a device cannot be changed once it is created, but if an identical geographical region is - specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. The list of tags that describe the device. These tags can be used - to view and group this device (across resource groups). - :type tags: dict[str, str] - :param sku: The SKU type. - :type sku: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.Sku - :param etag: The etag for the devices. - :type etag: str - :param identity: Msi identity of the resource. - :type identity: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ResourceIdentity - :ivar kind: The etag for the devices. Possible values include: "AzureDataBoxGateway", - "AzureStackEdge", "AzureStackHub", "AzureModularDataCentre". - :vartype kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeDeviceKind - :ivar system_data: DataBoxEdge Resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - :param data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible - values include: "ReadyToSetup", "Online", "Offline", "NeedsAttention", "Disconnected", - "PartiallyDisconnected", "Maintenance". - :type data_box_edge_device_status: str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeDeviceStatus - :ivar serial_number: The Serial Number of Data Box Edge/Gateway device. - :vartype serial_number: str - :ivar description: The Description of the Data Box Edge/Gateway device. - :vartype description: str - :ivar model_description: The description of the Data Box Edge/Gateway device model. - :vartype model_description: str - :ivar device_type: The type of the Data Box Edge/Gateway device. Possible values include: - "DataBoxEdgeDevice". - :vartype device_type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.DeviceType - :ivar friendly_name: The Data Box Edge/Gateway device name. - :vartype friendly_name: str - :ivar culture: The Data Box Edge/Gateway device culture. - :vartype culture: str - :ivar device_model: The Data Box Edge/Gateway device model. - :vartype device_model: str - :ivar device_software_version: The Data Box Edge/Gateway device software version. - :vartype device_software_version: str - :ivar device_local_capacity: The Data Box Edge/Gateway device local capacity in MB. - :vartype device_local_capacity: long - :ivar time_zone: The Data Box Edge/Gateway device timezone. - :vartype time_zone: str - :ivar device_hcs_version: The device software version number of the device (eg: 1.2.18105.6). - :vartype device_hcs_version: str - :ivar configured_role_types: Type of compute roles configured. - :vartype configured_role_types: list[str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleTypes] - :ivar node_count: The number of nodes in the cluster. - :vartype node_count: int - :ivar resource_move_details: The details of the move operation on this resource. - :vartype resource_move_details: - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ResourceMoveDetails - :ivar edge_profile: The details of Edge Profile for this resource. - :vartype edge_profile: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.EdgeProfile - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'kind': {'readonly': True}, - 'system_data': {'readonly': True}, - 'serial_number': {'readonly': True}, - 'description': {'readonly': True}, - 'model_description': {'readonly': True}, - 'device_type': {'readonly': True}, - 'friendly_name': {'readonly': True}, - 'culture': {'readonly': True}, - 'device_model': {'readonly': True}, - 'device_software_version': {'readonly': True}, - 'device_local_capacity': {'readonly': True}, - 'time_zone': {'readonly': True}, - 'device_hcs_version': {'readonly': True}, - 'configured_role_types': {'readonly': True}, - 'node_count': {'readonly': True}, - 'resource_move_details': {'readonly': True}, - 'edge_profile': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'ResourceIdentity'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'data_box_edge_device_status': {'key': 'properties.dataBoxEdgeDeviceStatus', 'type': 'str'}, - 'serial_number': {'key': 'properties.serialNumber', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'model_description': {'key': 'properties.modelDescription', 'type': 'str'}, - 'device_type': {'key': 'properties.deviceType', 'type': 'str'}, - 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, - 'culture': {'key': 'properties.culture', 'type': 'str'}, - 'device_model': {'key': 'properties.deviceModel', 'type': 'str'}, - 'device_software_version': {'key': 'properties.deviceSoftwareVersion', 'type': 'str'}, - 'device_local_capacity': {'key': 'properties.deviceLocalCapacity', 'type': 'long'}, - 'time_zone': {'key': 'properties.timeZone', 'type': 'str'}, - 'device_hcs_version': {'key': 'properties.deviceHcsVersion', 'type': 'str'}, - 'configured_role_types': {'key': 'properties.configuredRoleTypes', 'type': '[str]'}, - 'node_count': {'key': 'properties.nodeCount', 'type': 'int'}, - 'resource_move_details': {'key': 'properties.resourceMoveDetails', 'type': 'ResourceMoveDetails'}, - 'edge_profile': {'key': 'properties.edgeProfile', 'type': 'EdgeProfile'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeDevice, self).__init__(**kwargs) - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.etag = kwargs.get('etag', None) - self.identity = kwargs.get('identity', None) - self.kind = None - self.system_data = None - self.data_box_edge_device_status = kwargs.get('data_box_edge_device_status', None) - self.serial_number = None - self.description = None - self.model_description = None - self.device_type = None - self.friendly_name = None - self.culture = None - self.device_model = None - self.device_software_version = None - self.device_local_capacity = None - self.time_zone = None - self.device_hcs_version = None - self.configured_role_types = None - self.node_count = None - self.resource_move_details = None - self.edge_profile = None - - -class DataBoxEdgeDeviceExtendedInfo(ARMBaseModel): - """The extended Info of the Data Box Edge/Gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param encryption_key_thumbprint: The digital signature of encrypted certificate. - :type encryption_key_thumbprint: str - :param encryption_key: The public part of the encryption certificate. Client uses this to - encrypt any secret. - :type encryption_key: str - :ivar resource_key: The Resource ID of the Resource. - :vartype resource_key: str - :param client_secret_store_id: The Key Vault ARM Id for client secrets. - :type client_secret_store_id: str - :param client_secret_store_url: The url to access the Client Key Vault. - :type client_secret_store_url: str - :param channel_integrity_key_name: The name of Channel Integrity Key stored in the Client Key - Vault. - :type channel_integrity_key_name: str - :param channel_integrity_key_version: The version of Channel Integrity Key stored in the Client - Key Vault. - :type channel_integrity_key_version: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'resource_key': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'encryption_key_thumbprint': {'key': 'properties.encryptionKeyThumbprint', 'type': 'str'}, - 'encryption_key': {'key': 'properties.encryptionKey', 'type': 'str'}, - 'resource_key': {'key': 'properties.resourceKey', 'type': 'str'}, - 'client_secret_store_id': {'key': 'properties.clientSecretStoreId', 'type': 'str'}, - 'client_secret_store_url': {'key': 'properties.clientSecretStoreUrl', 'type': 'str'}, - 'channel_integrity_key_name': {'key': 'properties.channelIntegrityKeyName', 'type': 'str'}, - 'channel_integrity_key_version': {'key': 'properties.channelIntegrityKeyVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeDeviceExtendedInfo, self).__init__(**kwargs) - self.encryption_key_thumbprint = kwargs.get('encryption_key_thumbprint', None) - self.encryption_key = kwargs.get('encryption_key', None) - self.resource_key = None - self.client_secret_store_id = kwargs.get('client_secret_store_id', None) - self.client_secret_store_url = kwargs.get('client_secret_store_url', None) - self.channel_integrity_key_name = kwargs.get('channel_integrity_key_name', None) - self.channel_integrity_key_version = kwargs.get('channel_integrity_key_version', None) - - -class DataBoxEdgeDeviceExtendedInfoPatch(msrest.serialization.Model): - """The Data Box Edge/Gateway device extended info patch. - - :param client_secret_store_id: The Key Vault ARM Id for client secrets. - :type client_secret_store_id: str - :param client_secret_store_url: The url to access the Client Key Vault. - :type client_secret_store_url: str - :param channel_integrity_key_name: The name for Channel Integrity Key stored in the Client Key - Vault. - :type channel_integrity_key_name: str - :param channel_integrity_key_version: The version of Channel Integrity Key stored in the Client - Key Vault. - :type channel_integrity_key_version: str - """ - - _attribute_map = { - 'client_secret_store_id': {'key': 'clientSecretStoreId', 'type': 'str'}, - 'client_secret_store_url': {'key': 'clientSecretStoreUrl', 'type': 'str'}, - 'channel_integrity_key_name': {'key': 'channelIntegrityKeyName', 'type': 'str'}, - 'channel_integrity_key_version': {'key': 'channelIntegrityKeyVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeDeviceExtendedInfoPatch, self).__init__(**kwargs) - self.client_secret_store_id = kwargs.get('client_secret_store_id', None) - self.client_secret_store_url = kwargs.get('client_secret_store_url', None) - self.channel_integrity_key_name = kwargs.get('channel_integrity_key_name', None) - self.channel_integrity_key_version = kwargs.get('channel_integrity_key_version', None) - - -class DataBoxEdgeDeviceList(msrest.serialization.Model): - """The collection of Data Box Edge/Gateway devices. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of Data Box Edge/Gateway devices. - :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeDevice] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DataBoxEdgeDevice]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeDeviceList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class DataBoxEdgeDevicePatch(msrest.serialization.Model): - """The Data Box Edge/Gateway device patch. - - :param tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. - :type tags: dict[str, str] - :param identity: Msi identity of the resource. - :type identity: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ResourceIdentity - :param edge_profile: Edge Profile property of the Data Box Edge/Gateway device. - :type edge_profile: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.EdgeProfilePatch - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ResourceIdentity'}, - 'edge_profile': {'key': 'properties.edgeProfile', 'type': 'EdgeProfilePatch'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeDevicePatch, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.edge_profile = kwargs.get('edge_profile', None) - - -class DataBoxEdgeMoveRequest(msrest.serialization.Model): - """Resource Move details. - - All required parameters must be populated in order to send to Azure. - - :param target_resource_group: Required. Target resource group ARMId. - :type target_resource_group: str - :param resources: Required. List of resources to be moved. - :type resources: list[str] - """ - - _validation = { - 'target_resource_group': {'required': True}, - 'resources': {'required': True}, - } - - _attribute_map = { - 'target_resource_group': {'key': 'targetResourceGroup', 'type': 'str'}, - 'resources': {'key': 'resources', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeMoveRequest, self).__init__(**kwargs) - self.target_resource_group = kwargs['target_resource_group'] - self.resources = kwargs['resources'] - - -class DataBoxEdgeSku(msrest.serialization.Model): - """The Sku information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar resource_type: The type of the resource. - :vartype resource_type: str - :ivar name: The Sku name. Possible values include: "Gateway", "Edge", "TEA_1Node", - "TEA_1Node_UPS", "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", - "TEA_4Node_UPS_Heater", "TMA", "TDC", "TCA_Small", "GPU", "TCA_Large", "EdgeP_Base", - "EdgeP_High", "EdgePR_Base", "EdgePR_Base_UPS", "EdgeMR_Mini", "RCA_Small", "RCA_Large", "RDC". - :vartype name: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SkuName - :ivar kind: The Sku kind. - :vartype kind: str - :ivar tier: The Sku tier. Possible values include: "Standard". - :vartype tier: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SkuTier - :ivar size: The Sku kind. - :vartype size: str - :ivar family: The Sku family. - :vartype family: str - :ivar locations: Availability of the Sku for the region. - :vartype locations: list[str] - :ivar api_versions: The API versions in which Sku is available. - :vartype api_versions: list[str] - :ivar location_info: Availability of the Sku for the location/zone/site. - :vartype location_info: - list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.SkuLocationInfo] - :ivar costs: The pricing info of the Sku. - :vartype costs: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.SkuCost] - :ivar signup_option: Sku can be signed up by customer or not. Possible values include: "None", - "Available". - :vartype signup_option: str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SkuSignupOption - :ivar version: Availability of the Sku as preview/stable. Possible values include: "Stable", - "Preview". - :vartype version: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SkuVersion - :ivar availability: Links to the next set of results. Possible values include: "Available", - "Unavailable". - :vartype availability: str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SkuAvailability - :ivar shipment_types: List of Shipment Types supported by this SKU. - :vartype shipment_types: list[str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ShipmentType] - """ - - _validation = { - 'resource_type': {'readonly': True}, - 'name': {'readonly': True}, - 'kind': {'readonly': True}, - 'tier': {'readonly': True}, - 'size': {'readonly': True}, - 'family': {'readonly': True}, - 'locations': {'readonly': True}, - 'api_versions': {'readonly': True}, - 'location_info': {'readonly': True}, - 'costs': {'readonly': True}, - 'signup_option': {'readonly': True}, - 'version': {'readonly': True}, - 'availability': {'readonly': True}, - 'shipment_types': {'readonly': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'str'}, - 'family': {'key': 'family', 'type': 'str'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'api_versions': {'key': 'apiVersions', 'type': '[str]'}, - 'location_info': {'key': 'locationInfo', 'type': '[SkuLocationInfo]'}, - 'costs': {'key': 'costs', 'type': '[SkuCost]'}, - 'signup_option': {'key': 'signupOption', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'availability': {'key': 'availability', 'type': 'str'}, - 'shipment_types': {'key': 'shipmentTypes', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeSku, self).__init__(**kwargs) - self.resource_type = None - self.name = None - self.kind = None - self.tier = None - self.size = None - self.family = None - self.locations = None - self.api_versions = None - self.location_info = None - self.costs = None - self.signup_option = None - self.version = None - self.availability = None - self.shipment_types = None - - -class DataBoxEdgeSkuList(msrest.serialization.Model): - """List of SKU Information objects. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of ResourceType Sku. - :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeSku] - :ivar next_link: Links to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DataBoxEdgeSku]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataBoxEdgeSkuList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class DCAccessCode(msrest.serialization.Model): - """DC Access code in the case of Self Managed Shipping. - - :param auth_code: DCAccess Code for the Self Managed shipment. - :type auth_code: str - """ - - _attribute_map = { - 'auth_code': {'key': 'properties.authCode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DCAccessCode, self).__init__(**kwargs) - self.auth_code = kwargs.get('auth_code', None) - - -class EdgeProfile(msrest.serialization.Model): - """Details about Edge Profile for the resource. - - :param subscription: Edge Profile Subscription. - :type subscription: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.EdgeProfileSubscription - """ - - _attribute_map = { - 'subscription': {'key': 'subscription', 'type': 'EdgeProfileSubscription'}, - } - - def __init__( - self, - **kwargs - ): - super(EdgeProfile, self).__init__(**kwargs) - self.subscription = kwargs.get('subscription', None) - - -class EdgeProfilePatch(msrest.serialization.Model): - """The Data Box Edge/Gateway Edge Profile patch. - - :param subscription: The Data Box Edge/Gateway Edge Profile Subscription patch. - :type subscription: - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.EdgeProfileSubscriptionPatch - """ - - _attribute_map = { - 'subscription': {'key': 'subscription', 'type': 'EdgeProfileSubscriptionPatch'}, - } - - def __init__( - self, - **kwargs - ): - super(EdgeProfilePatch, self).__init__(**kwargs) - self.subscription = kwargs.get('subscription', None) - - -class EdgeProfileSubscription(msrest.serialization.Model): - """Subscription details for the Edge Profile. - - :param registration_id: Edge Subscription Registration ID. - :type registration_id: str - :param id: ARM ID of the subscription. - :type id: str - :param state: Possible values include: "Registered", "Warned", "Suspended", "Deleted", - "Unregistered". - :type state: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SubscriptionState - :param registration_date: - :type registration_date: str - :param subscription_id: - :type subscription_id: str - :param tenant_id: - :type tenant_id: str - :param location_placement_id: - :type location_placement_id: str - :param quota_id: - :type quota_id: str - :param serialized_details: - :type serialized_details: str - :param registered_features: - :type registered_features: - list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.SubscriptionRegisteredFeatures] - """ - - _attribute_map = { - 'registration_id': {'key': 'registrationId', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'registration_date': {'key': 'registrationDate', 'type': 'str'}, - 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, - 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, - 'location_placement_id': {'key': 'properties.locationPlacementId', 'type': 'str'}, - 'quota_id': {'key': 'properties.quotaId', 'type': 'str'}, - 'serialized_details': {'key': 'properties.serializedDetails', 'type': 'str'}, - 'registered_features': {'key': 'properties.registeredFeatures', 'type': '[SubscriptionRegisteredFeatures]'}, - } - - def __init__( - self, - **kwargs - ): - super(EdgeProfileSubscription, self).__init__(**kwargs) - self.registration_id = kwargs.get('registration_id', None) - self.id = kwargs.get('id', None) - self.state = kwargs.get('state', None) - self.registration_date = kwargs.get('registration_date', None) - self.subscription_id = kwargs.get('subscription_id', None) - self.tenant_id = kwargs.get('tenant_id', None) - self.location_placement_id = kwargs.get('location_placement_id', None) - self.quota_id = kwargs.get('quota_id', None) - self.serialized_details = kwargs.get('serialized_details', None) - self.registered_features = kwargs.get('registered_features', None) - - -class EdgeProfileSubscriptionPatch(msrest.serialization.Model): - """The Data Box Edge/Gateway Edge Profile Subscription patch. - - :param id: The path ID that uniquely identifies the subscription of the edge profile. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EdgeProfileSubscriptionPatch, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class EtcdInfo(msrest.serialization.Model): - """Etcd configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: Etcd type. - :vartype type: str - :ivar version: Etcd version. - :vartype version: str - """ - - _validation = { - 'type': {'readonly': True}, - 'version': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EtcdInfo, self).__init__(**kwargs) - self.type = None - self.version = None - - -class Trigger(ARMBaseModel): - """Trigger details. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: FileEventTrigger, PeriodicTimerEventTrigger. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar system_data: Trigger in DataBoxEdge Resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: - "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.TriggerEventType - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'kind': {'key': 'kind', 'type': 'str'}, - } - - _subtype_map = { - 'kind': {'FileEvent': 'FileEventTrigger', 'PeriodicTimerEvent': 'PeriodicTimerEventTrigger'} - } - - def __init__( - self, - **kwargs - ): - super(Trigger, self).__init__(**kwargs) - self.system_data = None - self.kind = 'Trigger' # type: str - - -class FileEventTrigger(Trigger): - """Trigger details. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar system_data: Trigger in DataBoxEdge Resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: - "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.TriggerEventType - :param source_info: Required. File event source details. - :type source_info: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.FileSourceInfo - :param sink_info: Required. Role sink info. - :type sink_info: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against - its usage. For example, if a periodic timer trigger is intended for certain specific IoT - modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'kind': {'required': True}, - 'source_info': {'required': True}, - 'sink_info': {'required': True}, - 'custom_context_tag': {'max_length': 192, 'min_length': 0}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'source_info': {'key': 'properties.sourceInfo', 'type': 'FileSourceInfo'}, - 'sink_info': {'key': 'properties.sinkInfo', 'type': 'RoleSinkInfo'}, - 'custom_context_tag': {'key': 'properties.customContextTag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FileEventTrigger, self).__init__(**kwargs) - self.kind = 'FileEvent' # type: str - self.source_info = kwargs['source_info'] - self.sink_info = kwargs['sink_info'] - self.custom_context_tag = kwargs.get('custom_context_tag', None) - - -class FileSourceInfo(msrest.serialization.Model): - """File source details. - - All required parameters must be populated in order to send to Azure. - - :param share_id: Required. File share ID. - :type share_id: str - """ - - _validation = { - 'share_id': {'required': True}, - } - - _attribute_map = { - 'share_id': {'key': 'shareId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FileSourceInfo, self).__init__(**kwargs) - self.share_id = kwargs['share_id'] - - -class GenerateCertResponse(msrest.serialization.Model): - """Used in activation key generation flow. - - :param public_key: Gets or sets base64 encoded certificate raw data, - this is the public part needed to be uploaded to cert vault. - :type public_key: str - :param private_key: Gets or sets base64 encoded private part of the certificate, - needed to form the activation key. - :type private_key: str - :param expiry_time_in_utc: Gets or sets expiry time in UTC. - :type expiry_time_in_utc: str - """ - - _attribute_map = { - 'public_key': {'key': 'publicKey', 'type': 'str'}, - 'private_key': {'key': 'privateKey', 'type': 'str'}, - 'expiry_time_in_utc': {'key': 'expiryTimeInUTC', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GenerateCertResponse, self).__init__(**kwargs) - self.public_key = kwargs.get('public_key', None) - self.private_key = kwargs.get('private_key', None) - self.expiry_time_in_utc = kwargs.get('expiry_time_in_utc', None) - - -class ImageRepositoryCredential(msrest.serialization.Model): - """Image repository credential. - - All required parameters must be populated in order to send to Azure. - - :param image_repository_url: Required. Image repository url (e.g.: mcr.microsoft.com). - :type image_repository_url: str - :param user_name: Required. Repository user name. - :type user_name: str - :param password: Repository user password. - :type password: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AsymmetricEncryptedSecret - """ - - _validation = { - 'image_repository_url': {'required': True}, - 'user_name': {'required': True}, - } - - _attribute_map = { - 'image_repository_url': {'key': 'imageRepositoryUrl', 'type': 'str'}, - 'user_name': {'key': 'userName', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'AsymmetricEncryptedSecret'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageRepositoryCredential, self).__init__(**kwargs) - self.image_repository_url = kwargs['image_repository_url'] - self.user_name = kwargs['user_name'] - self.password = kwargs.get('password', None) - - -class IoTAddon(Addon): - """IoT Addon. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Addon type.Constant filled by server. Possible values include: - "IotEdge", "ArcForKubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AddonType - :ivar system_data: Addon type. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - :param io_t_device_details: Required. IoT device metadata to which appliance needs to be - connected. - :type io_t_device_details: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.IoTDeviceInfo - :param io_t_edge_device_details: Required. IoT edge device to which the IoT Addon needs to be - configured. - :type io_t_edge_device_details: - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.IoTDeviceInfo - :ivar version: Version of IoT running on the appliance. - :vartype version: str - :ivar host_platform: Host OS supported by the IoT addon. Possible values include: "Windows", - "Linux". - :vartype host_platform: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.PlatformType - :ivar host_platform_type: Platform where the runtime is hosted. Possible values include: - "KubernetesCluster", "LinuxVM". - :vartype host_platform_type: str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.HostPlatformType - :ivar provisioning_state: Addon Provisioning State. Possible values include: "Invalid", - "Creating", "Created", "Updating", "Reconfiguring", "Failed", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AddonState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - 'io_t_device_details': {'required': True}, - 'io_t_edge_device_details': {'required': True}, - 'version': {'readonly': True}, - 'host_platform': {'readonly': True}, - 'host_platform_type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'io_t_device_details': {'key': 'properties.ioTDeviceDetails', 'type': 'IoTDeviceInfo'}, - 'io_t_edge_device_details': {'key': 'properties.ioTEdgeDeviceDetails', 'type': 'IoTDeviceInfo'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'host_platform': {'key': 'properties.hostPlatform', 'type': 'str'}, - 'host_platform_type': {'key': 'properties.hostPlatformType', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IoTAddon, self).__init__(**kwargs) - self.kind = 'IotEdge' # type: str - self.io_t_device_details = kwargs['io_t_device_details'] - self.io_t_edge_device_details = kwargs['io_t_edge_device_details'] - self.version = None - self.host_platform = None - self.host_platform_type = None - self.provisioning_state = None - - -class IoTDeviceInfo(msrest.serialization.Model): - """Metadata of IoT device/IoT Edge device to be configured. - - All required parameters must be populated in order to send to Azure. - - :param device_id: Required. ID of the IoT device/edge device. - :type device_id: str - :param io_t_host_hub: Required. Host name for the IoT hub associated to the device. - :type io_t_host_hub: str - :param io_t_host_hub_id: Id for the IoT hub associated to the device. - :type io_t_host_hub_id: str - :param authentication: Encrypted IoT device/IoT edge device connection string. - :type authentication: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.Authentication - """ - - _validation = { - 'device_id': {'required': True}, - 'io_t_host_hub': {'required': True}, - } - - _attribute_map = { - 'device_id': {'key': 'deviceId', 'type': 'str'}, - 'io_t_host_hub': {'key': 'ioTHostHub', 'type': 'str'}, - 'io_t_host_hub_id': {'key': 'ioTHostHubId', 'type': 'str'}, - 'authentication': {'key': 'authentication', 'type': 'Authentication'}, - } - - def __init__( - self, - **kwargs - ): - super(IoTDeviceInfo, self).__init__(**kwargs) - self.device_id = kwargs['device_id'] - self.io_t_host_hub = kwargs['io_t_host_hub'] - self.io_t_host_hub_id = kwargs.get('io_t_host_hub_id', None) - self.authentication = kwargs.get('authentication', None) - - -class IoTEdgeAgentInfo(msrest.serialization.Model): - """IoT edge agent details is optional, this will be used for download system Agent module while bootstrapping IoT Role if specified. - - All required parameters must be populated in order to send to Azure. - - :param image_name: Required. Name of the IoT edge agent image. - :type image_name: str - :param tag: Required. Image Tag. - :type tag: str - :param image_repository: Image repository details. - :type image_repository: - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ImageRepositoryCredential - """ - - _validation = { - 'image_name': {'required': True}, - 'tag': {'required': True}, - } - - _attribute_map = { - 'image_name': {'key': 'imageName', 'type': 'str'}, - 'tag': {'key': 'tag', 'type': 'str'}, - 'image_repository': {'key': 'imageRepository', 'type': 'ImageRepositoryCredential'}, - } - - def __init__( - self, - **kwargs - ): - super(IoTEdgeAgentInfo, self).__init__(**kwargs) - self.image_name = kwargs['image_name'] - self.tag = kwargs['tag'] - self.image_repository = kwargs.get('image_repository', None) - - -class IoTRole(Role): - """Compute role. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", - "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleTypes - :ivar system_data: Role configured on ASE resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - :param host_platform: Host OS supported by the IoT role. Possible values include: "Windows", - "Linux". - :type host_platform: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.PlatformType - :param io_t_device_details: IoT device metadata to which data box edge device needs to be - connected. - :type io_t_device_details: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.IoTDeviceInfo - :param io_t_edge_device_details: IoT edge device to which the IoT role needs to be configured. - :type io_t_edge_device_details: - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.IoTDeviceInfo - :param share_mappings: Mount points of shares in role(s). - :type share_mappings: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MountPointMap] - :param io_t_edge_agent_info: Iot edge agent details to download the agent and bootstrap iot - runtime. - :type io_t_edge_agent_info: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.IoTEdgeAgentInfo - :ivar host_platform_type: Platform where the Iot runtime is hosted. Possible values include: - "KubernetesCluster", "LinuxVM". - :vartype host_platform_type: str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.HostPlatformType - :param compute_resource: Resource allocation. - :type compute_resource: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ComputeResource - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - 'host_platform_type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'host_platform': {'key': 'properties.hostPlatform', 'type': 'str'}, - 'io_t_device_details': {'key': 'properties.ioTDeviceDetails', 'type': 'IoTDeviceInfo'}, - 'io_t_edge_device_details': {'key': 'properties.ioTEdgeDeviceDetails', 'type': 'IoTDeviceInfo'}, - 'share_mappings': {'key': 'properties.shareMappings', 'type': '[MountPointMap]'}, - 'io_t_edge_agent_info': {'key': 'properties.ioTEdgeAgentInfo', 'type': 'IoTEdgeAgentInfo'}, - 'host_platform_type': {'key': 'properties.hostPlatformType', 'type': 'str'}, - 'compute_resource': {'key': 'properties.computeResource', 'type': 'ComputeResource'}, - 'role_status': {'key': 'properties.roleStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IoTRole, self).__init__(**kwargs) - self.kind = 'IOT' # type: str - self.host_platform = kwargs.get('host_platform', None) - self.io_t_device_details = kwargs.get('io_t_device_details', None) - self.io_t_edge_device_details = kwargs.get('io_t_edge_device_details', None) - self.share_mappings = kwargs.get('share_mappings', None) - self.io_t_edge_agent_info = kwargs.get('io_t_edge_agent_info', None) - self.host_platform_type = None - self.compute_resource = kwargs.get('compute_resource', None) - self.role_status = kwargs.get('role_status', None) - - -class Ipv4Config(msrest.serialization.Model): - """Details related to the IPv4 address configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar ip_address: The IPv4 address of the network adapter. - :vartype ip_address: str - :ivar subnet: The IPv4 subnet of the network adapter. - :vartype subnet: str - :ivar gateway: The IPv4 gateway of the network adapter. - :vartype gateway: str - """ - - _validation = { - 'ip_address': {'readonly': True}, - 'subnet': {'readonly': True}, - 'gateway': {'readonly': True}, - } - - _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'subnet': {'key': 'subnet', 'type': 'str'}, - 'gateway': {'key': 'gateway', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Ipv4Config, self).__init__(**kwargs) - self.ip_address = None - self.subnet = None - self.gateway = None - - -class Ipv6Config(msrest.serialization.Model): - """Details related to the IPv6 address configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar ip_address: The IPv6 address of the network adapter. - :vartype ip_address: str - :ivar prefix_length: The IPv6 prefix of the network adapter. - :vartype prefix_length: int - :ivar gateway: The IPv6 gateway of the network adapter. - :vartype gateway: str - """ - - _validation = { - 'ip_address': {'readonly': True}, - 'prefix_length': {'readonly': True}, - 'gateway': {'readonly': True}, - } - - _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'prefix_length': {'key': 'prefixLength', 'type': 'int'}, - 'gateway': {'key': 'gateway', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Ipv6Config, self).__init__(**kwargs) - self.ip_address = None - self.prefix_length = None - self.gateway = None - - -class Job(msrest.serialization.Model): - """A device job. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The name of the object. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar status: The current status of the job. Possible values include: "Invalid", "Running", - "Succeeded", "Failed", "Canceled", "Paused", "Scheduled". - :vartype status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.JobStatus - :ivar start_time: The UTC date and time at which the job started. - :vartype start_time: ~datetime.datetime - :ivar end_time: The UTC date and time at which the job completed. - :vartype end_time: ~datetime.datetime - :ivar percent_complete: The percentage of the job that is complete. - :vartype percent_complete: int - :ivar error: The error details. - :vartype error: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.JobErrorDetails - :ivar job_type: The type of the job. Possible values include: "Invalid", "ScanForUpdates", - "DownloadUpdates", "InstallUpdates", "RefreshShare", "RefreshContainer", "Backup", "Restore", - "TriggerSupportPackage". - :vartype job_type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.JobType - :ivar current_stage: Current stage of the update operation. Possible values include: "Unknown", - "Initial", "ScanStarted", "ScanComplete", "ScanFailed", "DownloadStarted", "DownloadComplete", - "DownloadFailed", "InstallStarted", "InstallComplete", "InstallFailed", "RebootInitiated", - "Success", "Failure", "RescanStarted", "RescanComplete", "RescanFailed". - :vartype current_stage: str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.UpdateOperationStage - :ivar download_progress: The download progress. - :vartype download_progress: - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.UpdateDownloadProgress - :ivar install_progress: The install progress. - :vartype install_progress: - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.UpdateInstallProgress - :ivar total_refresh_errors: Total number of errors encountered during the refresh process. - :vartype total_refresh_errors: int - :ivar error_manifest_file: Local share/remote container relative path to the error manifest - file of the refresh. - :vartype error_manifest_file: str - :ivar refreshed_entity_id: ARM ID of the entity that was refreshed. - :vartype refreshed_entity_id: str - :param folder: If only subfolders need to be refreshed, then the subfolder path inside the - share or container. (The path is empty if there are no subfolders.). - :type folder: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'status': {'readonly': True}, - 'start_time': {'readonly': True}, - 'end_time': {'readonly': True}, - 'percent_complete': {'readonly': True}, - 'error': {'readonly': True}, - 'job_type': {'readonly': True}, - 'current_stage': {'readonly': True}, - 'download_progress': {'readonly': True}, - 'install_progress': {'readonly': True}, - 'total_refresh_errors': {'readonly': True}, - 'error_manifest_file': {'readonly': True}, - 'refreshed_entity_id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'percent_complete': {'key': 'percentComplete', 'type': 'int'}, - 'error': {'key': 'error', 'type': 'JobErrorDetails'}, - 'job_type': {'key': 'properties.jobType', 'type': 'str'}, - 'current_stage': {'key': 'properties.currentStage', 'type': 'str'}, - 'download_progress': {'key': 'properties.downloadProgress', 'type': 'UpdateDownloadProgress'}, - 'install_progress': {'key': 'properties.installProgress', 'type': 'UpdateInstallProgress'}, - 'total_refresh_errors': {'key': 'properties.totalRefreshErrors', 'type': 'int'}, - 'error_manifest_file': {'key': 'properties.errorManifestFile', 'type': 'str'}, - 'refreshed_entity_id': {'key': 'properties.refreshedEntityId', 'type': 'str'}, - 'folder': {'key': 'properties.folder', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Job, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.status = None - self.start_time = None - self.end_time = None - self.percent_complete = None - self.error = None - self.job_type = None - self.current_stage = None - self.download_progress = None - self.install_progress = None - self.total_refresh_errors = None - self.error_manifest_file = None - self.refreshed_entity_id = None - self.folder = kwargs.get('folder', None) - - -class JobErrorDetails(msrest.serialization.Model): - """The job error information containing the list of job errors. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error_details: The error details. - :vartype error_details: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.JobErrorItem] - :ivar code: The code intended for programmatic access. - :vartype code: str - :ivar message: The message that describes the error in detail. - :vartype message: str - """ - - _validation = { - 'error_details': {'readonly': True}, - 'code': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'error_details': {'key': 'errorDetails', 'type': '[JobErrorItem]'}, - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(JobErrorDetails, self).__init__(**kwargs) - self.error_details = None - self.code = None - self.message = None - - -class JobErrorItem(msrest.serialization.Model): - """The job error items. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar recommendations: The recommended actions. - :vartype recommendations: list[str] - :ivar code: The code intended for programmatic access. - :vartype code: str - :ivar message: The message that describes the error in detail. - :vartype message: str - """ - - _validation = { - 'recommendations': {'readonly': True}, - 'code': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'recommendations': {'key': 'recommendations', 'type': '[str]'}, - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(JobErrorItem, self).__init__(**kwargs) - self.recommendations = None - self.code = None - self.message = None - - -class KubernetesClusterInfo(msrest.serialization.Model): - """Kubernetes cluster configuration. - - 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 etcd_info: Etcd configuration. - :vartype etcd_info: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.EtcdInfo - :ivar nodes: Kubernetes cluster nodes. - :vartype nodes: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.NodeInfo] - :param version: Required. Kubernetes cluster version. - :type version: str - """ - - _validation = { - 'etcd_info': {'readonly': True}, - 'nodes': {'readonly': True}, - 'version': {'required': True}, - } - - _attribute_map = { - 'etcd_info': {'key': 'etcdInfo', 'type': 'EtcdInfo'}, - 'nodes': {'key': 'nodes', 'type': '[NodeInfo]'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KubernetesClusterInfo, self).__init__(**kwargs) - self.etcd_info = None - self.nodes = None - self.version = kwargs['version'] - - -class KubernetesIPConfiguration(msrest.serialization.Model): - """Kubernetes node IP configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar port: Port of the Kubernetes node. - :vartype port: str - :param ip_address: IP address of the Kubernetes node. - :type ip_address: str - """ - - _validation = { - 'port': {'readonly': True}, - } - - _attribute_map = { - 'port': {'key': 'port', 'type': 'str'}, - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KubernetesIPConfiguration, self).__init__(**kwargs) - self.port = None - self.ip_address = kwargs.get('ip_address', None) - - -class KubernetesRole(Role): - """Kubernetes role. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", - "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleTypes - :ivar system_data: Role configured on ASE resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - :param host_platform: Host OS supported by the Kubernetes role. Possible values include: - "Windows", "Linux". - :type host_platform: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.PlatformType - :ivar provisioning_state: State of Kubernetes deployment. Possible values include: "Invalid", - "Creating", "Created", "Updating", "Reconfiguring", "Failed", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.KubernetesState - :ivar host_platform_type: Platform where the runtime is hosted. Possible values include: - "KubernetesCluster", "LinuxVM". - :vartype host_platform_type: str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.HostPlatformType - :param kubernetes_cluster_info: Kubernetes cluster configuration. - :type kubernetes_cluster_info: - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.KubernetesClusterInfo - :param kubernetes_role_resources: Kubernetes role resources. - :type kubernetes_role_resources: - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.KubernetesRoleResources - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'host_platform_type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'host_platform': {'key': 'properties.hostPlatform', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'host_platform_type': {'key': 'properties.hostPlatformType', 'type': 'str'}, - 'kubernetes_cluster_info': {'key': 'properties.kubernetesClusterInfo', 'type': 'KubernetesClusterInfo'}, - 'kubernetes_role_resources': {'key': 'properties.kubernetesRoleResources', 'type': 'KubernetesRoleResources'}, - 'role_status': {'key': 'properties.roleStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KubernetesRole, self).__init__(**kwargs) - self.kind = 'Kubernetes' # type: str - self.host_platform = kwargs.get('host_platform', None) - self.provisioning_state = None - self.host_platform_type = None - self.kubernetes_cluster_info = kwargs.get('kubernetes_cluster_info', None) - self.kubernetes_role_resources = kwargs.get('kubernetes_role_resources', None) - self.role_status = kwargs.get('role_status', None) - - -class KubernetesRoleCompute(msrest.serialization.Model): - """Kubernetes role compute 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. - - :param vm_profile: Required. VM profile. - :type vm_profile: str - :ivar memory_in_bytes: Memory in bytes. - :vartype memory_in_bytes: long - :ivar processor_count: Processor count. - :vartype processor_count: int - """ - - _validation = { - 'vm_profile': {'required': True}, - 'memory_in_bytes': {'readonly': True}, - 'processor_count': {'readonly': True}, - } - - _attribute_map = { - 'vm_profile': {'key': 'vmProfile', 'type': 'str'}, - 'memory_in_bytes': {'key': 'memoryInBytes', 'type': 'long'}, - 'processor_count': {'key': 'processorCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(KubernetesRoleCompute, self).__init__(**kwargs) - self.vm_profile = kwargs['vm_profile'] - self.memory_in_bytes = None - self.processor_count = None - - -class KubernetesRoleNetwork(msrest.serialization.Model): - """Kubernetes role network resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cni_config: Cni configuration. - :vartype cni_config: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.CniConfig - :ivar load_balancer_config: Load balancer configuration. - :vartype load_balancer_config: - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.LoadBalancerConfig - """ - - _validation = { - 'cni_config': {'readonly': True}, - 'load_balancer_config': {'readonly': True}, - } - - _attribute_map = { - 'cni_config': {'key': 'cniConfig', 'type': 'CniConfig'}, - 'load_balancer_config': {'key': 'loadBalancerConfig', 'type': 'LoadBalancerConfig'}, - } - - def __init__( - self, - **kwargs - ): - super(KubernetesRoleNetwork, self).__init__(**kwargs) - self.cni_config = None - self.load_balancer_config = None - - -class KubernetesRoleResources(msrest.serialization.Model): - """Kubernetes role resources. - - 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 storage: Kubernetes role storage resource. - :type storage: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.KubernetesRoleStorage - :param compute: Required. Kubernetes role compute resource. - :type compute: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.KubernetesRoleCompute - :ivar network: Kubernetes role network resource. - :vartype network: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.KubernetesRoleNetwork - """ - - _validation = { - 'compute': {'required': True}, - 'network': {'readonly': True}, - } - - _attribute_map = { - 'storage': {'key': 'storage', 'type': 'KubernetesRoleStorage'}, - 'compute': {'key': 'compute', 'type': 'KubernetesRoleCompute'}, - 'network': {'key': 'network', 'type': 'KubernetesRoleNetwork'}, - } - - def __init__( - self, - **kwargs - ): - super(KubernetesRoleResources, self).__init__(**kwargs) - self.storage = kwargs.get('storage', None) - self.compute = kwargs['compute'] - self.network = None - - -class KubernetesRoleStorage(msrest.serialization.Model): - """Kubernetes role storage resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar storage_classes: Kubernetes storage class info. - :vartype storage_classes: - list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.KubernetesRoleStorageClassInfo] - :param endpoints: Mount points of shares in role(s). - :type endpoints: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MountPointMap] - """ - - _validation = { - 'storage_classes': {'readonly': True}, - } - - _attribute_map = { - 'storage_classes': {'key': 'storageClasses', 'type': '[KubernetesRoleStorageClassInfo]'}, - 'endpoints': {'key': 'endpoints', 'type': '[MountPointMap]'}, - } - - def __init__( - self, - **kwargs - ): - super(KubernetesRoleStorage, self).__init__(**kwargs) - self.storage_classes = None - self.endpoints = kwargs.get('endpoints', None) - - -class KubernetesRoleStorageClassInfo(msrest.serialization.Model): - """Kubernetes storage class info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Storage class name. - :vartype name: str - :ivar type: Storage class type. - :vartype type: str - :ivar posix_compliant: If provisioned storage is posix compliant. Possible values include: - "Invalid", "Enabled", "Disabled". - :vartype posix_compliant: str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.PosixComplianceStatus - """ - - _validation = { - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'posix_compliant': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'posix_compliant': {'key': 'posixCompliant', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KubernetesRoleStorageClassInfo, self).__init__(**kwargs) - self.name = None - self.type = None - self.posix_compliant = None - - -class LoadBalancerConfig(msrest.serialization.Model): - """Load balancer configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: Load balancer type. - :vartype type: str - :ivar version: Load balancer version. - :vartype version: str - """ - - _validation = { - 'type': {'readonly': True}, - 'version': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LoadBalancerConfig, self).__init__(**kwargs) - self.type = None - self.version = None - - -class MECRole(Role): - """MEC role. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", - "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleTypes - :ivar system_data: Role configured on ASE resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - :param connection_string: Activation key of the MEC. - :type connection_string: - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AsymmetricEncryptedSecret - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'connection_string': {'key': 'properties.connectionString', 'type': 'AsymmetricEncryptedSecret'}, - 'role_status': {'key': 'properties.roleStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MECRole, self).__init__(**kwargs) - self.kind = 'MEC' # type: str - self.connection_string = kwargs.get('connection_string', None) - self.role_status = kwargs.get('role_status', None) - - -class MetricConfiguration(msrest.serialization.Model): - """Metric configuration. - - All required parameters must be populated in order to send to Azure. - - :param resource_id: Required. The Resource ID on which the metrics should be pushed. - :type resource_id: str - :param mdm_account: The MDM account to which the counters should be pushed. - :type mdm_account: str - :param metric_name_space: The MDM namespace to which the counters should be pushed. This is - required if MDMAccount is specified. - :type metric_name_space: str - :param counter_sets: Required. Host name for the IoT hub associated to the device. - :type counter_sets: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricCounterSet] - """ - - _validation = { - 'resource_id': {'required': True}, - 'counter_sets': {'required': True}, - } - - _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'mdm_account': {'key': 'mdmAccount', 'type': 'str'}, - 'metric_name_space': {'key': 'metricNameSpace', 'type': 'str'}, - 'counter_sets': {'key': 'counterSets', 'type': '[MetricCounterSet]'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricConfiguration, self).__init__(**kwargs) - self.resource_id = kwargs['resource_id'] - self.mdm_account = kwargs.get('mdm_account', None) - self.metric_name_space = kwargs.get('metric_name_space', None) - self.counter_sets = kwargs['counter_sets'] - - -class MetricCounter(msrest.serialization.Model): - """The metric counter. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The counter name. - :type name: str - :param instance: The instance from which counter should be collected. - :type instance: str - :param dimension_filter: The dimension filter. - :type dimension_filter: - list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricDimension] - :param additional_dimensions: The additional dimensions to be added to metric. - :type additional_dimensions: - list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricDimension] - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'instance': {'key': 'instance', 'type': 'str'}, - 'dimension_filter': {'key': 'dimensionFilter', 'type': '[MetricDimension]'}, - 'additional_dimensions': {'key': 'additionalDimensions', 'type': '[MetricDimension]'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricCounter, self).__init__(**kwargs) - self.name = kwargs['name'] - self.instance = kwargs.get('instance', None) - self.dimension_filter = kwargs.get('dimension_filter', None) - self.additional_dimensions = kwargs.get('additional_dimensions', None) - - -class MetricCounterSet(msrest.serialization.Model): - """The metric counter set. - - All required parameters must be populated in order to send to Azure. - - :param counters: Required. The counters that should be collected in this set. - :type counters: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricCounter] - """ - - _validation = { - 'counters': {'required': True}, - } - - _attribute_map = { - 'counters': {'key': 'counters', 'type': '[MetricCounter]'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricCounterSet, self).__init__(**kwargs) - self.counters = kwargs['counters'] - - -class MetricDimension(msrest.serialization.Model): - """The metric dimension. - - All required parameters must be populated in order to send to Azure. - - :param source_type: Required. The dimension type. - :type source_type: str - :param source_name: Required. The dimension value. - :type source_name: str - """ - - _validation = { - 'source_type': {'required': True}, - 'source_name': {'required': True}, - } - - _attribute_map = { - 'source_type': {'key': 'sourceType', 'type': 'str'}, - 'source_name': {'key': 'sourceName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricDimension, self).__init__(**kwargs) - self.source_type = kwargs['source_type'] - self.source_name = kwargs['source_name'] - - -class MetricDimensionV1(msrest.serialization.Model): - """Metric Dimension v1. - - :param name: Name of the metrics dimension. - :type name: str - :param display_name: Display name of the metrics dimension. - :type display_name: str - :param to_be_exported_for_shoebox: To be exported to shoe box. - :type to_be_exported_for_shoebox: bool - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricDimensionV1, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) - - -class MetricSpecificationV1(msrest.serialization.Model): - """Metric specification version 1. - - :param name: Name of the metric. - :type name: str - :param display_name: Display name of the metric. - :type display_name: str - :param display_description: Description of the metric to be displayed. - :type display_description: str - :param unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", - "Seconds", "Milliseconds", "Bytes", "BytesPerSecond", "CountPerSecond". - :type unit: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricUnit - :param aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", - "None", "Average", "Minimum", "Maximum", "Total", "Count". - :type aggregation_type: str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricAggregationType - :param dimensions: Metric dimensions, other than default dimension which is resource. - :type dimensions: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricDimensionV1] - :param fill_gap_with_zero: Set true to fill the gaps with zero. - :type fill_gap_with_zero: bool - :param category: Metric category. Possible values include: "Capacity", "Transaction". - :type category: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricCategory - :param resource_id_dimension_name_override: Resource name override. - :type resource_id_dimension_name_override: str - :param supported_time_grain_types: Support granularity of metrics. - :type supported_time_grain_types: list[str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.TimeGrain] - :param supported_aggregation_types: Support metric aggregation type. - :type supported_aggregation_types: list[str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricAggregationType] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[MetricDimensionV1]'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'category': {'key': 'category', 'type': 'str'}, - 'resource_id_dimension_name_override': {'key': 'resourceIdDimensionNameOverride', 'type': 'str'}, - 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, - 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricSpecificationV1, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.dimensions = kwargs.get('dimensions', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.category = kwargs.get('category', None) - self.resource_id_dimension_name_override = kwargs.get('resource_id_dimension_name_override', None) - self.supported_time_grain_types = kwargs.get('supported_time_grain_types', None) - self.supported_aggregation_types = kwargs.get('supported_aggregation_types', None) - - -class MonitoringMetricConfiguration(ARMBaseModel): - """The metric setting details for the role. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param metric_configurations: Required. The metrics configuration details. - :type metric_configurations: - list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricConfiguration] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'metric_configurations': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'metric_configurations': {'key': 'properties.metricConfigurations', 'type': '[MetricConfiguration]'}, - } - - def __init__( - self, - **kwargs - ): - super(MonitoringMetricConfiguration, self).__init__(**kwargs) - self.metric_configurations = kwargs['metric_configurations'] - - -class MonitoringMetricConfigurationList(msrest.serialization.Model): - """Collection of metric configurations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of metric configurations. - :vartype value: - list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MonitoringMetricConfiguration] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[MonitoringMetricConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MonitoringMetricConfigurationList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class MountPointMap(msrest.serialization.Model): - """The share mount point. - - 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 share_id: Required. ID of the share mounted to the role VM. - :type share_id: str - :ivar role_id: ID of the role to which share is mounted. - :vartype role_id: str - :ivar mount_point: Mount point for the share. - :vartype mount_point: str - :ivar mount_type: Mounting type. Possible values include: "Volume", "HostPath". - :vartype mount_type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.MountType - :ivar role_type: Role type. Possible values include: "IOT", "ASA", "Functions", "Cognitive", - "MEC", "CloudEdgeManagement", "Kubernetes". - :vartype role_type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleTypes - """ - - _validation = { - 'share_id': {'required': True}, - 'role_id': {'readonly': True}, - 'mount_point': {'readonly': True}, - 'mount_type': {'readonly': True}, - 'role_type': {'readonly': True}, - } - - _attribute_map = { - 'share_id': {'key': 'shareId', 'type': 'str'}, - 'role_id': {'key': 'roleId', 'type': 'str'}, - 'mount_point': {'key': 'mountPoint', 'type': 'str'}, - 'mount_type': {'key': 'mountType', 'type': 'str'}, - 'role_type': {'key': 'roleType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MountPointMap, self).__init__(**kwargs) - self.share_id = kwargs['share_id'] - self.role_id = None - self.mount_point = None - self.mount_type = None - self.role_type = None - - -class NetworkAdapter(msrest.serialization.Model): - """Represents the networkAdapter on a device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar adapter_id: Instance ID of network adapter. - :vartype adapter_id: str - :ivar adapter_position: Hardware position of network adapter. - :vartype adapter_position: - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.NetworkAdapterPosition - :ivar index: Logical index of the adapter. - :vartype index: int - :ivar node_id: Node ID of the network adapter. - :vartype node_id: str - :ivar network_adapter_name: Network adapter name. - :vartype network_adapter_name: str - :ivar label: Hardware label for the adapter. - :vartype label: str - :ivar mac_address: MAC address. - :vartype mac_address: str - :ivar link_speed: Link speed. - :vartype link_speed: long - :ivar status: Value indicating whether this adapter is valid. Possible values include: - "Inactive", "Active". - :vartype status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.NetworkAdapterStatus - :param rdma_status: Value indicating whether this adapter is RDMA capable. Possible values - include: "Incapable", "Capable". - :type rdma_status: str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.NetworkAdapterRDMAStatus - :param dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values - include: "Disabled", "Enabled". - :type dhcp_status: str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.NetworkAdapterDHCPStatus - :ivar ipv4_configuration: The IPv4 configuration of the network adapter. - :vartype ipv4_configuration: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.Ipv4Config - :ivar ipv6_configuration: The IPv6 configuration of the network adapter. - :vartype ipv6_configuration: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.Ipv6Config - :ivar ipv6_link_local_address: The IPv6 local address. - :vartype ipv6_link_local_address: str - :ivar dns_servers: The list of DNS Servers of the device. - :vartype dns_servers: list[str] - """ - - _validation = { - 'adapter_id': {'readonly': True}, - 'adapter_position': {'readonly': True}, - 'index': {'readonly': True}, - 'node_id': {'readonly': True}, - 'network_adapter_name': {'readonly': True}, - 'label': {'readonly': True}, - 'mac_address': {'readonly': True}, - 'link_speed': {'readonly': True}, - 'status': {'readonly': True}, - 'ipv4_configuration': {'readonly': True}, - 'ipv6_configuration': {'readonly': True}, - 'ipv6_link_local_address': {'readonly': True}, - 'dns_servers': {'readonly': True}, - } - - _attribute_map = { - 'adapter_id': {'key': 'adapterId', 'type': 'str'}, - 'adapter_position': {'key': 'adapterPosition', 'type': 'NetworkAdapterPosition'}, - 'index': {'key': 'index', 'type': 'int'}, - 'node_id': {'key': 'nodeId', 'type': 'str'}, - 'network_adapter_name': {'key': 'networkAdapterName', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'mac_address': {'key': 'macAddress', 'type': 'str'}, - 'link_speed': {'key': 'linkSpeed', 'type': 'long'}, - 'status': {'key': 'status', 'type': 'str'}, - 'rdma_status': {'key': 'rdmaStatus', 'type': 'str'}, - 'dhcp_status': {'key': 'dhcpStatus', 'type': 'str'}, - 'ipv4_configuration': {'key': 'ipv4Configuration', 'type': 'Ipv4Config'}, - 'ipv6_configuration': {'key': 'ipv6Configuration', 'type': 'Ipv6Config'}, - 'ipv6_link_local_address': {'key': 'ipv6LinkLocalAddress', 'type': 'str'}, - 'dns_servers': {'key': 'dnsServers', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkAdapter, self).__init__(**kwargs) - self.adapter_id = None - self.adapter_position = None - self.index = None - self.node_id = None - self.network_adapter_name = None - self.label = None - self.mac_address = None - self.link_speed = None - self.status = None - self.rdma_status = kwargs.get('rdma_status', None) - self.dhcp_status = kwargs.get('dhcp_status', None) - self.ipv4_configuration = None - self.ipv6_configuration = None - self.ipv6_link_local_address = None - self.dns_servers = None - - -class NetworkAdapterPosition(msrest.serialization.Model): - """The network adapter position. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar network_group: The network group. Possible values include: "None", "NonRDMA", "RDMA". - :vartype network_group: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.NetworkGroup - :ivar port: The port. - :vartype port: int - """ - - _validation = { - 'network_group': {'readonly': True}, - 'port': {'readonly': True}, - } - - _attribute_map = { - 'network_group': {'key': 'networkGroup', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkAdapterPosition, self).__init__(**kwargs) - self.network_group = None - self.port = None - - -class NetworkSettings(ARMBaseModel): - """The network settings of a device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar network_adapters: The network adapter list on the device. - :vartype network_adapters: - list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.NetworkAdapter] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'network_adapters': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'network_adapters': {'key': 'properties.networkAdapters', 'type': '[NetworkAdapter]'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkSettings, self).__init__(**kwargs) - self.network_adapters = None - - -class Node(ARMBaseModel): - """Represents a single node in a Data box Edge/Gateway device -Gateway devices, standalone Edge devices and a single node cluster Edge device will all have 1 node -Multi-node Edge devices will have more than 1 nodes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar node_status: The current status of the individual node. Possible values include: - "Unknown", "Up", "Down", "Rebooting", "ShuttingDown". - :vartype node_status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.NodeStatus - :ivar node_chassis_serial_number: Serial number of the Chassis. - :vartype node_chassis_serial_number: str - :ivar node_serial_number: Serial number of the individual node. - :vartype node_serial_number: str - :ivar node_display_name: Display Name of the individual node. - :vartype node_display_name: str - :ivar node_friendly_software_version: Friendly software version name that is currently - installed on the node. - :vartype node_friendly_software_version: str - :ivar node_hcs_version: HCS version that is currently installed on the node. - :vartype node_hcs_version: str - :ivar node_instance_id: Guid instance id of the node. - :vartype node_instance_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'node_status': {'readonly': True}, - 'node_chassis_serial_number': {'readonly': True}, - 'node_serial_number': {'readonly': True}, - 'node_display_name': {'readonly': True}, - 'node_friendly_software_version': {'readonly': True}, - 'node_hcs_version': {'readonly': True}, - 'node_instance_id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'node_status': {'key': 'properties.nodeStatus', 'type': 'str'}, - 'node_chassis_serial_number': {'key': 'properties.nodeChassisSerialNumber', 'type': 'str'}, - 'node_serial_number': {'key': 'properties.nodeSerialNumber', 'type': 'str'}, - 'node_display_name': {'key': 'properties.nodeDisplayName', 'type': 'str'}, - 'node_friendly_software_version': {'key': 'properties.nodeFriendlySoftwareVersion', 'type': 'str'}, - 'node_hcs_version': {'key': 'properties.nodeHcsVersion', 'type': 'str'}, - 'node_instance_id': {'key': 'properties.nodeInstanceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Node, self).__init__(**kwargs) - self.node_status = None - self.node_chassis_serial_number = None - self.node_serial_number = None - self.node_display_name = None - self.node_friendly_software_version = None - self.node_hcs_version = None - self.node_instance_id = None - - -class NodeInfo(msrest.serialization.Model): - """Kubernetes node info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Node name. - :vartype name: str - :ivar type: Node type - Master/Worker. Possible values include: "Invalid", "Master", "Worker". - :vartype type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.KubernetesNodeType - :param ip_configuration: IP Configuration of the Kubernetes node. - :type ip_configuration: - list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.KubernetesIPConfiguration] - """ - - _validation = { - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'ip_configuration': {'key': 'ipConfiguration', 'type': '[KubernetesIPConfiguration]'}, - } - - def __init__( - self, - **kwargs - ): - super(NodeInfo, self).__init__(**kwargs) - self.name = None - self.type = None - self.ip_configuration = kwargs.get('ip_configuration', None) - - -class NodeList(msrest.serialization.Model): - """Collection of Nodes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of Nodes. - :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Node] - :param next_link: Link to the next set of results. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Node]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NodeList, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class Operation(msrest.serialization.Model): - """Operations. - - :param name: Name of the operation. - :type name: str - :param display: Properties displayed for the operation. - :type display: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.OperationDisplay - :param origin: Origin of the operation. - :type origin: str - :param is_data_action: Indicates whether the operation is a data action. - :type is_data_action: bool - :param service_specification: Service specification. - :type service_specification: - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ServiceSpecification - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.is_data_action = kwargs.get('is_data_action', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplay(msrest.serialization.Model): - """Operation display properties. - - :param provider: Provider name. - :type provider: str - :param resource: The type of resource in which the operation is performed. - :type resource: str - :param operation: Operation to be performed on the resource. - :type operation: str - :param description: Description of the operation to be performed. - :type description: str - """ - - _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 - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationsList(msrest.serialization.Model): - """The list of operations used for the discovery of available provider operations. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The value. - :type value: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Operation] - :param next_link: Link to the next set of results. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationsList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class Order(ARMBaseModel): - """The order details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param contact_information: The contact details. - :type contact_information: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ContactDetails - :param shipping_address: The shipping address. - :type shipping_address: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.Address - :ivar current_status: Current status of the order. - :vartype current_status: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.OrderStatus - :ivar order_history: List of status changes in the order. - :vartype order_history: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.OrderStatus] - :ivar serial_number: Serial number of the device. - :vartype serial_number: str - :ivar delivery_tracking_info: Tracking information for the package delivered to the customer - whether it has an original or a replacement device. - :vartype delivery_tracking_info: - list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.TrackingInfo] - :ivar return_tracking_info: Tracking information for the package returned from the customer - whether it has an original or a replacement device. - :vartype return_tracking_info: - list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.TrackingInfo] - :param shipment_type: ShipmentType of the order. Possible values include: "NotApplicable", - "ShippedToCustomer", "SelfPickup". - :type shipment_type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ShipmentType - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'current_status': {'readonly': True}, - 'order_history': {'readonly': True}, - 'serial_number': {'readonly': True}, - 'delivery_tracking_info': {'readonly': True}, - 'return_tracking_info': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'contact_information': {'key': 'properties.contactInformation', 'type': 'ContactDetails'}, - 'shipping_address': {'key': 'properties.shippingAddress', 'type': 'Address'}, - 'current_status': {'key': 'properties.currentStatus', 'type': 'OrderStatus'}, - 'order_history': {'key': 'properties.orderHistory', 'type': '[OrderStatus]'}, - 'serial_number': {'key': 'properties.serialNumber', 'type': 'str'}, - 'delivery_tracking_info': {'key': 'properties.deliveryTrackingInfo', 'type': '[TrackingInfo]'}, - 'return_tracking_info': {'key': 'properties.returnTrackingInfo', 'type': '[TrackingInfo]'}, - 'shipment_type': {'key': 'properties.shipmentType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Order, self).__init__(**kwargs) - self.contact_information = kwargs.get('contact_information', None) - self.shipping_address = kwargs.get('shipping_address', None) - self.current_status = None - self.order_history = None - self.serial_number = None - self.delivery_tracking_info = None - self.return_tracking_info = None - self.shipment_type = kwargs.get('shipment_type', None) - - -class OrderList(msrest.serialization.Model): - """List of order entities. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of orders. - :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Order] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Order]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OrderList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class OrderStatus(msrest.serialization.Model): - """Represents a single status change. - - 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 status: Required. Status of the order as per the allowed status types. Possible values - include: "Untracked", "AwaitingFulfilment", "AwaitingPreparation", "AwaitingShipment", - "Shipped", "Arriving", "Delivered", "ReplacementRequested", "LostDevice", "Declined", - "ReturnInitiated", "AwaitingReturnShipment", "ShippedBack", "CollectedAtMicrosoft", - "AwaitingPickup", "PickupCompleted", "AwaitingDrop". - :type status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.OrderState - :ivar update_date_time: Time of status update. - :vartype update_date_time: ~datetime.datetime - :param comments: Comments related to this status change. - :type comments: str - :ivar tracking_information: Tracking information related to the state in the ordering flow. - :vartype tracking_information: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.TrackingInfo - :ivar additional_order_details: Dictionary to hold generic information which is not stored - by the already existing properties. - :vartype additional_order_details: dict[str, str] - """ - - _validation = { - 'status': {'required': True}, - 'update_date_time': {'readonly': True}, - 'tracking_information': {'readonly': True}, - 'additional_order_details': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'update_date_time': {'key': 'updateDateTime', 'type': 'iso-8601'}, - 'comments': {'key': 'comments', 'type': 'str'}, - 'tracking_information': {'key': 'trackingInformation', 'type': 'TrackingInfo'}, - 'additional_order_details': {'key': 'additionalOrderDetails', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(OrderStatus, self).__init__(**kwargs) - self.status = kwargs['status'] - self.update_date_time = None - self.comments = kwargs.get('comments', None) - self.tracking_information = None - self.additional_order_details = None - - -class PeriodicTimerEventTrigger(Trigger): - """Trigger details. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar system_data: Trigger in DataBoxEdge Resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: - "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.TriggerEventType - :param source_info: Required. Periodic timer details. - :type source_info: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.PeriodicTimerSourceInfo - :param sink_info: Required. Role Sink information. - :type sink_info: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against - its usage. For example, if a periodic timer trigger is intended for certain specific IoT - modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'kind': {'required': True}, - 'source_info': {'required': True}, - 'sink_info': {'required': True}, - 'custom_context_tag': {'max_length': 192, 'min_length': 0}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'source_info': {'key': 'properties.sourceInfo', 'type': 'PeriodicTimerSourceInfo'}, - 'sink_info': {'key': 'properties.sinkInfo', 'type': 'RoleSinkInfo'}, - 'custom_context_tag': {'key': 'properties.customContextTag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PeriodicTimerEventTrigger, self).__init__(**kwargs) - self.kind = 'PeriodicTimerEvent' # type: str - self.source_info = kwargs['source_info'] - self.sink_info = kwargs['sink_info'] - self.custom_context_tag = kwargs.get('custom_context_tag', None) - - -class PeriodicTimerSourceInfo(msrest.serialization.Model): - """Periodic timer event source. - - All required parameters must be populated in order to send to Azure. - - :param start_time: Required. The time of the day that results in a valid trigger. Schedule is - computed with reference to the time specified upto seconds. If timezone is not specified the - time will considered to be in device timezone. The value will always be returned as UTC time. - :type start_time: ~datetime.datetime - :param schedule: Required. Periodic frequency at which timer event needs to be raised. Supports - daily, hourly, minutes, and seconds. - :type schedule: str - :param topic: Topic where periodic events are published to IoT device. - :type topic: str - """ - - _validation = { - 'start_time': {'required': True}, - 'schedule': {'required': True}, - } - - _attribute_map = { - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'schedule': {'key': 'schedule', 'type': 'str'}, - 'topic': {'key': 'topic', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PeriodicTimerSourceInfo, self).__init__(**kwargs) - self.start_time = kwargs['start_time'] - self.schedule = kwargs['schedule'] - self.topic = kwargs.get('topic', None) - - -class RefreshDetails(msrest.serialization.Model): - """Fields for tracking refresh job on the share or container. - - :param in_progress_refresh_job_id: If a refresh job is currently in progress on this share or - container, this field indicates the ARM resource ID of that job. The field is empty if no job - is in progress. - :type in_progress_refresh_job_id: str - :param last_completed_refresh_job_time_in_utc: Indicates the completed time for the last - refresh job on this particular share or container, if any.This could be a failed job or a - successful job. - :type last_completed_refresh_job_time_in_utc: ~datetime.datetime - :param error_manifest_file: Indicates the relative path of the error xml for the last refresh - job on this particular share or container, if any. This could be a failed job or a successful - job. - :type error_manifest_file: str - :param last_job: Indicates the id of the last refresh job on this particular share or - container,if any. This could be a failed job or a successful job. - :type last_job: str - """ - - _attribute_map = { - 'in_progress_refresh_job_id': {'key': 'inProgressRefreshJobId', 'type': 'str'}, - 'last_completed_refresh_job_time_in_utc': {'key': 'lastCompletedRefreshJobTimeInUTC', 'type': 'iso-8601'}, - 'error_manifest_file': {'key': 'errorManifestFile', 'type': 'str'}, - 'last_job': {'key': 'lastJob', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RefreshDetails, self).__init__(**kwargs) - self.in_progress_refresh_job_id = kwargs.get('in_progress_refresh_job_id', None) - self.last_completed_refresh_job_time_in_utc = kwargs.get('last_completed_refresh_job_time_in_utc', None) - self.error_manifest_file = kwargs.get('error_manifest_file', None) - self.last_job = kwargs.get('last_job', None) - - -class ResourceIdentity(msrest.serialization.Model): - """Msi identity details of the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param type: Identity type. Possible values include: "None", "SystemAssigned", "UserAssigned". - :type type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.MsiIdentityType - :ivar principal_id: Service Principal Id backing the Msi. - :vartype principal_id: str - :ivar tenant_id: Home Tenant Id. - :vartype tenant_id: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceIdentity, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.principal_id = None - self.tenant_id = None - - -class ResourceMoveDetails(msrest.serialization.Model): - """Fields for tracking resource move. - - :param operation_in_progress: Denotes whether move operation is in progress. Possible values - include: "None", "ResourceMoveInProgress", "ResourceMoveFailed". - :type operation_in_progress: str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ResourceMoveStatus - :param operation_in_progress_lock_timeout_in_utc: Denotes the timeout of the operation to - finish. - :type operation_in_progress_lock_timeout_in_utc: ~datetime.datetime - """ - - _attribute_map = { - 'operation_in_progress': {'key': 'operationInProgress', 'type': 'str'}, - 'operation_in_progress_lock_timeout_in_utc': {'key': 'operationInProgressLockTimeoutInUTC', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceMoveDetails, self).__init__(**kwargs) - self.operation_in_progress = kwargs.get('operation_in_progress', None) - self.operation_in_progress_lock_timeout_in_utc = kwargs.get('operation_in_progress_lock_timeout_in_utc', None) - - -class ResourceTypeSku(msrest.serialization.Model): - """Resource type Sku object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar resource_type: The resource type. - :vartype resource_type: str - :ivar skus: The skus. - :vartype skus: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.SkuInformation] - """ - - _validation = { - 'resource_type': {'readonly': True}, - 'skus': {'readonly': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'skus': {'key': 'skus', 'type': '[SkuInformation]'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceTypeSku, self).__init__(**kwargs) - self.resource_type = None - self.skus = None - - -class RoleList(msrest.serialization.Model): - """Collection of all the roles on the Data Box Edge device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The Value. - :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Role] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Role]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RoleList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class RoleSinkInfo(msrest.serialization.Model): - """Compute role against which events will be raised. - - All required parameters must be populated in order to send to Azure. - - :param role_id: Required. Compute role ID. - :type role_id: str - """ - - _validation = { - 'role_id': {'required': True}, - } - - _attribute_map = { - 'role_id': {'key': 'roleId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RoleSinkInfo, self).__init__(**kwargs) - self.role_id = kwargs['role_id'] - - -class SecuritySettings(ARMBaseModel): - """The security settings of a device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param device_admin_password: Required. Device administrator password as an encrypted string - (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual - password should have at least 8 characters that are a combination of uppercase, lowercase, - numeric, and special characters. - :type device_admin_password: - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AsymmetricEncryptedSecret - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'device_admin_password': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'device_admin_password': {'key': 'properties.deviceAdminPassword', 'type': 'AsymmetricEncryptedSecret'}, - } - - def __init__( - self, - **kwargs - ): - super(SecuritySettings, self).__init__(**kwargs) - self.device_admin_password = kwargs['device_admin_password'] - - -class ServiceSpecification(msrest.serialization.Model): - """Service specification. - - :param metric_specifications: Metric specification as defined by shoebox. - :type metric_specifications: - list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricSpecificationV1] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecificationV1]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class Share(ARMBaseModel): - """Represents a share on the Data Box Edge/Gateway device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar system_data: Share on ASE device. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - :param description: Description for the share. - :type description: str - :param share_status: Required. Current status of the share. Possible values include: "Offline", - "Unknown", "OK", "Updating", "NeedsAttention". - :type share_status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ShareStatus - :param monitoring_status: Required. Current monitoring status of the share. Possible values - include: "Enabled", "Disabled". - :type monitoring_status: str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.MonitoringStatus - :param azure_container_info: Azure container mapping for the share. - :type azure_container_info: - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AzureContainerInfo - :param access_protocol: Required. Access protocol to be used by the share. Possible values - include: "SMB", "NFS". - :type access_protocol: str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ShareAccessProtocol - :param user_access_rights: Mapping of users and corresponding access rights on the share - (required for SMB protocol). - :type user_access_rights: - list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.UserAccessRight] - :param client_access_rights: List of IP addresses and corresponding access rights on the - share(required for NFS protocol). - :type client_access_rights: - list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.ClientAccessRight] - :param refresh_details: Details of the refresh job on this share. - :type refresh_details: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RefreshDetails - :ivar share_mappings: Share mount point to the role. - :vartype share_mappings: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MountPointMap] - :param data_policy: Data policy of the share. Possible values include: "Cloud", "Local". - :type data_policy: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataPolicy - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'share_status': {'required': True}, - 'monitoring_status': {'required': True}, - 'access_protocol': {'required': True}, - 'share_mappings': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'share_status': {'key': 'properties.shareStatus', 'type': 'str'}, - 'monitoring_status': {'key': 'properties.monitoringStatus', 'type': 'str'}, - 'azure_container_info': {'key': 'properties.azureContainerInfo', 'type': 'AzureContainerInfo'}, - 'access_protocol': {'key': 'properties.accessProtocol', 'type': 'str'}, - 'user_access_rights': {'key': 'properties.userAccessRights', 'type': '[UserAccessRight]'}, - 'client_access_rights': {'key': 'properties.clientAccessRights', 'type': '[ClientAccessRight]'}, - 'refresh_details': {'key': 'properties.refreshDetails', 'type': 'RefreshDetails'}, - 'share_mappings': {'key': 'properties.shareMappings', 'type': '[MountPointMap]'}, - 'data_policy': {'key': 'properties.dataPolicy', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Share, self).__init__(**kwargs) - self.system_data = None - self.description = kwargs.get('description', None) - self.share_status = kwargs['share_status'] - self.monitoring_status = kwargs['monitoring_status'] - self.azure_container_info = kwargs.get('azure_container_info', None) - self.access_protocol = kwargs['access_protocol'] - self.user_access_rights = kwargs.get('user_access_rights', None) - self.client_access_rights = kwargs.get('client_access_rights', None) - self.refresh_details = kwargs.get('refresh_details', None) - self.share_mappings = None - self.data_policy = kwargs.get('data_policy', None) - - -class ShareAccessRight(msrest.serialization.Model): - """Specifies the mapping between this particular user and the type of access he has on shares on this device. - - All required parameters must be populated in order to send to Azure. - - :param share_id: Required. The share ID. - :type share_id: str - :param access_type: Required. Type of access to be allowed on the share for this user. Possible - values include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ShareAccessType - """ - - _validation = { - 'share_id': {'required': True}, - 'access_type': {'required': True}, - } - - _attribute_map = { - 'share_id': {'key': 'shareId', 'type': 'str'}, - 'access_type': {'key': 'accessType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ShareAccessRight, self).__init__(**kwargs) - self.share_id = kwargs['share_id'] - self.access_type = kwargs['access_type'] - - -class ShareList(msrest.serialization.Model): - """Collection of all the shares on the Data Box Edge/Gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of shares. - :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Share] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Share]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ShareList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class Sku(msrest.serialization.Model): - """The SKU type. - - :param name: SKU name. Possible values include: "Gateway", "Edge", "TEA_1Node", - "TEA_1Node_UPS", "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", - "TEA_4Node_UPS_Heater", "TMA", "TDC", "TCA_Small", "GPU", "TCA_Large", "EdgeP_Base", - "EdgeP_High", "EdgePR_Base", "EdgePR_Base_UPS", "EdgeMR_Mini", "RCA_Small", "RCA_Large", "RDC". - :type name: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SkuName - :param tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard". - :type tier: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SkuTier - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = kwargs.get('tier', None) - - -class SkuCost(msrest.serialization.Model): - """The metadata for retrieving price info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar meter_id: Used for querying price from commerce. - :vartype meter_id: str - :ivar quantity: The cost quantity. - :vartype quantity: long - :ivar extended_unit: The extended unit. - :vartype extended_unit: str - """ - - _validation = { - 'meter_id': {'readonly': True}, - 'quantity': {'readonly': True}, - 'extended_unit': {'readonly': True}, - } - - _attribute_map = { - 'meter_id': {'key': 'meterId', 'type': 'str'}, - 'quantity': {'key': 'quantity', 'type': 'long'}, - 'extended_unit': {'key': 'extendedUnit', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuCost, self).__init__(**kwargs) - self.meter_id = None - self.quantity = None - self.extended_unit = None - - -class SkuInformation(msrest.serialization.Model): - """Sku information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The sku name. - :vartype name: str - :ivar tier: The sku tier. - :vartype tier: str - :ivar kind: The sku kind. - :vartype kind: str - :ivar family: The Sku family. - :vartype family: str - :ivar costs: The pricing info of the Sku. - :vartype costs: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.SkuCost] - :ivar locations: The locations where Sku is available. - :vartype locations: list[str] - :ivar location_info: The locations where Sku is available with zones and sites info. - :vartype location_info: - list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.SkuLocationInfo] - :ivar required_quota_ids: The required quotaIds for the sku to be available. - :vartype required_quota_ids: list[str] - :ivar required_features: The required features for the sku to be available. - :vartype required_features: list[str] - """ - - _validation = { - 'name': {'readonly': True}, - 'tier': {'readonly': True}, - 'kind': {'readonly': True}, - 'family': {'readonly': True}, - 'costs': {'readonly': True}, - 'locations': {'readonly': True}, - 'location_info': {'readonly': True}, - 'required_quota_ids': {'readonly': True}, - 'required_features': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'family': {'key': 'family', 'type': 'str'}, - 'costs': {'key': 'costs', 'type': '[SkuCost]'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'location_info': {'key': 'locationInfo', 'type': '[SkuLocationInfo]'}, - 'required_quota_ids': {'key': 'requiredQuotaIds', 'type': '[str]'}, - 'required_features': {'key': 'requiredFeatures', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuInformation, self).__init__(**kwargs) - self.name = None - self.tier = None - self.kind = None - self.family = None - self.costs = None - self.locations = None - self.location_info = None - self.required_quota_ids = None - self.required_features = None - - -class SkuInformationList(msrest.serialization.Model): - """List of SKU Information objects. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of ResourceTypeSku objects. - :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.ResourceTypeSku] - :ivar next_link: Links to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceTypeSku]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuInformationList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SkuLocationInfo(msrest.serialization.Model): - """The location info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar location: The location. - :vartype location: str - :ivar zones: The zones. - :vartype zones: list[str] - :ivar sites: The sites. - :vartype sites: list[str] - """ - - _validation = { - 'location': {'readonly': True}, - 'zones': {'readonly': True}, - 'sites': {'readonly': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'sites': {'key': 'sites', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuLocationInfo, self).__init__(**kwargs) - self.location = None - self.zones = None - self.sites = None - - -class StorageAccount(ARMBaseModel): - """Represents a Storage Account on the Data Box Edge/Gateway device. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar system_data: StorageAccount object on ASE device. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - :param description: Description for the storage Account. - :type description: str - :param storage_account_status: Current status of the storage account. Possible values include: - "OK", "Offline", "Unknown", "Updating", "NeedsAttention". - :type storage_account_status: str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.StorageAccountStatus - :param data_policy: Required. Data policy of the storage Account. Possible values include: - "Cloud", "Local". - :type data_policy: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataPolicy - :param storage_account_credential_id: Storage Account Credential Id. - :type storage_account_credential_id: str - :ivar blob_endpoint: BlobEndpoint of Storage Account. - :vartype blob_endpoint: str - :ivar container_count: The Container Count. Present only for Storage Accounts with DataPolicy - set to Cloud. - :vartype container_count: int - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'data_policy': {'required': True}, - 'blob_endpoint': {'readonly': True}, - 'container_count': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'storage_account_status': {'key': 'properties.storageAccountStatus', 'type': 'str'}, - 'data_policy': {'key': 'properties.dataPolicy', 'type': 'str'}, - 'storage_account_credential_id': {'key': 'properties.storageAccountCredentialId', 'type': 'str'}, - 'blob_endpoint': {'key': 'properties.blobEndpoint', 'type': 'str'}, - 'container_count': {'key': 'properties.containerCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccount, self).__init__(**kwargs) - self.system_data = None - self.description = kwargs.get('description', None) - self.storage_account_status = kwargs.get('storage_account_status', None) - self.data_policy = kwargs['data_policy'] - self.storage_account_credential_id = kwargs.get('storage_account_credential_id', None) - self.blob_endpoint = None - self.container_count = None - - -class StorageAccountCredential(ARMBaseModel): - """The storage account credential. - - 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 path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar system_data: StorageAccountCredential object. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - :param alias: Required. Alias for the storage account. - :type alias: str - :param user_name: Username for the storage account. - :type user_name: str - :param account_key: Encrypted storage key. - :type account_key: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AsymmetricEncryptedSecret - :param connection_string: Connection string for the storage account. Use this string if - username and account key are not specified. - :type connection_string: str - :param ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible values - include: "Enabled", "Disabled". - :type ssl_status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SSLStatus - :param blob_domain_name: Blob end point for private clouds. - :type blob_domain_name: str - :param account_type: Required. Type of storage accessed on the storage account. Possible values - include: "GeneralPurposeStorage", "BlobStorage". - :type account_type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AccountType - :param storage_account_id: Id of the storage account. - :type storage_account_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'alias': {'required': True}, - 'ssl_status': {'required': True}, - 'account_type': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'alias': {'key': 'properties.alias', 'type': 'str'}, - 'user_name': {'key': 'properties.userName', 'type': 'str'}, - 'account_key': {'key': 'properties.accountKey', 'type': 'AsymmetricEncryptedSecret'}, - 'connection_string': {'key': 'properties.connectionString', 'type': 'str'}, - 'ssl_status': {'key': 'properties.sslStatus', 'type': 'str'}, - 'blob_domain_name': {'key': 'properties.blobDomainName', 'type': 'str'}, - 'account_type': {'key': 'properties.accountType', 'type': 'str'}, - 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCredential, self).__init__(**kwargs) - self.system_data = None - self.alias = kwargs['alias'] - self.user_name = kwargs.get('user_name', None) - self.account_key = kwargs.get('account_key', None) - self.connection_string = kwargs.get('connection_string', None) - self.ssl_status = kwargs['ssl_status'] - self.blob_domain_name = kwargs.get('blob_domain_name', None) - self.account_type = kwargs['account_type'] - self.storage_account_id = kwargs.get('storage_account_id', None) - - -class StorageAccountCredentialList(msrest.serialization.Model): - """The collection of storage account credentials. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The value. - :vartype value: - list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.StorageAccountCredential] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccountCredential]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountCredentialList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class StorageAccountList(msrest.serialization.Model): - """Collection of all the Storage Accounts on the Data Box Edge/Gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of storageAccounts. - :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.StorageAccount] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccount]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccountList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SubscriptionRegisteredFeatures(msrest.serialization.Model): - """SubscriptionRegisteredFeatures. - - :param name: - :type name: str - :param state: - :type state: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SubscriptionRegisteredFeatures, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.state = kwargs.get('state', None) - - -class SymmetricKey(msrest.serialization.Model): - """Symmetric key for authentication. - - :param connection_string: Connection string based on the symmetric key. - :type connection_string: - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AsymmetricEncryptedSecret - """ - - _attribute_map = { - 'connection_string': {'key': 'connectionString', 'type': 'AsymmetricEncryptedSecret'}, - } - - def __init__( - self, - **kwargs - ): - super(SymmetricKey, self).__init__(**kwargs) - self.connection_string = kwargs.get('connection_string', None) - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.CreatedByType - :param last_modified_at: The type of identity that last modified the resource. - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class TrackingInfo(msrest.serialization.Model): - """Tracking courier information. - - :param serial_number: Serial number of the device being tracked. - :type serial_number: str - :param carrier_name: Name of the carrier used in the delivery. - :type carrier_name: str - :param tracking_id: Tracking ID of the shipment. - :type tracking_id: str - :param tracking_url: Tracking URL of the shipment. - :type tracking_url: str - """ - - _attribute_map = { - 'serial_number': {'key': 'serialNumber', 'type': 'str'}, - 'carrier_name': {'key': 'carrierName', 'type': 'str'}, - 'tracking_id': {'key': 'trackingId', 'type': 'str'}, - 'tracking_url': {'key': 'trackingUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackingInfo, self).__init__(**kwargs) - self.serial_number = kwargs.get('serial_number', None) - self.carrier_name = kwargs.get('carrier_name', None) - self.tracking_id = kwargs.get('tracking_id', None) - self.tracking_url = kwargs.get('tracking_url', None) - - -class TriggerList(msrest.serialization.Model): - """Collection of all trigger on the data box edge device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of triggers. - :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Trigger] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Trigger]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TriggerList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class UpdateDownloadProgress(msrest.serialization.Model): - """Details about the download progress of update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar download_phase: The download phase. Possible values include: "Unknown", "Initializing", - "Downloading", "Verifying". - :vartype download_phase: str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.DownloadPhase - :ivar percent_complete: Percentage of completion. - :vartype percent_complete: int - :ivar total_bytes_to_download: Total bytes to download. - :vartype total_bytes_to_download: float - :ivar total_bytes_downloaded: Total bytes downloaded. - :vartype total_bytes_downloaded: float - :ivar number_of_updates_to_download: Number of updates to download. - :vartype number_of_updates_to_download: int - :ivar number_of_updates_downloaded: Number of updates downloaded. - :vartype number_of_updates_downloaded: int - """ - - _validation = { - 'download_phase': {'readonly': True}, - 'percent_complete': {'readonly': True}, - 'total_bytes_to_download': {'readonly': True}, - 'total_bytes_downloaded': {'readonly': True}, - 'number_of_updates_to_download': {'readonly': True}, - 'number_of_updates_downloaded': {'readonly': True}, - } - - _attribute_map = { - 'download_phase': {'key': 'downloadPhase', 'type': 'str'}, - 'percent_complete': {'key': 'percentComplete', 'type': 'int'}, - 'total_bytes_to_download': {'key': 'totalBytesToDownload', 'type': 'float'}, - 'total_bytes_downloaded': {'key': 'totalBytesDownloaded', 'type': 'float'}, - 'number_of_updates_to_download': {'key': 'numberOfUpdatesToDownload', 'type': 'int'}, - 'number_of_updates_downloaded': {'key': 'numberOfUpdatesDownloaded', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateDownloadProgress, self).__init__(**kwargs) - self.download_phase = None - self.percent_complete = None - self.total_bytes_to_download = None - self.total_bytes_downloaded = None - self.number_of_updates_to_download = None - self.number_of_updates_downloaded = None - - -class UpdateInstallProgress(msrest.serialization.Model): - """Progress details during installation of updates. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar percent_complete: Percentage completed. - :vartype percent_complete: int - :ivar number_of_updates_to_install: Number of updates to install. - :vartype number_of_updates_to_install: int - :ivar number_of_updates_installed: Number of updates installed. - :vartype number_of_updates_installed: int - """ - - _validation = { - 'percent_complete': {'readonly': True}, - 'number_of_updates_to_install': {'readonly': True}, - 'number_of_updates_installed': {'readonly': True}, - } - - _attribute_map = { - 'percent_complete': {'key': 'percentComplete', 'type': 'int'}, - 'number_of_updates_to_install': {'key': 'numberOfUpdatesToInstall', 'type': 'int'}, - 'number_of_updates_installed': {'key': 'numberOfUpdatesInstalled', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateInstallProgress, self).__init__(**kwargs) - self.percent_complete = None - self.number_of_updates_to_install = None - self.number_of_updates_installed = None - - -class UpdateSummary(ARMBaseModel): - """Details about ongoing updates and availability of updates on the device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :param device_version_number: The current version of the device in format: 1.2.17312.13.",. - :type device_version_number: str - :param friendly_device_version_name: The current version of the device in text format. - :type friendly_device_version_name: str - :param device_last_scanned_date_time: The last time when a scan was done on the device. - :type device_last_scanned_date_time: ~datetime.datetime - :param last_completed_scan_job_date_time: The time when the last scan job was completed - (success/cancelled/failed) on the appliance. - :type last_completed_scan_job_date_time: ~datetime.datetime - :ivar last_completed_download_job_date_time: The time when the last Download job was completed - (success/cancelled/failed) on the appliance. - :vartype last_completed_download_job_date_time: ~datetime.datetime - :ivar last_completed_install_job_date_time: The time when the last Install job was completed - (success/cancelled/failed) on the appliance. - :vartype last_completed_install_job_date_time: ~datetime.datetime - :ivar total_number_of_updates_available: The number of updates available for the current device - version as per the last device scan. - :vartype total_number_of_updates_available: int - :ivar total_number_of_updates_pending_download: The total number of items pending download. - :vartype total_number_of_updates_pending_download: int - :ivar total_number_of_updates_pending_install: The total number of items pending install. - :vartype total_number_of_updates_pending_install: int - :ivar reboot_behavior: Indicates if updates are available and at least one of the updates needs - a reboot. Possible values include: "NeverReboots", "RequiresReboot", "RequestReboot". - :vartype reboot_behavior: str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.InstallRebootBehavior - :ivar ongoing_update_operation: The current update operation. Possible values include: "None", - "Scan", "Download", "Install". - :vartype ongoing_update_operation: str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.UpdateOperation - :ivar in_progress_download_job_id: The job ID of the download job in progress. - :vartype in_progress_download_job_id: str - :ivar in_progress_install_job_id: The job ID of the install job in progress. - :vartype in_progress_install_job_id: str - :ivar in_progress_download_job_started_date_time: The time when the currently running download - (if any) started. - :vartype in_progress_download_job_started_date_time: ~datetime.datetime - :ivar in_progress_install_job_started_date_time: The time when the currently running install - (if any) started. - :vartype in_progress_install_job_started_date_time: ~datetime.datetime - :ivar update_titles: The list of updates available for install. - :vartype update_titles: list[str] - :ivar total_update_size_in_bytes: The total size of updates available for download in bytes. - :vartype total_update_size_in_bytes: float - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'last_completed_download_job_date_time': {'readonly': True}, - 'last_completed_install_job_date_time': {'readonly': True}, - 'total_number_of_updates_available': {'readonly': True}, - 'total_number_of_updates_pending_download': {'readonly': True}, - 'total_number_of_updates_pending_install': {'readonly': True}, - 'reboot_behavior': {'readonly': True}, - 'ongoing_update_operation': {'readonly': True}, - 'in_progress_download_job_id': {'readonly': True}, - 'in_progress_install_job_id': {'readonly': True}, - 'in_progress_download_job_started_date_time': {'readonly': True}, - 'in_progress_install_job_started_date_time': {'readonly': True}, - 'update_titles': {'readonly': True}, - 'total_update_size_in_bytes': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'device_version_number': {'key': 'properties.deviceVersionNumber', 'type': 'str'}, - 'friendly_device_version_name': {'key': 'properties.friendlyDeviceVersionName', 'type': 'str'}, - 'device_last_scanned_date_time': {'key': 'properties.deviceLastScannedDateTime', 'type': 'iso-8601'}, - 'last_completed_scan_job_date_time': {'key': 'properties.lastCompletedScanJobDateTime', 'type': 'iso-8601'}, - 'last_completed_download_job_date_time': {'key': 'properties.lastCompletedDownloadJobDateTime', 'type': 'iso-8601'}, - 'last_completed_install_job_date_time': {'key': 'properties.lastCompletedInstallJobDateTime', 'type': 'iso-8601'}, - 'total_number_of_updates_available': {'key': 'properties.totalNumberOfUpdatesAvailable', 'type': 'int'}, - 'total_number_of_updates_pending_download': {'key': 'properties.totalNumberOfUpdatesPendingDownload', 'type': 'int'}, - 'total_number_of_updates_pending_install': {'key': 'properties.totalNumberOfUpdatesPendingInstall', 'type': 'int'}, - 'reboot_behavior': {'key': 'properties.rebootBehavior', 'type': 'str'}, - 'ongoing_update_operation': {'key': 'properties.ongoingUpdateOperation', 'type': 'str'}, - 'in_progress_download_job_id': {'key': 'properties.inProgressDownloadJobId', 'type': 'str'}, - 'in_progress_install_job_id': {'key': 'properties.inProgressInstallJobId', 'type': 'str'}, - 'in_progress_download_job_started_date_time': {'key': 'properties.inProgressDownloadJobStartedDateTime', 'type': 'iso-8601'}, - 'in_progress_install_job_started_date_time': {'key': 'properties.inProgressInstallJobStartedDateTime', 'type': 'iso-8601'}, - 'update_titles': {'key': 'properties.updateTitles', 'type': '[str]'}, - 'total_update_size_in_bytes': {'key': 'properties.totalUpdateSizeInBytes', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateSummary, self).__init__(**kwargs) - self.device_version_number = kwargs.get('device_version_number', None) - self.friendly_device_version_name = kwargs.get('friendly_device_version_name', None) - self.device_last_scanned_date_time = kwargs.get('device_last_scanned_date_time', None) - self.last_completed_scan_job_date_time = kwargs.get('last_completed_scan_job_date_time', None) - self.last_completed_download_job_date_time = None - self.last_completed_install_job_date_time = None - self.total_number_of_updates_available = None - self.total_number_of_updates_pending_download = None - self.total_number_of_updates_pending_install = None - self.reboot_behavior = None - self.ongoing_update_operation = None - self.in_progress_download_job_id = None - self.in_progress_install_job_id = None - self.in_progress_download_job_started_date_time = None - self.in_progress_install_job_started_date_time = None - self.update_titles = None - self.total_update_size_in_bytes = None - - -class UploadCertificateRequest(msrest.serialization.Model): - """The upload certificate request. - - All required parameters must be populated in order to send to Azure. - - :param authentication_type: The authentication type. Possible values include: "Invalid", - "AzureActiveDirectory". - :type authentication_type: str or - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AuthenticationType - :param certificate: Required. The base64 encoded certificate raw data. - :type certificate: str - """ - - _validation = { - 'certificate': {'required': True}, - } - - _attribute_map = { - 'authentication_type': {'key': 'properties.authenticationType', 'type': 'str'}, - 'certificate': {'key': 'properties.certificate', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UploadCertificateRequest, self).__init__(**kwargs) - self.authentication_type = kwargs.get('authentication_type', None) - self.certificate = kwargs['certificate'] - - -class UploadCertificateResponse(msrest.serialization.Model): - """The upload registration certificate response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param auth_type: Specifies authentication type. Possible values include: "Invalid", - "AzureActiveDirectory". - :type auth_type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AuthenticationType - :ivar resource_id: The resource ID of the Data Box Edge/Gateway device. - :vartype resource_id: str - :ivar aad_authority: Azure Active Directory tenant authority. - :vartype aad_authority: str - :ivar aad_tenant_id: Azure Active Directory tenant ID. - :vartype aad_tenant_id: str - :ivar service_principal_client_id: Azure Active Directory service principal client ID. - :vartype service_principal_client_id: str - :ivar service_principal_object_id: Azure Active Directory service principal object ID. - :vartype service_principal_object_id: str - :ivar azure_management_endpoint_audience: The azure management endpoint audience. - :vartype azure_management_endpoint_audience: str - :ivar aad_audience: Identifier of the target resource that is the recipient of the requested - token. - :vartype aad_audience: str - """ - - _validation = { - 'resource_id': {'readonly': True}, - 'aad_authority': {'readonly': True}, - 'aad_tenant_id': {'readonly': True}, - 'service_principal_client_id': {'readonly': True}, - 'service_principal_object_id': {'readonly': True}, - 'azure_management_endpoint_audience': {'readonly': True}, - 'aad_audience': {'readonly': True}, - } - - _attribute_map = { - 'auth_type': {'key': 'authType', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'aad_authority': {'key': 'aadAuthority', 'type': 'str'}, - 'aad_tenant_id': {'key': 'aadTenantId', 'type': 'str'}, - 'service_principal_client_id': {'key': 'servicePrincipalClientId', 'type': 'str'}, - 'service_principal_object_id': {'key': 'servicePrincipalObjectId', 'type': 'str'}, - 'azure_management_endpoint_audience': {'key': 'azureManagementEndpointAudience', 'type': 'str'}, - 'aad_audience': {'key': 'aadAudience', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UploadCertificateResponse, self).__init__(**kwargs) - self.auth_type = kwargs.get('auth_type', None) - self.resource_id = None - self.aad_authority = None - self.aad_tenant_id = None - self.service_principal_client_id = None - self.service_principal_object_id = None - self.azure_management_endpoint_audience = None - self.aad_audience = None - - -class User(ARMBaseModel): - """Represents a user who has access to one or more shares on the Data Box Edge/Gateway device. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The path ID that uniquely identifies the object. - :vartype id: str - :ivar name: The object name. - :vartype name: str - :ivar type: The hierarchical type of the object. - :vartype type: str - :ivar system_data: User in DataBoxEdge Resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - :param encrypted_password: The password details. - :type encrypted_password: - ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AsymmetricEncryptedSecret - :ivar share_access_rights: List of shares that the user has rights on. This field should not be - specified during user creation. - :vartype share_access_rights: - list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.ShareAccessRight] - :param user_type: Type of the user. Possible values include: "Share", "LocalManagement", "ARM". - :type user_type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.UserType - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'share_access_rights': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'encrypted_password': {'key': 'properties.encryptedPassword', 'type': 'AsymmetricEncryptedSecret'}, - 'share_access_rights': {'key': 'properties.shareAccessRights', 'type': '[ShareAccessRight]'}, - 'user_type': {'key': 'properties.userType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(User, self).__init__(**kwargs) - self.system_data = None - self.encrypted_password = kwargs.get('encrypted_password', None) - self.share_access_rights = None - self.user_type = kwargs.get('user_type', None) - - -class UserAccessRight(msrest.serialization.Model): - """The mapping between a particular user and the access type on the SMB share. - - All required parameters must be populated in order to send to Azure. - - :param user_id: Required. User ID (already existing in the device). - :type user_id: str - :param access_type: Required. Type of access to be allowed for the user. Possible values - include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ShareAccessType - """ - - _validation = { - 'user_id': {'required': True}, - 'access_type': {'required': True}, - } - - _attribute_map = { - 'user_id': {'key': 'userId', 'type': 'str'}, - 'access_type': {'key': 'accessType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserAccessRight, self).__init__(**kwargs) - self.user_id = kwargs['user_id'] - self.access_type = kwargs['access_type'] - - -class UserList(msrest.serialization.Model): - """Collection of users. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of users. - :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.User] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[User]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserList, self).__init__(**kwargs) - self.value = None - self.next_link = None diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/models/_models_py3.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/models/_models_py3.py index 3ee92825fd2d..0c32786ed87a 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/models/_models_py3.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/models/_models_py3.py @@ -43,6 +43,8 @@ def __init__( self, **kwargs ): + """ + """ super(ARMBaseModel, self).__init__(**kwargs) self.id = None self.name = None @@ -65,9 +67,9 @@ class Addon(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Addon type.Constant filled by server. Possible values include: - "IotEdge", "ArcForKubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AddonType + :ivar kind: Required. Addon type.Constant filled by server. Possible values include: "IotEdge", + "ArcForKubernetes". + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AddonType :ivar system_data: Addon type. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData """ @@ -96,6 +98,8 @@ def __init__( self, **kwargs ): + """ + """ super(Addon, self).__init__(**kwargs) self.kind = 'Addon' # type: str self.system_data = None @@ -126,6 +130,8 @@ def __init__( self, **kwargs ): + """ + """ super(AddonList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -136,20 +142,20 @@ class Address(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param address_line1: The address line1. - :type address_line1: str - :param address_line2: The address line2. - :type address_line2: str - :param address_line3: The address line3. - :type address_line3: str - :param postal_code: The postal code. - :type postal_code: str - :param city: The city name. - :type city: str - :param state: The state name. - :type state: str - :param country: Required. The country name. - :type country: str + :ivar address_line1: The address line1. + :vartype address_line1: str + :ivar address_line2: The address line2. + :vartype address_line2: str + :ivar address_line3: The address line3. + :vartype address_line3: str + :ivar postal_code: The postal code. + :vartype postal_code: str + :ivar city: The city name. + :vartype city: str + :ivar state: The state name. + :vartype state: str + :ivar country: Required. The country name. + :vartype country: str """ _validation = { @@ -178,6 +184,22 @@ def __init__( state: Optional[str] = None, **kwargs ): + """ + :keyword address_line1: The address line1. + :paramtype address_line1: str + :keyword address_line2: The address line2. + :paramtype address_line2: str + :keyword address_line3: The address line3. + :paramtype address_line3: str + :keyword postal_code: The postal code. + :paramtype postal_code: str + :keyword city: The city name. + :paramtype city: str + :keyword state: The state name. + :paramtype state: str + :keyword country: Required. The country name. + :paramtype country: str + """ super(Address, self).__init__(**kwargs) self.address_line1 = address_line1 self.address_line2 = address_line2 @@ -250,6 +272,8 @@ def __init__( self, **kwargs ): + """ + """ super(Alert, self).__init__(**kwargs) self.system_data = None self.title = None @@ -290,6 +314,8 @@ def __init__( self, **kwargs ): + """ + """ super(AlertErrorDetails, self).__init__(**kwargs) self.error_code = None self.error_message = None @@ -321,6 +347,8 @@ def __init__( self, **kwargs ): + """ + """ super(AlertList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -339,19 +367,19 @@ class ArcAddon(Addon): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Addon type.Constant filled by server. Possible values include: - "IotEdge", "ArcForKubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AddonType + :ivar kind: Required. Addon type.Constant filled by server. Possible values include: "IotEdge", + "ArcForKubernetes". + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AddonType :ivar system_data: Addon type. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - :param subscription_id: Required. Arc resource subscription Id. - :type subscription_id: str - :param resource_group_name: Required. Arc resource group name. - :type resource_group_name: str - :param resource_name: Required. Arc resource Name. - :type resource_name: str - :param resource_location: Required. Arc resource location. - :type resource_location: str + :ivar subscription_id: Required. Arc resource subscription Id. + :vartype subscription_id: str + :ivar resource_group_name: Required. Arc resource group name. + :vartype resource_group_name: str + :ivar resource_name: Required. Arc resource Name. + :vartype resource_name: str + :ivar resource_location: Required. Arc resource location. + :vartype resource_location: str :ivar version: Arc resource version. :vartype version: str :ivar host_platform: Host OS supported by the Arc addon. Possible values include: "Windows", @@ -408,6 +436,16 @@ def __init__( resource_location: str, **kwargs ): + """ + :keyword subscription_id: Required. Arc resource subscription Id. + :paramtype subscription_id: str + :keyword resource_group_name: Required. Arc resource group name. + :paramtype resource_group_name: str + :keyword resource_name: Required. Arc resource Name. + :paramtype resource_name: str + :keyword resource_location: Required. Arc resource location. + :paramtype resource_location: str + """ super(ArcAddon, self).__init__(**kwargs) self.kind = 'ArcForKubernetes' # type: str self.subscription_id = subscription_id @@ -425,14 +463,14 @@ class AsymmetricEncryptedSecret(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The value of the secret. - :type value: str - :param encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the + :ivar value: Required. The value of the secret. + :vartype value: str + :ivar encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the value is unencrypted, it will be null. - :type encryption_cert_thumbprint: str - :param encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values + :vartype encryption_cert_thumbprint: str + :ivar encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values include: "None", "AES256", "RSAES_PKCS1_v_1_5". - :type encryption_algorithm: str or + :vartype encryption_algorithm: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.EncryptionAlgorithm """ @@ -455,6 +493,17 @@ def __init__( encryption_cert_thumbprint: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The value of the secret. + :paramtype value: str + :keyword encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the + value is unencrypted, it will be null. + :paramtype encryption_cert_thumbprint: str + :keyword encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values + include: "None", "AES256", "RSAES_PKCS1_v_1_5". + :paramtype encryption_algorithm: str or + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.EncryptionAlgorithm + """ super(AsymmetricEncryptedSecret, self).__init__(**kwargs) self.value = value self.encryption_cert_thumbprint = encryption_cert_thumbprint @@ -464,8 +513,8 @@ def __init__( class Authentication(msrest.serialization.Model): """Authentication mechanism for IoT devices. - :param symmetric_key: Symmetric key for authentication. - :type symmetric_key: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SymmetricKey + :ivar symmetric_key: Symmetric key for authentication. + :vartype symmetric_key: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SymmetricKey """ _attribute_map = { @@ -478,6 +527,10 @@ def __init__( symmetric_key: Optional["SymmetricKey"] = None, **kwargs ): + """ + :keyword symmetric_key: Symmetric key for authentication. + :paramtype symmetric_key: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SymmetricKey + """ super(Authentication, self).__init__(**kwargs) self.symmetric_key = symmetric_key @@ -487,15 +540,15 @@ class AzureContainerInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param storage_account_credential_id: Required. ID of the storage account credential used to + :ivar storage_account_credential_id: Required. ID of the storage account credential used to access storage. - :type storage_account_credential_id: str - :param container_name: Required. Container name (Based on the data format specified, this + :vartype storage_account_credential_id: str + :ivar container_name: Required. Container name (Based on the data format specified, this represents the name of Azure Files/Page blob/Block blob). - :type container_name: str - :param data_format: Required. Storage format used for the file represented by the share. + :vartype container_name: str + :ivar data_format: Required. Storage format used for the file represented by the share. Possible values include: "BlockBlob", "PageBlob", "AzureFile". - :type data_format: str or + :vartype data_format: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AzureContainerDataFormat """ @@ -519,6 +572,18 @@ def __init__( data_format: Union[str, "AzureContainerDataFormat"], **kwargs ): + """ + :keyword storage_account_credential_id: Required. ID of the storage account credential used to + access storage. + :paramtype storage_account_credential_id: str + :keyword container_name: Required. Container name (Based on the data format specified, this + represents the name of Azure Files/Page blob/Block blob). + :paramtype container_name: str + :keyword data_format: Required. Storage format used for the file represented by the share. + Possible values include: "BlockBlob", "PageBlob", "AzureFile". + :paramtype data_format: str or + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AzureContainerDataFormat + """ super(AzureContainerInfo, self).__init__(**kwargs) self.storage_account_credential_id = storage_account_credential_id self.container_name = container_name @@ -540,14 +605,14 @@ class BandwidthSchedule(ARMBaseModel): :vartype type: str :ivar system_data: Bandwidth object related to ASE resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - :param start: Required. The start time of the schedule in UTC. - :type start: str - :param stop: Required. The stop time of the schedule in UTC. - :type stop: str - :param rate_in_mbps: Required. The bandwidth rate in Mbps. - :type rate_in_mbps: int - :param days: Required. The days of the week when this schedule is applicable. - :type days: list[str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.DayOfWeek] + :ivar start: Required. The start time of the schedule in UTC. + :vartype start: str + :ivar stop: Required. The stop time of the schedule in UTC. + :vartype stop: str + :ivar rate_in_mbps: Required. The bandwidth rate in Mbps. + :vartype rate_in_mbps: int + :ivar days: Required. The days of the week when this schedule is applicable. + :vartype days: list[str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.DayOfWeek] """ _validation = { @@ -581,6 +646,16 @@ def __init__( days: List[Union[str, "DayOfWeek"]], **kwargs ): + """ + :keyword start: Required. The start time of the schedule in UTC. + :paramtype start: str + :keyword stop: Required. The stop time of the schedule in UTC. + :paramtype stop: str + :keyword rate_in_mbps: Required. The bandwidth rate in Mbps. + :paramtype rate_in_mbps: int + :keyword days: Required. The days of the week when this schedule is applicable. + :paramtype days: list[str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.DayOfWeek] + """ super(BandwidthSchedule, self).__init__(**kwargs) self.system_data = None self.start = start @@ -614,6 +689,8 @@ def __init__( self, **kwargs ): + """ + """ super(BandwidthSchedulesList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -624,11 +701,11 @@ class ClientAccessRight(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param client: Required. IP of the client. - :type client: str - :param access_permission: Required. Type of access to be allowed for the client. Possible - values include: "NoAccess", "ReadOnly", "ReadWrite". - :type access_permission: str or + :ivar client: Required. IP of the client. + :vartype client: str + :ivar access_permission: Required. Type of access to be allowed for the client. Possible values + include: "NoAccess", "ReadOnly", "ReadWrite". + :vartype access_permission: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ClientPermissionType """ @@ -649,6 +726,14 @@ def __init__( access_permission: Union[str, "ClientPermissionType"], **kwargs ): + """ + :keyword client: Required. IP of the client. + :paramtype client: str + :keyword access_permission: Required. Type of access to be allowed for the client. Possible + values include: "NoAccess", "ReadOnly", "ReadWrite". + :paramtype access_permission: str or + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ClientPermissionType + """ super(ClientAccessRight, self).__init__(**kwargs) self.client = client self.access_permission = access_permission @@ -670,9 +755,9 @@ class Role(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleTypes + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleTypes :ivar system_data: Role configured on ASE resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData """ @@ -701,6 +786,8 @@ def __init__( self, **kwargs ): + """ + """ super(Role, self).__init__(**kwargs) self.kind = 'Role' # type: str self.system_data = None @@ -719,9 +806,9 @@ class CloudEdgeManagementRole(Role): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleTypes + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleTypes :ivar system_data: Role configured on ASE resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData :ivar local_management_status: Local Edge Management Status. Possible values include: @@ -730,8 +817,8 @@ class CloudEdgeManagementRole(Role): ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleStatus :ivar edge_profile: Edge Profile of the resource. :vartype edge_profile: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.EdgeProfile - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleStatus + :ivar role_status: Role status. Possible values include: "Enabled", "Disabled". + :vartype role_status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleStatus """ _validation = { @@ -761,6 +848,10 @@ def __init__( role_status: Optional[Union[str, "RoleStatus"]] = None, **kwargs ): + """ + :keyword role_status: Role status. Possible values include: "Enabled", "Disabled". + :paramtype role_status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleStatus + """ super(CloudEdgeManagementRole, self).__init__(**kwargs) self.kind = 'CloudEdgeManagement' # type: str self.local_management_status = None @@ -771,14 +862,14 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from the service. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.CloudErrorBody] + :vartype message: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.CloudErrorBody] """ _attribute_map = { @@ -795,6 +886,16 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -834,6 +935,8 @@ def __init__( self, **kwargs ): + """ + """ super(CniConfig, self).__init__(**kwargs) self.type = None self.version = None @@ -846,10 +949,10 @@ class ComputeResource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param processor_count: Required. Processor count. - :type processor_count: int - :param memory_in_gb: Required. Memory in GB. - :type memory_in_gb: long + :ivar processor_count: Required. Processor count. + :vartype processor_count: int + :ivar memory_in_gb: Required. Memory in GB. + :vartype memory_in_gb: long """ _validation = { @@ -869,6 +972,12 @@ def __init__( memory_in_gb: int, **kwargs ): + """ + :keyword processor_count: Required. Processor count. + :paramtype processor_count: int + :keyword memory_in_gb: Required. Memory in GB. + :paramtype memory_in_gb: long + """ super(ComputeResource, self).__init__(**kwargs) self.processor_count = processor_count self.memory_in_gb = memory_in_gb @@ -879,14 +988,14 @@ class ContactDetails(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param contact_person: Required. The contact person name. - :type contact_person: str - :param company_name: Required. The name of the company. - :type company_name: str - :param phone: Required. The phone number. - :type phone: str - :param email_list: Required. The email list. - :type email_list: list[str] + :ivar contact_person: Required. The contact person name. + :vartype contact_person: str + :ivar company_name: Required. The name of the company. + :vartype company_name: str + :ivar phone: Required. The phone number. + :vartype phone: str + :ivar email_list: Required. The email list. + :vartype email_list: list[str] """ _validation = { @@ -912,6 +1021,16 @@ def __init__( email_list: List[str], **kwargs ): + """ + :keyword contact_person: Required. The contact person name. + :paramtype contact_person: str + :keyword company_name: Required. The name of the company. + :paramtype company_name: str + :keyword phone: Required. The phone number. + :paramtype phone: str + :keyword email_list: Required. The email list. + :paramtype email_list: list[str] + """ super(ContactDetails, self).__init__(**kwargs) self.contact_person = contact_person self.company_name = company_name @@ -938,9 +1057,9 @@ class Container(ARMBaseModel): "Offline", "Unknown", "Updating", "NeedsAttention". :vartype container_status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ContainerStatus - :param data_format: Required. DataFormat for Container. Possible values include: "BlockBlob", + :ivar data_format: Required. DataFormat for Container. Possible values include: "BlockBlob", "PageBlob", "AzureFile". - :type data_format: str or + :vartype data_format: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AzureContainerDataFormat :ivar refresh_details: Details of the refresh job on this container. :vartype refresh_details: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RefreshDetails @@ -976,6 +1095,12 @@ def __init__( data_format: Union[str, "AzureContainerDataFormat"], **kwargs ): + """ + :keyword data_format: Required. DataFormat for Container. Possible values include: "BlockBlob", + "PageBlob", "AzureFile". + :paramtype data_format: str or + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AzureContainerDataFormat + """ super(Container, self).__init__(**kwargs) self.system_data = None self.container_status = None @@ -1009,6 +1134,8 @@ def __init__( self, **kwargs ): + """ + """ super(ContainerList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1027,29 +1154,29 @@ class DataBoxEdgeDevice(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param location: Required. The location of the device. This is a supported and registered Azure + :ivar location: Required. The location of the device. This is a supported and registered Azure geographical region (for example, West US, East US, or Southeast Asia). The geographical region of a device cannot be changed once it is created, but if an identical geographical region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. The list of tags that describe the device. These tags can be used - to view and group this device (across resource groups). - :type tags: dict[str, str] - :param sku: The SKU type. - :type sku: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.Sku - :param etag: The etag for the devices. - :type etag: str - :param identity: Msi identity of the resource. - :type identity: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ResourceIdentity + :vartype location: str + :ivar tags: A set of tags. The list of tags that describe the device. These tags can be used to + view and group this device (across resource groups). + :vartype tags: dict[str, str] + :ivar sku: The SKU type. + :vartype sku: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.Sku + :ivar etag: The etag for the devices. + :vartype etag: str + :ivar identity: Msi identity of the resource. + :vartype identity: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ResourceIdentity :ivar kind: The etag for the devices. Possible values include: "AzureDataBoxGateway", "AzureStackEdge", "AzureStackHub", "AzureModularDataCentre". :vartype kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeDeviceKind :ivar system_data: DataBoxEdge Resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - :param data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible + :ivar data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible values include: "ReadyToSetup", "Online", "Offline", "NeedsAttention", "Disconnected", "PartiallyDisconnected", "Maintenance". - :type data_box_edge_device_status: str or + :vartype data_box_edge_device_status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeDeviceStatus :ivar serial_number: The Serial Number of Data Box Edge/Gateway device. :vartype serial_number: str @@ -1150,6 +1277,27 @@ def __init__( data_box_edge_device_status: Optional[Union[str, "DataBoxEdgeDeviceStatus"]] = None, **kwargs ): + """ + :keyword location: Required. The location of the device. This is a supported and registered + Azure geographical region (for example, West US, East US, or Southeast Asia). The geographical + region of a device cannot be changed once it is created, but if an identical geographical + region is specified on update, the request will succeed. + :paramtype location: str + :keyword tags: A set of tags. The list of tags that describe the device. These tags can be used + to view and group this device (across resource groups). + :paramtype tags: dict[str, str] + :keyword sku: The SKU type. + :paramtype sku: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.Sku + :keyword etag: The etag for the devices. + :paramtype etag: str + :keyword identity: Msi identity of the resource. + :paramtype identity: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ResourceIdentity + :keyword data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible + values include: "ReadyToSetup", "Online", "Offline", "NeedsAttention", "Disconnected", + "PartiallyDisconnected", "Maintenance". + :paramtype data_box_edge_device_status: str or + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeDeviceStatus + """ super(DataBoxEdgeDevice, self).__init__(**kwargs) self.location = location self.tags = tags @@ -1187,23 +1335,23 @@ class DataBoxEdgeDeviceExtendedInfo(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param encryption_key_thumbprint: The digital signature of encrypted certificate. - :type encryption_key_thumbprint: str - :param encryption_key: The public part of the encryption certificate. Client uses this to + :ivar encryption_key_thumbprint: The digital signature of encrypted certificate. + :vartype encryption_key_thumbprint: str + :ivar encryption_key: The public part of the encryption certificate. Client uses this to encrypt any secret. - :type encryption_key: str + :vartype encryption_key: str :ivar resource_key: The Resource ID of the Resource. :vartype resource_key: str - :param client_secret_store_id: The Key Vault ARM Id for client secrets. - :type client_secret_store_id: str - :param client_secret_store_url: The url to access the Client Key Vault. - :type client_secret_store_url: str - :param channel_integrity_key_name: The name of Channel Integrity Key stored in the Client Key + :ivar client_secret_store_id: The Key Vault ARM Id for client secrets. + :vartype client_secret_store_id: str + :ivar client_secret_store_url: The url to access the Client Key Vault. + :vartype client_secret_store_url: str + :ivar channel_integrity_key_name: The name of Channel Integrity Key stored in the Client Key Vault. - :type channel_integrity_key_name: str - :param channel_integrity_key_version: The version of Channel Integrity Key stored in the Client + :vartype channel_integrity_key_name: str + :ivar channel_integrity_key_version: The version of Channel Integrity Key stored in the Client Key Vault. - :type channel_integrity_key_version: str + :vartype channel_integrity_key_version: str """ _validation = { @@ -1237,6 +1385,23 @@ def __init__( channel_integrity_key_version: Optional[str] = None, **kwargs ): + """ + :keyword encryption_key_thumbprint: The digital signature of encrypted certificate. + :paramtype encryption_key_thumbprint: str + :keyword encryption_key: The public part of the encryption certificate. Client uses this to + encrypt any secret. + :paramtype encryption_key: str + :keyword client_secret_store_id: The Key Vault ARM Id for client secrets. + :paramtype client_secret_store_id: str + :keyword client_secret_store_url: The url to access the Client Key Vault. + :paramtype client_secret_store_url: str + :keyword channel_integrity_key_name: The name of Channel Integrity Key stored in the Client Key + Vault. + :paramtype channel_integrity_key_name: str + :keyword channel_integrity_key_version: The version of Channel Integrity Key stored in the + Client Key Vault. + :paramtype channel_integrity_key_version: str + """ super(DataBoxEdgeDeviceExtendedInfo, self).__init__(**kwargs) self.encryption_key_thumbprint = encryption_key_thumbprint self.encryption_key = encryption_key @@ -1250,16 +1415,16 @@ def __init__( class DataBoxEdgeDeviceExtendedInfoPatch(msrest.serialization.Model): """The Data Box Edge/Gateway device extended info patch. - :param client_secret_store_id: The Key Vault ARM Id for client secrets. - :type client_secret_store_id: str - :param client_secret_store_url: The url to access the Client Key Vault. - :type client_secret_store_url: str - :param channel_integrity_key_name: The name for Channel Integrity Key stored in the Client Key + :ivar client_secret_store_id: The Key Vault ARM Id for client secrets. + :vartype client_secret_store_id: str + :ivar client_secret_store_url: The url to access the Client Key Vault. + :vartype client_secret_store_url: str + :ivar channel_integrity_key_name: The name for Channel Integrity Key stored in the Client Key Vault. - :type channel_integrity_key_name: str - :param channel_integrity_key_version: The version of Channel Integrity Key stored in the Client + :vartype channel_integrity_key_name: str + :ivar channel_integrity_key_version: The version of Channel Integrity Key stored in the Client Key Vault. - :type channel_integrity_key_version: str + :vartype channel_integrity_key_version: str """ _attribute_map = { @@ -1278,6 +1443,18 @@ def __init__( channel_integrity_key_version: Optional[str] = None, **kwargs ): + """ + :keyword client_secret_store_id: The Key Vault ARM Id for client secrets. + :paramtype client_secret_store_id: str + :keyword client_secret_store_url: The url to access the Client Key Vault. + :paramtype client_secret_store_url: str + :keyword channel_integrity_key_name: The name for Channel Integrity Key stored in the Client + Key Vault. + :paramtype channel_integrity_key_name: str + :keyword channel_integrity_key_version: The version of Channel Integrity Key stored in the + Client Key Vault. + :paramtype channel_integrity_key_version: str + """ super(DataBoxEdgeDeviceExtendedInfoPatch, self).__init__(**kwargs) self.client_secret_store_id = client_secret_store_id self.client_secret_store_url = client_secret_store_url @@ -1310,6 +1487,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataBoxEdgeDeviceList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1318,12 +1497,12 @@ def __init__( class DataBoxEdgeDevicePatch(msrest.serialization.Model): """The Data Box Edge/Gateway device patch. - :param tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. - :type tags: dict[str, str] - :param identity: Msi identity of the resource. - :type identity: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ResourceIdentity - :param edge_profile: Edge Profile property of the Data Box Edge/Gateway device. - :type edge_profile: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.EdgeProfilePatch + :ivar tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. + :vartype tags: dict[str, str] + :ivar identity: Msi identity of the resource. + :vartype identity: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ResourceIdentity + :ivar edge_profile: Edge Profile property of the Data Box Edge/Gateway device. + :vartype edge_profile: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.EdgeProfilePatch """ _attribute_map = { @@ -1340,6 +1519,14 @@ def __init__( edge_profile: Optional["EdgeProfilePatch"] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. + :paramtype tags: dict[str, str] + :keyword identity: Msi identity of the resource. + :paramtype identity: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ResourceIdentity + :keyword edge_profile: Edge Profile property of the Data Box Edge/Gateway device. + :paramtype edge_profile: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.EdgeProfilePatch + """ super(DataBoxEdgeDevicePatch, self).__init__(**kwargs) self.tags = tags self.identity = identity @@ -1351,10 +1538,10 @@ class DataBoxEdgeMoveRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param target_resource_group: Required. Target resource group ARMId. - :type target_resource_group: str - :param resources: Required. List of resources to be moved. - :type resources: list[str] + :ivar target_resource_group: Required. Target resource group ARMId. + :vartype target_resource_group: str + :ivar resources: Required. List of resources to be moved. + :vartype resources: list[str] """ _validation = { @@ -1374,6 +1561,12 @@ def __init__( resources: List[str], **kwargs ): + """ + :keyword target_resource_group: Required. Target resource group ARMId. + :paramtype target_resource_group: str + :keyword resources: Required. List of resources to be moved. + :paramtype resources: list[str] + """ super(DataBoxEdgeMoveRequest, self).__init__(**kwargs) self.target_resource_group = target_resource_group self.resources = resources @@ -1462,6 +1655,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataBoxEdgeSku, self).__init__(**kwargs) self.resource_type = None self.name = None @@ -1504,6 +1699,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataBoxEdgeSkuList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1512,8 +1709,8 @@ def __init__( class DCAccessCode(msrest.serialization.Model): """DC Access code in the case of Self Managed Shipping. - :param auth_code: DCAccess Code for the Self Managed shipment. - :type auth_code: str + :ivar auth_code: DCAccess Code for the Self Managed shipment. + :vartype auth_code: str """ _attribute_map = { @@ -1526,6 +1723,10 @@ def __init__( auth_code: Optional[str] = None, **kwargs ): + """ + :keyword auth_code: DCAccess Code for the Self Managed shipment. + :paramtype auth_code: str + """ super(DCAccessCode, self).__init__(**kwargs) self.auth_code = auth_code @@ -1533,8 +1734,9 @@ def __init__( class EdgeProfile(msrest.serialization.Model): """Details about Edge Profile for the resource. - :param subscription: Edge Profile Subscription. - :type subscription: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.EdgeProfileSubscription + :ivar subscription: Edge Profile Subscription. + :vartype subscription: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.EdgeProfileSubscription """ _attribute_map = { @@ -1547,6 +1749,11 @@ def __init__( subscription: Optional["EdgeProfileSubscription"] = None, **kwargs ): + """ + :keyword subscription: Edge Profile Subscription. + :paramtype subscription: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.EdgeProfileSubscription + """ super(EdgeProfile, self).__init__(**kwargs) self.subscription = subscription @@ -1554,8 +1761,8 @@ def __init__( class EdgeProfilePatch(msrest.serialization.Model): """The Data Box Edge/Gateway Edge Profile patch. - :param subscription: The Data Box Edge/Gateway Edge Profile Subscription patch. - :type subscription: + :ivar subscription: The Data Box Edge/Gateway Edge Profile Subscription patch. + :vartype subscription: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.EdgeProfileSubscriptionPatch """ @@ -1569,6 +1776,11 @@ def __init__( subscription: Optional["EdgeProfileSubscriptionPatch"] = None, **kwargs ): + """ + :keyword subscription: The Data Box Edge/Gateway Edge Profile Subscription patch. + :paramtype subscription: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.EdgeProfileSubscriptionPatch + """ super(EdgeProfilePatch, self).__init__(**kwargs) self.subscription = subscription @@ -1576,27 +1788,27 @@ def __init__( class EdgeProfileSubscription(msrest.serialization.Model): """Subscription details for the Edge Profile. - :param registration_id: Edge Subscription Registration ID. - :type registration_id: str - :param id: ARM ID of the subscription. - :type id: str - :param state: Possible values include: "Registered", "Warned", "Suspended", "Deleted", + :ivar registration_id: Edge Subscription Registration ID. + :vartype registration_id: str + :ivar id: ARM ID of the subscription. + :vartype id: str + :ivar state: Possible values include: "Registered", "Warned", "Suspended", "Deleted", "Unregistered". - :type state: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SubscriptionState - :param registration_date: - :type registration_date: str - :param subscription_id: - :type subscription_id: str - :param tenant_id: - :type tenant_id: str - :param location_placement_id: - :type location_placement_id: str - :param quota_id: - :type quota_id: str - :param serialized_details: - :type serialized_details: str - :param registered_features: - :type registered_features: + :vartype state: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SubscriptionState + :ivar registration_date: + :vartype registration_date: str + :ivar subscription_id: + :vartype subscription_id: str + :ivar tenant_id: + :vartype tenant_id: str + :ivar location_placement_id: + :vartype location_placement_id: str + :ivar quota_id: + :vartype quota_id: str + :ivar serialized_details: + :vartype serialized_details: str + :ivar registered_features: + :vartype registered_features: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.SubscriptionRegisteredFeatures] """ @@ -1628,6 +1840,30 @@ def __init__( registered_features: Optional[List["SubscriptionRegisteredFeatures"]] = None, **kwargs ): + """ + :keyword registration_id: Edge Subscription Registration ID. + :paramtype registration_id: str + :keyword id: ARM ID of the subscription. + :paramtype id: str + :keyword state: Possible values include: "Registered", "Warned", "Suspended", "Deleted", + "Unregistered". + :paramtype state: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SubscriptionState + :keyword registration_date: + :paramtype registration_date: str + :keyword subscription_id: + :paramtype subscription_id: str + :keyword tenant_id: + :paramtype tenant_id: str + :keyword location_placement_id: + :paramtype location_placement_id: str + :keyword quota_id: + :paramtype quota_id: str + :keyword serialized_details: + :paramtype serialized_details: str + :keyword registered_features: + :paramtype registered_features: + list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.SubscriptionRegisteredFeatures] + """ super(EdgeProfileSubscription, self).__init__(**kwargs) self.registration_id = registration_id self.id = id @@ -1644,8 +1880,8 @@ def __init__( class EdgeProfileSubscriptionPatch(msrest.serialization.Model): """The Data Box Edge/Gateway Edge Profile Subscription patch. - :param id: The path ID that uniquely identifies the subscription of the edge profile. - :type id: str + :ivar id: The path ID that uniquely identifies the subscription of the edge profile. + :vartype id: str """ _attribute_map = { @@ -1658,6 +1894,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The path ID that uniquely identifies the subscription of the edge profile. + :paramtype id: str + """ super(EdgeProfileSubscriptionPatch, self).__init__(**kwargs) self.id = id @@ -1687,6 +1927,8 @@ def __init__( self, **kwargs ): + """ + """ super(EtcdInfo, self).__init__(**kwargs) self.type = None self.version = None @@ -1710,9 +1952,9 @@ class Trigger(ARMBaseModel): :vartype type: str :ivar system_data: Trigger in DataBoxEdge Resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: + :ivar kind: Required. Trigger Kind.Constant filled by server. Possible values include: "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.TriggerEventType + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.TriggerEventType """ _validation = { @@ -1739,6 +1981,8 @@ def __init__( self, **kwargs ): + """ + """ super(Trigger, self).__init__(**kwargs) self.system_data = None self.kind = 'Trigger' # type: str @@ -1759,17 +2003,17 @@ class FileEventTrigger(Trigger): :vartype type: str :ivar system_data: Trigger in DataBoxEdge Resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: + :ivar kind: Required. Trigger Kind.Constant filled by server. Possible values include: "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.TriggerEventType - :param source_info: Required. File event source details. - :type source_info: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.FileSourceInfo - :param sink_info: Required. Role sink info. - :type sink_info: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.TriggerEventType + :ivar source_info: Required. File event source details. + :vartype source_info: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.FileSourceInfo + :ivar sink_info: Required. Role sink info. + :vartype sink_info: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleSinkInfo + :ivar custom_context_tag: A custom context tag typically used to correlate the trigger against its usage. For example, if a periodic timer trigger is intended for certain specific IoT modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str + :vartype custom_context_tag: str """ _validation = { @@ -1802,6 +2046,16 @@ def __init__( custom_context_tag: Optional[str] = None, **kwargs ): + """ + :keyword source_info: Required. File event source details. + :paramtype source_info: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.FileSourceInfo + :keyword sink_info: Required. Role sink info. + :paramtype sink_info: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleSinkInfo + :keyword custom_context_tag: A custom context tag typically used to correlate the trigger + against its usage. For example, if a periodic timer trigger is intended for certain specific + IoT modules in the device, the tag can be the name or the image URL of the module. + :paramtype custom_context_tag: str + """ super(FileEventTrigger, self).__init__(**kwargs) self.kind = 'FileEvent' # type: str self.source_info = source_info @@ -1814,8 +2068,8 @@ class FileSourceInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param share_id: Required. File share ID. - :type share_id: str + :ivar share_id: Required. File share ID. + :vartype share_id: str """ _validation = { @@ -1832,6 +2086,10 @@ def __init__( share_id: str, **kwargs ): + """ + :keyword share_id: Required. File share ID. + :paramtype share_id: str + """ super(FileSourceInfo, self).__init__(**kwargs) self.share_id = share_id @@ -1839,14 +2097,14 @@ def __init__( class GenerateCertResponse(msrest.serialization.Model): """Used in activation key generation flow. - :param public_key: Gets or sets base64 encoded certificate raw data, + :ivar public_key: Gets or sets base64 encoded certificate raw data, this is the public part needed to be uploaded to cert vault. - :type public_key: str - :param private_key: Gets or sets base64 encoded private part of the certificate, + :vartype public_key: str + :ivar private_key: Gets or sets base64 encoded private part of the certificate, needed to form the activation key. - :type private_key: str - :param expiry_time_in_utc: Gets or sets expiry time in UTC. - :type expiry_time_in_utc: str + :vartype private_key: str + :ivar expiry_time_in_utc: Gets or sets expiry time in UTC. + :vartype expiry_time_in_utc: str """ _attribute_map = { @@ -1863,6 +2121,16 @@ def __init__( expiry_time_in_utc: Optional[str] = None, **kwargs ): + """ + :keyword public_key: Gets or sets base64 encoded certificate raw data, + this is the public part needed to be uploaded to cert vault. + :paramtype public_key: str + :keyword private_key: Gets or sets base64 encoded private part of the certificate, + needed to form the activation key. + :paramtype private_key: str + :keyword expiry_time_in_utc: Gets or sets expiry time in UTC. + :paramtype expiry_time_in_utc: str + """ super(GenerateCertResponse, self).__init__(**kwargs) self.public_key = public_key self.private_key = private_key @@ -1874,12 +2142,12 @@ class ImageRepositoryCredential(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param image_repository_url: Required. Image repository url (e.g.: mcr.microsoft.com). - :type image_repository_url: str - :param user_name: Required. Repository user name. - :type user_name: str - :param password: Repository user password. - :type password: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AsymmetricEncryptedSecret + :ivar image_repository_url: Required. Image repository url (e.g.: mcr.microsoft.com). + :vartype image_repository_url: str + :ivar user_name: Required. Repository user name. + :vartype user_name: str + :ivar password: Repository user password. + :vartype password: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AsymmetricEncryptedSecret """ _validation = { @@ -1901,6 +2169,15 @@ def __init__( password: Optional["AsymmetricEncryptedSecret"] = None, **kwargs ): + """ + :keyword image_repository_url: Required. Image repository url (e.g.: mcr.microsoft.com). + :paramtype image_repository_url: str + :keyword user_name: Required. Repository user name. + :paramtype user_name: str + :keyword password: Repository user password. + :paramtype password: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AsymmetricEncryptedSecret + """ super(ImageRepositoryCredential, self).__init__(**kwargs) self.image_repository_url = image_repository_url self.user_name = user_name @@ -1920,17 +2197,17 @@ class IoTAddon(Addon): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Addon type.Constant filled by server. Possible values include: - "IotEdge", "ArcForKubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AddonType + :ivar kind: Required. Addon type.Constant filled by server. Possible values include: "IotEdge", + "ArcForKubernetes". + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AddonType :ivar system_data: Addon type. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - :param io_t_device_details: Required. IoT device metadata to which appliance needs to be + :ivar io_t_device_details: Required. IoT device metadata to which appliance needs to be connected. - :type io_t_device_details: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.IoTDeviceInfo - :param io_t_edge_device_details: Required. IoT edge device to which the IoT Addon needs to be + :vartype io_t_device_details: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.IoTDeviceInfo + :ivar io_t_edge_device_details: Required. IoT edge device to which the IoT Addon needs to be configured. - :type io_t_edge_device_details: + :vartype io_t_edge_device_details: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.IoTDeviceInfo :ivar version: Version of IoT running on the appliance. :vartype version: str @@ -1982,6 +2259,16 @@ def __init__( io_t_edge_device_details: "IoTDeviceInfo", **kwargs ): + """ + :keyword io_t_device_details: Required. IoT device metadata to which appliance needs to be + connected. + :paramtype io_t_device_details: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.IoTDeviceInfo + :keyword io_t_edge_device_details: Required. IoT edge device to which the IoT Addon needs to be + configured. + :paramtype io_t_edge_device_details: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.IoTDeviceInfo + """ super(IoTAddon, self).__init__(**kwargs) self.kind = 'IotEdge' # type: str self.io_t_device_details = io_t_device_details @@ -1997,14 +2284,14 @@ class IoTDeviceInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param device_id: Required. ID of the IoT device/edge device. - :type device_id: str - :param io_t_host_hub: Required. Host name for the IoT hub associated to the device. - :type io_t_host_hub: str - :param io_t_host_hub_id: Id for the IoT hub associated to the device. - :type io_t_host_hub_id: str - :param authentication: Encrypted IoT device/IoT edge device connection string. - :type authentication: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.Authentication + :ivar device_id: Required. ID of the IoT device/edge device. + :vartype device_id: str + :ivar io_t_host_hub: Required. Host name for the IoT hub associated to the device. + :vartype io_t_host_hub: str + :ivar io_t_host_hub_id: Id for the IoT hub associated to the device. + :vartype io_t_host_hub_id: str + :ivar authentication: Encrypted IoT device/IoT edge device connection string. + :vartype authentication: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.Authentication """ _validation = { @@ -2028,6 +2315,16 @@ def __init__( authentication: Optional["Authentication"] = None, **kwargs ): + """ + :keyword device_id: Required. ID of the IoT device/edge device. + :paramtype device_id: str + :keyword io_t_host_hub: Required. Host name for the IoT hub associated to the device. + :paramtype io_t_host_hub: str + :keyword io_t_host_hub_id: Id for the IoT hub associated to the device. + :paramtype io_t_host_hub_id: str + :keyword authentication: Encrypted IoT device/IoT edge device connection string. + :paramtype authentication: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.Authentication + """ super(IoTDeviceInfo, self).__init__(**kwargs) self.device_id = device_id self.io_t_host_hub = io_t_host_hub @@ -2040,12 +2337,12 @@ class IoTEdgeAgentInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param image_name: Required. Name of the IoT edge agent image. - :type image_name: str - :param tag: Required. Image Tag. - :type tag: str - :param image_repository: Image repository details. - :type image_repository: + :ivar image_name: Required. Name of the IoT edge agent image. + :vartype image_name: str + :ivar tag: Required. Image Tag. + :vartype tag: str + :ivar image_repository: Image repository details. + :vartype image_repository: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ImageRepositoryCredential """ @@ -2068,6 +2365,15 @@ def __init__( image_repository: Optional["ImageRepositoryCredential"] = None, **kwargs ): + """ + :keyword image_name: Required. Name of the IoT edge agent image. + :paramtype image_name: str + :keyword tag: Required. Image Tag. + :paramtype tag: str + :keyword image_repository: Image repository details. + :paramtype image_repository: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ImageRepositoryCredential + """ super(IoTEdgeAgentInfo, self).__init__(**kwargs) self.image_name = image_name self.tag = tag @@ -2087,33 +2393,34 @@ class IoTRole(Role): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleTypes + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleTypes :ivar system_data: Role configured on ASE resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - :param host_platform: Host OS supported by the IoT role. Possible values include: "Windows", + :ivar host_platform: Host OS supported by the IoT role. Possible values include: "Windows", "Linux". - :type host_platform: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.PlatformType - :param io_t_device_details: IoT device metadata to which data box edge device needs to be + :vartype host_platform: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.PlatformType + :ivar io_t_device_details: IoT device metadata to which data box edge device needs to be connected. - :type io_t_device_details: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.IoTDeviceInfo - :param io_t_edge_device_details: IoT edge device to which the IoT role needs to be configured. - :type io_t_edge_device_details: + :vartype io_t_device_details: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.IoTDeviceInfo + :ivar io_t_edge_device_details: IoT edge device to which the IoT role needs to be configured. + :vartype io_t_edge_device_details: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.IoTDeviceInfo - :param share_mappings: Mount points of shares in role(s). - :type share_mappings: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MountPointMap] - :param io_t_edge_agent_info: Iot edge agent details to download the agent and bootstrap iot + :ivar share_mappings: Mount points of shares in role(s). + :vartype share_mappings: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MountPointMap] + :ivar io_t_edge_agent_info: Iot edge agent details to download the agent and bootstrap iot runtime. - :type io_t_edge_agent_info: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.IoTEdgeAgentInfo + :vartype io_t_edge_agent_info: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.IoTEdgeAgentInfo :ivar host_platform_type: Platform where the Iot runtime is hosted. Possible values include: "KubernetesCluster", "LinuxVM". :vartype host_platform_type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.HostPlatformType - :param compute_resource: Resource allocation. - :type compute_resource: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ComputeResource - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleStatus + :ivar compute_resource: Resource allocation. + :vartype compute_resource: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ComputeResource + :ivar role_status: Role status. Possible values include: "Enabled", "Disabled". + :vartype role_status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleStatus """ _validation = { @@ -2153,6 +2460,31 @@ def __init__( role_status: Optional[Union[str, "RoleStatus"]] = None, **kwargs ): + """ + :keyword host_platform: Host OS supported by the IoT role. Possible values include: "Windows", + "Linux". + :paramtype host_platform: str or + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.PlatformType + :keyword io_t_device_details: IoT device metadata to which data box edge device needs to be + connected. + :paramtype io_t_device_details: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.IoTDeviceInfo + :keyword io_t_edge_device_details: IoT edge device to which the IoT role needs to be + configured. + :paramtype io_t_edge_device_details: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.IoTDeviceInfo + :keyword share_mappings: Mount points of shares in role(s). + :paramtype share_mappings: + list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MountPointMap] + :keyword io_t_edge_agent_info: Iot edge agent details to download the agent and bootstrap iot + runtime. + :paramtype io_t_edge_agent_info: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.IoTEdgeAgentInfo + :keyword compute_resource: Resource allocation. + :paramtype compute_resource: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ComputeResource + :keyword role_status: Role status. Possible values include: "Enabled", "Disabled". + :paramtype role_status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleStatus + """ super(IoTRole, self).__init__(**kwargs) self.kind = 'IOT' # type: str self.host_platform = host_platform @@ -2194,6 +2526,8 @@ def __init__( self, **kwargs ): + """ + """ super(Ipv4Config, self).__init__(**kwargs) self.ip_address = None self.subnet = None @@ -2229,6 +2563,8 @@ def __init__( self, **kwargs ): + """ + """ super(Ipv6Config, self).__init__(**kwargs) self.ip_address = None self.prefix_length = None @@ -2280,9 +2616,9 @@ class Job(msrest.serialization.Model): :vartype error_manifest_file: str :ivar refreshed_entity_id: ARM ID of the entity that was refreshed. :vartype refreshed_entity_id: str - :param folder: If only subfolders need to be refreshed, then the subfolder path inside the - share or container. (The path is empty if there are no subfolders.). - :type folder: str + :ivar folder: If only subfolders need to be refreshed, then the subfolder path inside the share + or container. (The path is empty if there are no subfolders.). + :vartype folder: str """ _validation = { @@ -2328,6 +2664,11 @@ def __init__( folder: Optional[str] = None, **kwargs ): + """ + :keyword folder: If only subfolders need to be refreshed, then the subfolder path inside the + share or container. (The path is empty if there are no subfolders.). + :paramtype folder: str + """ super(Job, self).__init__(**kwargs) self.id = None self.name = None @@ -2376,6 +2717,8 @@ def __init__( self, **kwargs ): + """ + """ super(JobErrorDetails, self).__init__(**kwargs) self.error_details = None self.code = None @@ -2411,6 +2754,8 @@ def __init__( self, **kwargs ): + """ + """ super(JobErrorItem, self).__init__(**kwargs) self.recommendations = None self.code = None @@ -2428,8 +2773,8 @@ class KubernetesClusterInfo(msrest.serialization.Model): :vartype etcd_info: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.EtcdInfo :ivar nodes: Kubernetes cluster nodes. :vartype nodes: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.NodeInfo] - :param version: Required. Kubernetes cluster version. - :type version: str + :ivar version: Required. Kubernetes cluster version. + :vartype version: str """ _validation = { @@ -2450,6 +2795,10 @@ def __init__( version: str, **kwargs ): + """ + :keyword version: Required. Kubernetes cluster version. + :paramtype version: str + """ super(KubernetesClusterInfo, self).__init__(**kwargs) self.etcd_info = None self.nodes = None @@ -2463,8 +2812,8 @@ class KubernetesIPConfiguration(msrest.serialization.Model): :ivar port: Port of the Kubernetes node. :vartype port: str - :param ip_address: IP address of the Kubernetes node. - :type ip_address: str + :ivar ip_address: IP address of the Kubernetes node. + :vartype ip_address: str """ _validation = { @@ -2482,6 +2831,10 @@ def __init__( ip_address: Optional[str] = None, **kwargs ): + """ + :keyword ip_address: IP address of the Kubernetes node. + :paramtype ip_address: str + """ super(KubernetesIPConfiguration, self).__init__(**kwargs) self.port = None self.ip_address = ip_address @@ -2500,14 +2853,14 @@ class KubernetesRole(Role): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleTypes + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleTypes :ivar system_data: Role configured on ASE resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - :param host_platform: Host OS supported by the Kubernetes role. Possible values include: + :ivar host_platform: Host OS supported by the Kubernetes role. Possible values include: "Windows", "Linux". - :type host_platform: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.PlatformType + :vartype host_platform: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.PlatformType :ivar provisioning_state: State of Kubernetes deployment. Possible values include: "Invalid", "Creating", "Created", "Updating", "Reconfiguring", "Failed", "Deleting". :vartype provisioning_state: str or @@ -2516,14 +2869,14 @@ class KubernetesRole(Role): "KubernetesCluster", "LinuxVM". :vartype host_platform_type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.HostPlatformType - :param kubernetes_cluster_info: Kubernetes cluster configuration. - :type kubernetes_cluster_info: + :ivar kubernetes_cluster_info: Kubernetes cluster configuration. + :vartype kubernetes_cluster_info: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.KubernetesClusterInfo - :param kubernetes_role_resources: Kubernetes role resources. - :type kubernetes_role_resources: + :ivar kubernetes_role_resources: Kubernetes role resources. + :vartype kubernetes_role_resources: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.KubernetesRoleResources - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleStatus + :ivar role_status: Role status. Possible values include: "Enabled", "Disabled". + :vartype role_status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleStatus """ _validation = { @@ -2559,6 +2912,20 @@ def __init__( role_status: Optional[Union[str, "RoleStatus"]] = None, **kwargs ): + """ + :keyword host_platform: Host OS supported by the Kubernetes role. Possible values include: + "Windows", "Linux". + :paramtype host_platform: str or + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.PlatformType + :keyword kubernetes_cluster_info: Kubernetes cluster configuration. + :paramtype kubernetes_cluster_info: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.KubernetesClusterInfo + :keyword kubernetes_role_resources: Kubernetes role resources. + :paramtype kubernetes_role_resources: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.KubernetesRoleResources + :keyword role_status: Role status. Possible values include: "Enabled", "Disabled". + :paramtype role_status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleStatus + """ super(KubernetesRole, self).__init__(**kwargs) self.kind = 'Kubernetes' # type: str self.host_platform = host_platform @@ -2576,8 +2943,8 @@ class KubernetesRoleCompute(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param vm_profile: Required. VM profile. - :type vm_profile: str + :ivar vm_profile: Required. VM profile. + :vartype vm_profile: str :ivar memory_in_bytes: Memory in bytes. :vartype memory_in_bytes: long :ivar processor_count: Processor count. @@ -2602,6 +2969,10 @@ def __init__( vm_profile: str, **kwargs ): + """ + :keyword vm_profile: Required. VM profile. + :paramtype vm_profile: str + """ super(KubernetesRoleCompute, self).__init__(**kwargs) self.vm_profile = vm_profile self.memory_in_bytes = None @@ -2634,6 +3005,8 @@ def __init__( self, **kwargs ): + """ + """ super(KubernetesRoleNetwork, self).__init__(**kwargs) self.cni_config = None self.load_balancer_config = None @@ -2646,10 +3019,10 @@ class KubernetesRoleResources(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param storage: Kubernetes role storage resource. - :type storage: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.KubernetesRoleStorage - :param compute: Required. Kubernetes role compute resource. - :type compute: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.KubernetesRoleCompute + :ivar storage: Kubernetes role storage resource. + :vartype storage: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.KubernetesRoleStorage + :ivar compute: Required. Kubernetes role compute resource. + :vartype compute: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.KubernetesRoleCompute :ivar network: Kubernetes role network resource. :vartype network: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.KubernetesRoleNetwork """ @@ -2672,6 +3045,12 @@ def __init__( storage: Optional["KubernetesRoleStorage"] = None, **kwargs ): + """ + :keyword storage: Kubernetes role storage resource. + :paramtype storage: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.KubernetesRoleStorage + :keyword compute: Required. Kubernetes role compute resource. + :paramtype compute: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.KubernetesRoleCompute + """ super(KubernetesRoleResources, self).__init__(**kwargs) self.storage = storage self.compute = compute @@ -2686,8 +3065,8 @@ class KubernetesRoleStorage(msrest.serialization.Model): :ivar storage_classes: Kubernetes storage class info. :vartype storage_classes: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.KubernetesRoleStorageClassInfo] - :param endpoints: Mount points of shares in role(s). - :type endpoints: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MountPointMap] + :ivar endpoints: Mount points of shares in role(s). + :vartype endpoints: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MountPointMap] """ _validation = { @@ -2705,6 +3084,10 @@ def __init__( endpoints: Optional[List["MountPointMap"]] = None, **kwargs ): + """ + :keyword endpoints: Mount points of shares in role(s). + :paramtype endpoints: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MountPointMap] + """ super(KubernetesRoleStorage, self).__init__(**kwargs) self.storage_classes = None self.endpoints = endpoints @@ -2741,6 +3124,8 @@ def __init__( self, **kwargs ): + """ + """ super(KubernetesRoleStorageClassInfo, self).__init__(**kwargs) self.name = None self.type = None @@ -2772,6 +3157,8 @@ def __init__( self, **kwargs ): + """ + """ super(LoadBalancerConfig, self).__init__(**kwargs) self.type = None self.version = None @@ -2790,16 +3177,16 @@ class MECRole(Role): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleTypes + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleTypes :ivar system_data: Role configured on ASE resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - :param connection_string: Activation key of the MEC. - :type connection_string: + :ivar connection_string: Activation key of the MEC. + :vartype connection_string: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AsymmetricEncryptedSecret - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleStatus + :ivar role_status: Role status. Possible values include: "Enabled", "Disabled". + :vartype role_status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleStatus """ _validation = { @@ -2827,6 +3214,13 @@ def __init__( role_status: Optional[Union[str, "RoleStatus"]] = None, **kwargs ): + """ + :keyword connection_string: Activation key of the MEC. + :paramtype connection_string: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AsymmetricEncryptedSecret + :keyword role_status: Role status. Possible values include: "Enabled", "Disabled". + :paramtype role_status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleStatus + """ super(MECRole, self).__init__(**kwargs) self.kind = 'MEC' # type: str self.connection_string = connection_string @@ -2838,15 +3232,16 @@ class MetricConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param resource_id: Required. The Resource ID on which the metrics should be pushed. - :type resource_id: str - :param mdm_account: The MDM account to which the counters should be pushed. - :type mdm_account: str - :param metric_name_space: The MDM namespace to which the counters should be pushed. This is + :ivar resource_id: Required. The Resource ID on which the metrics should be pushed. + :vartype resource_id: str + :ivar mdm_account: The MDM account to which the counters should be pushed. + :vartype mdm_account: str + :ivar metric_name_space: The MDM namespace to which the counters should be pushed. This is required if MDMAccount is specified. - :type metric_name_space: str - :param counter_sets: Required. Host name for the IoT hub associated to the device. - :type counter_sets: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricCounterSet] + :vartype metric_name_space: str + :ivar counter_sets: Required. Host name for the IoT hub associated to the device. + :vartype counter_sets: + list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricCounterSet] """ _validation = { @@ -2870,6 +3265,18 @@ def __init__( metric_name_space: Optional[str] = None, **kwargs ): + """ + :keyword resource_id: Required. The Resource ID on which the metrics should be pushed. + :paramtype resource_id: str + :keyword mdm_account: The MDM account to which the counters should be pushed. + :paramtype mdm_account: str + :keyword metric_name_space: The MDM namespace to which the counters should be pushed. This is + required if MDMAccount is specified. + :paramtype metric_name_space: str + :keyword counter_sets: Required. Host name for the IoT hub associated to the device. + :paramtype counter_sets: + list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricCounterSet] + """ super(MetricConfiguration, self).__init__(**kwargs) self.resource_id = resource_id self.mdm_account = mdm_account @@ -2882,15 +3289,15 @@ class MetricCounter(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The counter name. - :type name: str - :param instance: The instance from which counter should be collected. - :type instance: str - :param dimension_filter: The dimension filter. - :type dimension_filter: + :ivar name: Required. The counter name. + :vartype name: str + :ivar instance: The instance from which counter should be collected. + :vartype instance: str + :ivar dimension_filter: The dimension filter. + :vartype dimension_filter: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricDimension] - :param additional_dimensions: The additional dimensions to be added to metric. - :type additional_dimensions: + :ivar additional_dimensions: The additional dimensions to be added to metric. + :vartype additional_dimensions: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricDimension] """ @@ -2914,6 +3321,18 @@ def __init__( additional_dimensions: Optional[List["MetricDimension"]] = None, **kwargs ): + """ + :keyword name: Required. The counter name. + :paramtype name: str + :keyword instance: The instance from which counter should be collected. + :paramtype instance: str + :keyword dimension_filter: The dimension filter. + :paramtype dimension_filter: + list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricDimension] + :keyword additional_dimensions: The additional dimensions to be added to metric. + :paramtype additional_dimensions: + list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricDimension] + """ super(MetricCounter, self).__init__(**kwargs) self.name = name self.instance = instance @@ -2926,8 +3345,8 @@ class MetricCounterSet(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param counters: Required. The counters that should be collected in this set. - :type counters: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricCounter] + :ivar counters: Required. The counters that should be collected in this set. + :vartype counters: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricCounter] """ _validation = { @@ -2944,6 +3363,10 @@ def __init__( counters: List["MetricCounter"], **kwargs ): + """ + :keyword counters: Required. The counters that should be collected in this set. + :paramtype counters: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricCounter] + """ super(MetricCounterSet, self).__init__(**kwargs) self.counters = counters @@ -2953,10 +3376,10 @@ class MetricDimension(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_type: Required. The dimension type. - :type source_type: str - :param source_name: Required. The dimension value. - :type source_name: str + :ivar source_type: Required. The dimension type. + :vartype source_type: str + :ivar source_name: Required. The dimension value. + :vartype source_name: str """ _validation = { @@ -2976,6 +3399,12 @@ def __init__( source_name: str, **kwargs ): + """ + :keyword source_type: Required. The dimension type. + :paramtype source_type: str + :keyword source_name: Required. The dimension value. + :paramtype source_name: str + """ super(MetricDimension, self).__init__(**kwargs) self.source_type = source_type self.source_name = source_name @@ -2984,12 +3413,12 @@ def __init__( class MetricDimensionV1(msrest.serialization.Model): """Metric Dimension v1. - :param name: Name of the metrics dimension. - :type name: str - :param display_name: Display name of the metrics dimension. - :type display_name: str - :param to_be_exported_for_shoebox: To be exported to shoe box. - :type to_be_exported_for_shoebox: bool + :ivar name: Name of the metrics dimension. + :vartype name: str + :ivar display_name: Display name of the metrics dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: To be exported to shoe box. + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -3006,6 +3435,14 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): + """ + :keyword name: Name of the metrics dimension. + :paramtype name: str + :keyword display_name: Display name of the metrics dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: To be exported to shoe box. + :paramtype to_be_exported_for_shoebox: bool + """ super(MetricDimensionV1, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -3015,32 +3452,32 @@ def __init__( class MetricSpecificationV1(msrest.serialization.Model): """Metric specification version 1. - :param name: Name of the metric. - :type name: str - :param display_name: Display name of the metric. - :type display_name: str - :param display_description: Description of the metric to be displayed. - :type display_description: str - :param unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Display name of the metric. + :vartype display_name: str + :ivar display_description: Description of the metric to be displayed. + :vartype display_description: str + :ivar unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", "Seconds", "Milliseconds", "Bytes", "BytesPerSecond", "CountPerSecond". - :type unit: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricUnit - :param aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", + :vartype unit: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricUnit + :ivar aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", "None", "Average", "Minimum", "Maximum", "Total", "Count". - :type aggregation_type: str or + :vartype aggregation_type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricAggregationType - :param dimensions: Metric dimensions, other than default dimension which is resource. - :type dimensions: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricDimensionV1] - :param fill_gap_with_zero: Set true to fill the gaps with zero. - :type fill_gap_with_zero: bool - :param category: Metric category. Possible values include: "Capacity", "Transaction". - :type category: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricCategory - :param resource_id_dimension_name_override: Resource name override. - :type resource_id_dimension_name_override: str - :param supported_time_grain_types: Support granularity of metrics. - :type supported_time_grain_types: list[str or + :ivar dimensions: Metric dimensions, other than default dimension which is resource. + :vartype dimensions: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricDimensionV1] + :ivar fill_gap_with_zero: Set true to fill the gaps with zero. + :vartype fill_gap_with_zero: bool + :ivar category: Metric category. Possible values include: "Capacity", "Transaction". + :vartype category: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricCategory + :ivar resource_id_dimension_name_override: Resource name override. + :vartype resource_id_dimension_name_override: str + :ivar supported_time_grain_types: Support granularity of metrics. + :vartype supported_time_grain_types: list[str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.TimeGrain] - :param supported_aggregation_types: Support metric aggregation type. - :type supported_aggregation_types: list[str or + :ivar supported_aggregation_types: Support metric aggregation type. + :vartype supported_aggregation_types: list[str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricAggregationType] """ @@ -3074,6 +3511,36 @@ def __init__( supported_aggregation_types: Optional[List[Union[str, "MetricAggregationType"]]] = None, **kwargs ): + """ + :keyword name: Name of the metric. + :paramtype name: str + :keyword display_name: Display name of the metric. + :paramtype display_name: str + :keyword display_description: Description of the metric to be displayed. + :paramtype display_description: str + :keyword unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", + "Seconds", "Milliseconds", "Bytes", "BytesPerSecond", "CountPerSecond". + :paramtype unit: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricUnit + :keyword aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", + "None", "Average", "Minimum", "Maximum", "Total", "Count". + :paramtype aggregation_type: str or + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricAggregationType + :keyword dimensions: Metric dimensions, other than default dimension which is resource. + :paramtype dimensions: + list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricDimensionV1] + :keyword fill_gap_with_zero: Set true to fill the gaps with zero. + :paramtype fill_gap_with_zero: bool + :keyword category: Metric category. Possible values include: "Capacity", "Transaction". + :paramtype category: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricCategory + :keyword resource_id_dimension_name_override: Resource name override. + :paramtype resource_id_dimension_name_override: str + :keyword supported_time_grain_types: Support granularity of metrics. + :paramtype supported_time_grain_types: list[str or + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.TimeGrain] + :keyword supported_aggregation_types: Support metric aggregation type. + :paramtype supported_aggregation_types: list[str or + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricAggregationType] + """ super(MetricSpecificationV1, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -3101,8 +3568,8 @@ class MonitoringMetricConfiguration(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param metric_configurations: Required. The metrics configuration details. - :type metric_configurations: + :ivar metric_configurations: Required. The metrics configuration details. + :vartype metric_configurations: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricConfiguration] """ @@ -3126,6 +3593,11 @@ def __init__( metric_configurations: List["MetricConfiguration"], **kwargs ): + """ + :keyword metric_configurations: Required. The metrics configuration details. + :paramtype metric_configurations: + list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricConfiguration] + """ super(MonitoringMetricConfiguration, self).__init__(**kwargs) self.metric_configurations = metric_configurations @@ -3156,6 +3628,8 @@ def __init__( self, **kwargs ): + """ + """ super(MonitoringMetricConfigurationList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3168,8 +3642,8 @@ class MountPointMap(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param share_id: Required. ID of the share mounted to the role VM. - :type share_id: str + :ivar share_id: Required. ID of the share mounted to the role VM. + :vartype share_id: str :ivar role_id: ID of the role to which share is mounted. :vartype role_id: str :ivar mount_point: Mount point for the share. @@ -3203,6 +3677,10 @@ def __init__( share_id: str, **kwargs ): + """ + :keyword share_id: Required. ID of the share mounted to the role VM. + :paramtype share_id: str + """ super(MountPointMap, self).__init__(**kwargs) self.share_id = share_id self.role_id = None @@ -3236,13 +3714,13 @@ class NetworkAdapter(msrest.serialization.Model): :ivar status: Value indicating whether this adapter is valid. Possible values include: "Inactive", "Active". :vartype status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.NetworkAdapterStatus - :param rdma_status: Value indicating whether this adapter is RDMA capable. Possible values + :ivar rdma_status: Value indicating whether this adapter is RDMA capable. Possible values include: "Incapable", "Capable". - :type rdma_status: str or + :vartype rdma_status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.NetworkAdapterRDMAStatus - :param dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values + :ivar dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values include: "Disabled", "Enabled". - :type dhcp_status: str or + :vartype dhcp_status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.NetworkAdapterDHCPStatus :ivar ipv4_configuration: The IPv4 configuration of the network adapter. :vartype ipv4_configuration: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.Ipv4Config @@ -3295,6 +3773,16 @@ def __init__( dhcp_status: Optional[Union[str, "NetworkAdapterDHCPStatus"]] = None, **kwargs ): + """ + :keyword rdma_status: Value indicating whether this adapter is RDMA capable. Possible values + include: "Incapable", "Capable". + :paramtype rdma_status: str or + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.NetworkAdapterRDMAStatus + :keyword dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values + include: "Disabled", "Enabled". + :paramtype dhcp_status: str or + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.NetworkAdapterDHCPStatus + """ super(NetworkAdapter, self).__init__(**kwargs) self.adapter_id = None self.adapter_position = None @@ -3338,6 +3826,8 @@ def __init__( self, **kwargs ): + """ + """ super(NetworkAdapterPosition, self).__init__(**kwargs) self.network_group = None self.port = None @@ -3377,6 +3867,8 @@ def __init__( self, **kwargs ): + """ + """ super(NetworkSettings, self).__init__(**kwargs) self.network_adapters = None @@ -3442,6 +3934,8 @@ def __init__( self, **kwargs ): + """ + """ super(Node, self).__init__(**kwargs) self.node_status = None self.node_chassis_serial_number = None @@ -3461,8 +3955,8 @@ class NodeInfo(msrest.serialization.Model): :vartype name: str :ivar type: Node type - Master/Worker. Possible values include: "Invalid", "Master", "Worker". :vartype type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.KubernetesNodeType - :param ip_configuration: IP Configuration of the Kubernetes node. - :type ip_configuration: + :ivar ip_configuration: IP Configuration of the Kubernetes node. + :vartype ip_configuration: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.KubernetesIPConfiguration] """ @@ -3483,6 +3977,11 @@ def __init__( ip_configuration: Optional[List["KubernetesIPConfiguration"]] = None, **kwargs ): + """ + :keyword ip_configuration: IP Configuration of the Kubernetes node. + :paramtype ip_configuration: + list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.KubernetesIPConfiguration] + """ super(NodeInfo, self).__init__(**kwargs) self.name = None self.type = None @@ -3496,8 +3995,8 @@ class NodeList(msrest.serialization.Model): :ivar value: The list of Nodes. :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Node] - :param next_link: Link to the next set of results. - :type next_link: str + :ivar next_link: Link to the next set of results. + :vartype next_link: str """ _validation = { @@ -3515,6 +4014,10 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: Link to the next set of results. + :paramtype next_link: str + """ super(NodeList, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -3523,16 +4026,16 @@ def __init__( class Operation(msrest.serialization.Model): """Operations. - :param name: Name of the operation. - :type name: str - :param display: Properties displayed for the operation. - :type display: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.OperationDisplay - :param origin: Origin of the operation. - :type origin: str - :param is_data_action: Indicates whether the operation is a data action. - :type is_data_action: bool - :param service_specification: Service specification. - :type service_specification: + :ivar name: Name of the operation. + :vartype name: str + :ivar display: Properties displayed for the operation. + :vartype display: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.OperationDisplay + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar service_specification: Service specification. + :vartype service_specification: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ServiceSpecification """ @@ -3554,6 +4057,19 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword name: Name of the operation. + :paramtype name: str + :keyword display: Properties displayed for the operation. + :paramtype display: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + :keyword service_specification: Service specification. + :paramtype service_specification: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ServiceSpecification + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -3565,14 +4081,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Operation display properties. - :param provider: Provider name. - :type provider: str - :param resource: The type of resource in which the operation is performed. - :type resource: str - :param operation: Operation to be performed on the resource. - :type operation: str - :param description: Description of the operation to be performed. - :type description: str + :ivar provider: Provider name. + :vartype provider: str + :ivar resource: The type of resource in which the operation is performed. + :vartype resource: str + :ivar operation: Operation to be performed on the resource. + :vartype operation: str + :ivar description: Description of the operation to be performed. + :vartype description: str """ _attribute_map = { @@ -3591,6 +4107,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Provider name. + :paramtype provider: str + :keyword resource: The type of resource in which the operation is performed. + :paramtype resource: str + :keyword operation: Operation to be performed on the resource. + :paramtype operation: str + :keyword description: Description of the operation to be performed. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -3603,10 +4129,10 @@ class OperationsList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The value. - :type value: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Operation] - :param next_link: Link to the next set of results. - :type next_link: str + :ivar value: Required. The value. + :vartype value: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Operation] + :ivar next_link: Link to the next set of results. + :vartype next_link: str """ _validation = { @@ -3625,6 +4151,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The value. + :paramtype value: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Operation] + :keyword next_link: Link to the next set of results. + :paramtype next_link: str + """ super(OperationsList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3641,10 +4173,10 @@ class Order(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param contact_information: The contact details. - :type contact_information: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ContactDetails - :param shipping_address: The shipping address. - :type shipping_address: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.Address + :ivar contact_information: The contact details. + :vartype contact_information: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ContactDetails + :ivar shipping_address: The shipping address. + :vartype shipping_address: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.Address :ivar current_status: Current status of the order. :vartype current_status: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.OrderStatus :ivar order_history: List of status changes in the order. @@ -3659,9 +4191,9 @@ class Order(ARMBaseModel): whether it has an original or a replacement device. :vartype return_tracking_info: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.TrackingInfo] - :param shipment_type: ShipmentType of the order. Possible values include: "NotApplicable", + :ivar shipment_type: ShipmentType of the order. Possible values include: "NotApplicable", "ShippedToCustomer", "SelfPickup". - :type shipment_type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ShipmentType + :vartype shipment_type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ShipmentType """ _validation = { @@ -3697,6 +4229,17 @@ def __init__( shipment_type: Optional[Union[str, "ShipmentType"]] = None, **kwargs ): + """ + :keyword contact_information: The contact details. + :paramtype contact_information: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ContactDetails + :keyword shipping_address: The shipping address. + :paramtype shipping_address: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.Address + :keyword shipment_type: ShipmentType of the order. Possible values include: "NotApplicable", + "ShippedToCustomer", "SelfPickup". + :paramtype shipment_type: str or + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ShipmentType + """ super(Order, self).__init__(**kwargs) self.contact_information = contact_information self.shipping_address = shipping_address @@ -3733,6 +4276,8 @@ def __init__( self, **kwargs ): + """ + """ super(OrderList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3745,16 +4290,16 @@ class OrderStatus(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param status: Required. Status of the order as per the allowed status types. Possible values + :ivar status: Required. Status of the order as per the allowed status types. Possible values include: "Untracked", "AwaitingFulfilment", "AwaitingPreparation", "AwaitingShipment", "Shipped", "Arriving", "Delivered", "ReplacementRequested", "LostDevice", "Declined", "ReturnInitiated", "AwaitingReturnShipment", "ShippedBack", "CollectedAtMicrosoft", "AwaitingPickup", "PickupCompleted", "AwaitingDrop". - :type status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.OrderState + :vartype status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.OrderState :ivar update_date_time: Time of status update. :vartype update_date_time: ~datetime.datetime - :param comments: Comments related to this status change. - :type comments: str + :ivar comments: Comments related to this status change. + :vartype comments: str :ivar tracking_information: Tracking information related to the state in the ordering flow. :vartype tracking_information: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.TrackingInfo :ivar additional_order_details: Dictionary to hold generic information which is not stored @@ -3784,6 +4329,16 @@ def __init__( comments: Optional[str] = None, **kwargs ): + """ + :keyword status: Required. Status of the order as per the allowed status types. Possible values + include: "Untracked", "AwaitingFulfilment", "AwaitingPreparation", "AwaitingShipment", + "Shipped", "Arriving", "Delivered", "ReplacementRequested", "LostDevice", "Declined", + "ReturnInitiated", "AwaitingReturnShipment", "ShippedBack", "CollectedAtMicrosoft", + "AwaitingPickup", "PickupCompleted", "AwaitingDrop". + :paramtype status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.OrderState + :keyword comments: Comments related to this status change. + :paramtype comments: str + """ super(OrderStatus, self).__init__(**kwargs) self.status = status self.update_date_time = None @@ -3807,17 +4362,18 @@ class PeriodicTimerEventTrigger(Trigger): :vartype type: str :ivar system_data: Trigger in DataBoxEdge Resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: + :ivar kind: Required. Trigger Kind.Constant filled by server. Possible values include: "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.TriggerEventType - :param source_info: Required. Periodic timer details. - :type source_info: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.PeriodicTimerSourceInfo - :param sink_info: Required. Role Sink information. - :type sink_info: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against + :vartype kind: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.TriggerEventType + :ivar source_info: Required. Periodic timer details. + :vartype source_info: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.PeriodicTimerSourceInfo + :ivar sink_info: Required. Role Sink information. + :vartype sink_info: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleSinkInfo + :ivar custom_context_tag: A custom context tag typically used to correlate the trigger against its usage. For example, if a periodic timer trigger is intended for certain specific IoT modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str + :vartype custom_context_tag: str """ _validation = { @@ -3850,6 +4406,17 @@ def __init__( custom_context_tag: Optional[str] = None, **kwargs ): + """ + :keyword source_info: Required. Periodic timer details. + :paramtype source_info: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.PeriodicTimerSourceInfo + :keyword sink_info: Required. Role Sink information. + :paramtype sink_info: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleSinkInfo + :keyword custom_context_tag: A custom context tag typically used to correlate the trigger + against its usage. For example, if a periodic timer trigger is intended for certain specific + IoT modules in the device, the tag can be the name or the image URL of the module. + :paramtype custom_context_tag: str + """ super(PeriodicTimerEventTrigger, self).__init__(**kwargs) self.kind = 'PeriodicTimerEvent' # type: str self.source_info = source_info @@ -3862,15 +4429,15 @@ class PeriodicTimerSourceInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param start_time: Required. The time of the day that results in a valid trigger. Schedule is + :ivar start_time: Required. The time of the day that results in a valid trigger. Schedule is computed with reference to the time specified upto seconds. If timezone is not specified the time will considered to be in device timezone. The value will always be returned as UTC time. - :type start_time: ~datetime.datetime - :param schedule: Required. Periodic frequency at which timer event needs to be raised. Supports + :vartype start_time: ~datetime.datetime + :ivar schedule: Required. Periodic frequency at which timer event needs to be raised. Supports daily, hourly, minutes, and seconds. - :type schedule: str - :param topic: Topic where periodic events are published to IoT device. - :type topic: str + :vartype schedule: str + :ivar topic: Topic where periodic events are published to IoT device. + :vartype topic: str """ _validation = { @@ -3892,6 +4459,17 @@ def __init__( topic: Optional[str] = None, **kwargs ): + """ + :keyword start_time: Required. The time of the day that results in a valid trigger. Schedule is + computed with reference to the time specified upto seconds. If timezone is not specified the + time will considered to be in device timezone. The value will always be returned as UTC time. + :paramtype start_time: ~datetime.datetime + :keyword schedule: Required. Periodic frequency at which timer event needs to be raised. + Supports daily, hourly, minutes, and seconds. + :paramtype schedule: str + :keyword topic: Topic where periodic events are published to IoT device. + :paramtype topic: str + """ super(PeriodicTimerSourceInfo, self).__init__(**kwargs) self.start_time = start_time self.schedule = schedule @@ -3901,21 +4479,21 @@ def __init__( class RefreshDetails(msrest.serialization.Model): """Fields for tracking refresh job on the share or container. - :param in_progress_refresh_job_id: If a refresh job is currently in progress on this share or + :ivar in_progress_refresh_job_id: If a refresh job is currently in progress on this share or container, this field indicates the ARM resource ID of that job. The field is empty if no job is in progress. - :type in_progress_refresh_job_id: str - :param last_completed_refresh_job_time_in_utc: Indicates the completed time for the last - refresh job on this particular share or container, if any.This could be a failed job or a - successful job. - :type last_completed_refresh_job_time_in_utc: ~datetime.datetime - :param error_manifest_file: Indicates the relative path of the error xml for the last refresh + :vartype in_progress_refresh_job_id: str + :ivar last_completed_refresh_job_time_in_utc: Indicates the completed time for the last refresh + job on this particular share or container, if any.This could be a failed job or a successful + job. + :vartype last_completed_refresh_job_time_in_utc: ~datetime.datetime + :ivar error_manifest_file: Indicates the relative path of the error xml for the last refresh job on this particular share or container, if any. This could be a failed job or a successful job. - :type error_manifest_file: str - :param last_job: Indicates the id of the last refresh job on this particular share or + :vartype error_manifest_file: str + :ivar last_job: Indicates the id of the last refresh job on this particular share or container,if any. This could be a failed job or a successful job. - :type last_job: str + :vartype last_job: str """ _attribute_map = { @@ -3934,6 +4512,23 @@ def __init__( last_job: Optional[str] = None, **kwargs ): + """ + :keyword in_progress_refresh_job_id: If a refresh job is currently in progress on this share or + container, this field indicates the ARM resource ID of that job. The field is empty if no job + is in progress. + :paramtype in_progress_refresh_job_id: str + :keyword last_completed_refresh_job_time_in_utc: Indicates the completed time for the last + refresh job on this particular share or container, if any.This could be a failed job or a + successful job. + :paramtype last_completed_refresh_job_time_in_utc: ~datetime.datetime + :keyword error_manifest_file: Indicates the relative path of the error xml for the last refresh + job on this particular share or container, if any. This could be a failed job or a successful + job. + :paramtype error_manifest_file: str + :keyword last_job: Indicates the id of the last refresh job on this particular share or + container,if any. This could be a failed job or a successful job. + :paramtype last_job: str + """ super(RefreshDetails, self).__init__(**kwargs) self.in_progress_refresh_job_id = in_progress_refresh_job_id self.last_completed_refresh_job_time_in_utc = last_completed_refresh_job_time_in_utc @@ -3946,8 +4541,8 @@ class ResourceIdentity(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param type: Identity type. Possible values include: "None", "SystemAssigned", "UserAssigned". - :type type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.MsiIdentityType + :ivar type: Identity type. Possible values include: "None", "SystemAssigned", "UserAssigned". + :vartype type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.MsiIdentityType :ivar principal_id: Service Principal Id backing the Msi. :vartype principal_id: str :ivar tenant_id: Home Tenant Id. @@ -3971,6 +4566,11 @@ def __init__( type: Optional[Union[str, "MsiIdentityType"]] = None, **kwargs ): + """ + :keyword type: Identity type. Possible values include: "None", "SystemAssigned", + "UserAssigned". + :paramtype type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.MsiIdentityType + """ super(ResourceIdentity, self).__init__(**kwargs) self.type = type self.principal_id = None @@ -3980,13 +4580,13 @@ def __init__( class ResourceMoveDetails(msrest.serialization.Model): """Fields for tracking resource move. - :param operation_in_progress: Denotes whether move operation is in progress. Possible values + :ivar operation_in_progress: Denotes whether move operation is in progress. Possible values include: "None", "ResourceMoveInProgress", "ResourceMoveFailed". - :type operation_in_progress: str or + :vartype operation_in_progress: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ResourceMoveStatus - :param operation_in_progress_lock_timeout_in_utc: Denotes the timeout of the operation to + :ivar operation_in_progress_lock_timeout_in_utc: Denotes the timeout of the operation to finish. - :type operation_in_progress_lock_timeout_in_utc: ~datetime.datetime + :vartype operation_in_progress_lock_timeout_in_utc: ~datetime.datetime """ _attribute_map = { @@ -4001,6 +4601,15 @@ def __init__( operation_in_progress_lock_timeout_in_utc: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword operation_in_progress: Denotes whether move operation is in progress. Possible values + include: "None", "ResourceMoveInProgress", "ResourceMoveFailed". + :paramtype operation_in_progress: str or + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ResourceMoveStatus + :keyword operation_in_progress_lock_timeout_in_utc: Denotes the timeout of the operation to + finish. + :paramtype operation_in_progress_lock_timeout_in_utc: ~datetime.datetime + """ super(ResourceMoveDetails, self).__init__(**kwargs) self.operation_in_progress = operation_in_progress self.operation_in_progress_lock_timeout_in_utc = operation_in_progress_lock_timeout_in_utc @@ -4031,6 +4640,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceTypeSku, self).__init__(**kwargs) self.resource_type = None self.skus = None @@ -4061,6 +4672,8 @@ def __init__( self, **kwargs ): + """ + """ super(RoleList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4071,8 +4684,8 @@ class RoleSinkInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param role_id: Required. Compute role ID. - :type role_id: str + :ivar role_id: Required. Compute role ID. + :vartype role_id: str """ _validation = { @@ -4089,6 +4702,10 @@ def __init__( role_id: str, **kwargs ): + """ + :keyword role_id: Required. Compute role ID. + :paramtype role_id: str + """ super(RoleSinkInfo, self).__init__(**kwargs) self.role_id = role_id @@ -4106,11 +4723,11 @@ class SecuritySettings(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param device_admin_password: Required. Device administrator password as an encrypted string + :ivar device_admin_password: Required. Device administrator password as an encrypted string (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual password should have at least 8 characters that are a combination of uppercase, lowercase, numeric, and special characters. - :type device_admin_password: + :vartype device_admin_password: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AsymmetricEncryptedSecret """ @@ -4134,6 +4751,14 @@ def __init__( device_admin_password: "AsymmetricEncryptedSecret", **kwargs ): + """ + :keyword device_admin_password: Required. Device administrator password as an encrypted string + (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual + password should have at least 8 characters that are a combination of uppercase, lowercase, + numeric, and special characters. + :paramtype device_admin_password: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AsymmetricEncryptedSecret + """ super(SecuritySettings, self).__init__(**kwargs) self.device_admin_password = device_admin_password @@ -4141,8 +4766,8 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """Service specification. - :param metric_specifications: Metric specification as defined by shoebox. - :type metric_specifications: + :ivar metric_specifications: Metric specification as defined by shoebox. + :vartype metric_specifications: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricSpecificationV1] """ @@ -4156,6 +4781,11 @@ def __init__( metric_specifications: Optional[List["MetricSpecificationV1"]] = None, **kwargs ): + """ + :keyword metric_specifications: Metric specification as defined by shoebox. + :paramtype metric_specifications: + list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MetricSpecificationV1] + """ super(ServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications @@ -4175,36 +4805,36 @@ class Share(ARMBaseModel): :vartype type: str :ivar system_data: Share on ASE device. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - :param description: Description for the share. - :type description: str - :param share_status: Required. Current status of the share. Possible values include: "Offline", + :ivar description: Description for the share. + :vartype description: str + :ivar share_status: Required. Current status of the share. Possible values include: "Offline", "Unknown", "OK", "Updating", "NeedsAttention". - :type share_status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ShareStatus - :param monitoring_status: Required. Current monitoring status of the share. Possible values + :vartype share_status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ShareStatus + :ivar monitoring_status: Required. Current monitoring status of the share. Possible values include: "Enabled", "Disabled". - :type monitoring_status: str or + :vartype monitoring_status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.MonitoringStatus - :param azure_container_info: Azure container mapping for the share. - :type azure_container_info: + :ivar azure_container_info: Azure container mapping for the share. + :vartype azure_container_info: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AzureContainerInfo - :param access_protocol: Required. Access protocol to be used by the share. Possible values + :ivar access_protocol: Required. Access protocol to be used by the share. Possible values include: "SMB", "NFS". - :type access_protocol: str or + :vartype access_protocol: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ShareAccessProtocol - :param user_access_rights: Mapping of users and corresponding access rights on the share + :ivar user_access_rights: Mapping of users and corresponding access rights on the share (required for SMB protocol). - :type user_access_rights: + :vartype user_access_rights: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.UserAccessRight] - :param client_access_rights: List of IP addresses and corresponding access rights on the + :ivar client_access_rights: List of IP addresses and corresponding access rights on the share(required for NFS protocol). - :type client_access_rights: + :vartype client_access_rights: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.ClientAccessRight] - :param refresh_details: Details of the refresh job on this share. - :type refresh_details: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RefreshDetails + :ivar refresh_details: Details of the refresh job on this share. + :vartype refresh_details: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RefreshDetails :ivar share_mappings: Share mount point to the role. :vartype share_mappings: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MountPointMap] - :param data_policy: Data policy of the share. Possible values include: "Cloud", "Local". - :type data_policy: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataPolicy + :ivar data_policy: Data policy of the share. Possible values include: "Cloud", "Local". + :vartype data_policy: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataPolicy """ _validation = { @@ -4249,6 +4879,36 @@ def __init__( data_policy: Optional[Union[str, "DataPolicy"]] = None, **kwargs ): + """ + :keyword description: Description for the share. + :paramtype description: str + :keyword share_status: Required. Current status of the share. Possible values include: + "Offline", "Unknown", "OK", "Updating", "NeedsAttention". + :paramtype share_status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ShareStatus + :keyword monitoring_status: Required. Current monitoring status of the share. Possible values + include: "Enabled", "Disabled". + :paramtype monitoring_status: str or + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.MonitoringStatus + :keyword azure_container_info: Azure container mapping for the share. + :paramtype azure_container_info: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AzureContainerInfo + :keyword access_protocol: Required. Access protocol to be used by the share. Possible values + include: "SMB", "NFS". + :paramtype access_protocol: str or + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ShareAccessProtocol + :keyword user_access_rights: Mapping of users and corresponding access rights on the share + (required for SMB protocol). + :paramtype user_access_rights: + list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.UserAccessRight] + :keyword client_access_rights: List of IP addresses and corresponding access rights on the + share(required for NFS protocol). + :paramtype client_access_rights: + list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.ClientAccessRight] + :keyword refresh_details: Details of the refresh job on this share. + :paramtype refresh_details: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.RefreshDetails + :keyword data_policy: Data policy of the share. Possible values include: "Cloud", "Local". + :paramtype data_policy: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataPolicy + """ super(Share, self).__init__(**kwargs) self.system_data = None self.description = description @@ -4268,11 +4928,11 @@ class ShareAccessRight(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param share_id: Required. The share ID. - :type share_id: str - :param access_type: Required. Type of access to be allowed on the share for this user. Possible + :ivar share_id: Required. The share ID. + :vartype share_id: str + :ivar access_type: Required. Type of access to be allowed on the share for this user. Possible values include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ShareAccessType + :vartype access_type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ShareAccessType """ _validation = { @@ -4292,6 +4952,14 @@ def __init__( access_type: Union[str, "ShareAccessType"], **kwargs ): + """ + :keyword share_id: Required. The share ID. + :paramtype share_id: str + :keyword access_type: Required. Type of access to be allowed on the share for this user. + Possible values include: "Change", "Read", "Custom". + :paramtype access_type: str or + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ShareAccessType + """ super(ShareAccessRight, self).__init__(**kwargs) self.share_id = share_id self.access_type = access_type @@ -4322,6 +4990,8 @@ def __init__( self, **kwargs ): + """ + """ super(ShareList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4330,13 +5000,13 @@ def __init__( class Sku(msrest.serialization.Model): """The SKU type. - :param name: SKU name. Possible values include: "Gateway", "Edge", "TEA_1Node", - "TEA_1Node_UPS", "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", - "TEA_4Node_UPS_Heater", "TMA", "TDC", "TCA_Small", "GPU", "TCA_Large", "EdgeP_Base", - "EdgeP_High", "EdgePR_Base", "EdgePR_Base_UPS", "EdgeMR_Mini", "RCA_Small", "RCA_Large", "RDC". - :type name: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SkuName - :param tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard". - :type tier: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SkuTier + :ivar name: SKU name. Possible values include: "Gateway", "Edge", "TEA_1Node", "TEA_1Node_UPS", + "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", "TEA_4Node_UPS_Heater", "TMA", + "TDC", "TCA_Small", "GPU", "TCA_Large", "EdgeP_Base", "EdgeP_High", "EdgePR_Base", + "EdgePR_Base_UPS", "EdgeMR_Mini", "RCA_Small", "RCA_Large", "RDC". + :vartype name: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SkuName + :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard". + :vartype tier: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SkuTier """ _attribute_map = { @@ -4351,6 +5021,16 @@ def __init__( tier: Optional[Union[str, "SkuTier"]] = None, **kwargs ): + """ + :keyword name: SKU name. Possible values include: "Gateway", "Edge", "TEA_1Node", + "TEA_1Node_UPS", "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", + "TEA_4Node_UPS_Heater", "TMA", "TDC", "TCA_Small", "GPU", "TCA_Large", "EdgeP_Base", + "EdgeP_High", "EdgePR_Base", "EdgePR_Base_UPS", "EdgeMR_Mini", "RCA_Small", "RCA_Large", "RDC". + :paramtype name: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SkuName + :keyword tier: The SKU tier. This is based on the SKU name. Possible values include: + "Standard". + :paramtype tier: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SkuTier + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -4385,6 +5065,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuCost, self).__init__(**kwargs) self.meter_id = None self.quantity = None @@ -4445,6 +5127,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuInformation, self).__init__(**kwargs) self.name = None self.tier = None @@ -4482,6 +5166,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuInformationList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4516,6 +5202,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuLocationInfo, self).__init__(**kwargs) self.location = None self.zones = None @@ -4537,17 +5225,17 @@ class StorageAccount(ARMBaseModel): :vartype type: str :ivar system_data: StorageAccount object on ASE device. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - :param description: Description for the storage Account. - :type description: str - :param storage_account_status: Current status of the storage account. Possible values include: + :ivar description: Description for the storage Account. + :vartype description: str + :ivar storage_account_status: Current status of the storage account. Possible values include: "OK", "Offline", "Unknown", "Updating", "NeedsAttention". - :type storage_account_status: str or + :vartype storage_account_status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.StorageAccountStatus - :param data_policy: Required. Data policy of the storage Account. Possible values include: + :ivar data_policy: Required. Data policy of the storage Account. Possible values include: "Cloud", "Local". - :type data_policy: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataPolicy - :param storage_account_credential_id: Storage Account Credential Id. - :type storage_account_credential_id: str + :vartype data_policy: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataPolicy + :ivar storage_account_credential_id: Storage Account Credential Id. + :vartype storage_account_credential_id: str :ivar blob_endpoint: BlobEndpoint of Storage Account. :vartype blob_endpoint: str :ivar container_count: The Container Count. Present only for Storage Accounts with DataPolicy @@ -4587,6 +5275,19 @@ def __init__( storage_account_credential_id: Optional[str] = None, **kwargs ): + """ + :keyword description: Description for the storage Account. + :paramtype description: str + :keyword storage_account_status: Current status of the storage account. Possible values + include: "OK", "Offline", "Unknown", "Updating", "NeedsAttention". + :paramtype storage_account_status: str or + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.StorageAccountStatus + :keyword data_policy: Required. Data policy of the storage Account. Possible values include: + "Cloud", "Local". + :paramtype data_policy: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataPolicy + :keyword storage_account_credential_id: Storage Account Credential Id. + :paramtype storage_account_credential_id: str + """ super(StorageAccount, self).__init__(**kwargs) self.system_data = None self.description = description @@ -4612,25 +5313,26 @@ class StorageAccountCredential(ARMBaseModel): :vartype type: str :ivar system_data: StorageAccountCredential object. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - :param alias: Required. Alias for the storage account. - :type alias: str - :param user_name: Username for the storage account. - :type user_name: str - :param account_key: Encrypted storage key. - :type account_key: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AsymmetricEncryptedSecret - :param connection_string: Connection string for the storage account. Use this string if - username and account key are not specified. - :type connection_string: str - :param ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible values + :ivar alias: Required. Alias for the storage account. + :vartype alias: str + :ivar user_name: Username for the storage account. + :vartype user_name: str + :ivar account_key: Encrypted storage key. + :vartype account_key: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AsymmetricEncryptedSecret + :ivar connection_string: Connection string for the storage account. Use this string if username + and account key are not specified. + :vartype connection_string: str + :ivar ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible values include: "Enabled", "Disabled". - :type ssl_status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SSLStatus - :param blob_domain_name: Blob end point for private clouds. - :type blob_domain_name: str - :param account_type: Required. Type of storage accessed on the storage account. Possible values + :vartype ssl_status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SSLStatus + :ivar blob_domain_name: Blob end point for private clouds. + :vartype blob_domain_name: str + :ivar account_type: Required. Type of storage accessed on the storage account. Possible values include: "GeneralPurposeStorage", "BlobStorage". - :type account_type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AccountType - :param storage_account_id: Id of the storage account. - :type storage_account_id: str + :vartype account_type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AccountType + :ivar storage_account_id: Id of the storage account. + :vartype storage_account_id: str """ _validation = { @@ -4671,6 +5373,28 @@ def __init__( storage_account_id: Optional[str] = None, **kwargs ): + """ + :keyword alias: Required. Alias for the storage account. + :paramtype alias: str + :keyword user_name: Username for the storage account. + :paramtype user_name: str + :keyword account_key: Encrypted storage key. + :paramtype account_key: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AsymmetricEncryptedSecret + :keyword connection_string: Connection string for the storage account. Use this string if + username and account key are not specified. + :paramtype connection_string: str + :keyword ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible + values include: "Enabled", "Disabled". + :paramtype ssl_status: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SSLStatus + :keyword blob_domain_name: Blob end point for private clouds. + :paramtype blob_domain_name: str + :keyword account_type: Required. Type of storage accessed on the storage account. Possible + values include: "GeneralPurposeStorage", "BlobStorage". + :paramtype account_type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AccountType + :keyword storage_account_id: Id of the storage account. + :paramtype storage_account_id: str + """ super(StorageAccountCredential, self).__init__(**kwargs) self.system_data = None self.alias = alias @@ -4709,6 +5433,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountCredentialList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4739,6 +5465,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4747,10 +5475,10 @@ def __init__( class SubscriptionRegisteredFeatures(msrest.serialization.Model): """SubscriptionRegisteredFeatures. - :param name: - :type name: str - :param state: - :type state: str + :ivar name: + :vartype name: str + :ivar state: + :vartype state: str """ _attribute_map = { @@ -4765,6 +5493,12 @@ def __init__( state: Optional[str] = None, **kwargs ): + """ + :keyword name: + :paramtype name: str + :keyword state: + :paramtype state: str + """ super(SubscriptionRegisteredFeatures, self).__init__(**kwargs) self.name = name self.state = state @@ -4773,8 +5507,8 @@ def __init__( class SymmetricKey(msrest.serialization.Model): """Symmetric key for authentication. - :param connection_string: Connection string based on the symmetric key. - :type connection_string: + :ivar connection_string: Connection string based on the symmetric key. + :vartype connection_string: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AsymmetricEncryptedSecret """ @@ -4788,6 +5522,11 @@ def __init__( connection_string: Optional["AsymmetricEncryptedSecret"] = None, **kwargs ): + """ + :keyword connection_string: Connection string based on the symmetric key. + :paramtype connection_string: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AsymmetricEncryptedSecret + """ super(SymmetricKey, self).__init__(**kwargs) self.connection_string = connection_string @@ -4795,21 +5534,22 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or + :vartype last_modified_by_type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.CreatedByType - :param last_modified_at: The type of identity that last modified the resource. - :type last_modified_at: ~datetime.datetime + :ivar last_modified_at: The type of identity that last modified the resource. + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -4832,6 +5572,24 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.CreatedByType + :keyword last_modified_at: The type of identity that last modified the resource. + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -4844,14 +5602,14 @@ def __init__( class TrackingInfo(msrest.serialization.Model): """Tracking courier information. - :param serial_number: Serial number of the device being tracked. - :type serial_number: str - :param carrier_name: Name of the carrier used in the delivery. - :type carrier_name: str - :param tracking_id: Tracking ID of the shipment. - :type tracking_id: str - :param tracking_url: Tracking URL of the shipment. - :type tracking_url: str + :ivar serial_number: Serial number of the device being tracked. + :vartype serial_number: str + :ivar carrier_name: Name of the carrier used in the delivery. + :vartype carrier_name: str + :ivar tracking_id: Tracking ID of the shipment. + :vartype tracking_id: str + :ivar tracking_url: Tracking URL of the shipment. + :vartype tracking_url: str """ _attribute_map = { @@ -4870,6 +5628,16 @@ def __init__( tracking_url: Optional[str] = None, **kwargs ): + """ + :keyword serial_number: Serial number of the device being tracked. + :paramtype serial_number: str + :keyword carrier_name: Name of the carrier used in the delivery. + :paramtype carrier_name: str + :keyword tracking_id: Tracking ID of the shipment. + :paramtype tracking_id: str + :keyword tracking_url: Tracking URL of the shipment. + :paramtype tracking_url: str + """ super(TrackingInfo, self).__init__(**kwargs) self.serial_number = serial_number self.carrier_name = carrier_name @@ -4902,6 +5670,8 @@ def __init__( self, **kwargs ): + """ + """ super(TriggerList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4950,6 +5720,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateDownloadProgress, self).__init__(**kwargs) self.download_phase = None self.percent_complete = None @@ -4988,6 +5760,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateInstallProgress, self).__init__(**kwargs) self.percent_complete = None self.number_of_updates_to_install = None @@ -5005,15 +5779,15 @@ class UpdateSummary(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param device_version_number: The current version of the device in format: 1.2.17312.13.",. - :type device_version_number: str - :param friendly_device_version_name: The current version of the device in text format. - :type friendly_device_version_name: str - :param device_last_scanned_date_time: The last time when a scan was done on the device. - :type device_last_scanned_date_time: ~datetime.datetime - :param last_completed_scan_job_date_time: The time when the last scan job was completed + :ivar device_version_number: The current version of the device in format: 1.2.17312.13.",. + :vartype device_version_number: str + :ivar friendly_device_version_name: The current version of the device in text format. + :vartype friendly_device_version_name: str + :ivar device_last_scanned_date_time: The last time when a scan was done on the device. + :vartype device_last_scanned_date_time: ~datetime.datetime + :ivar last_completed_scan_job_date_time: The time when the last scan job was completed (success/cancelled/failed) on the appliance. - :type last_completed_scan_job_date_time: ~datetime.datetime + :vartype last_completed_scan_job_date_time: ~datetime.datetime :ivar last_completed_download_job_date_time: The time when the last Download job was completed (success/cancelled/failed) on the appliance. :vartype last_completed_download_job_date_time: ~datetime.datetime @@ -5102,6 +5876,17 @@ def __init__( last_completed_scan_job_date_time: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword device_version_number: The current version of the device in format: 1.2.17312.13.",. + :paramtype device_version_number: str + :keyword friendly_device_version_name: The current version of the device in text format. + :paramtype friendly_device_version_name: str + :keyword device_last_scanned_date_time: The last time when a scan was done on the device. + :paramtype device_last_scanned_date_time: ~datetime.datetime + :keyword last_completed_scan_job_date_time: The time when the last scan job was completed + (success/cancelled/failed) on the appliance. + :paramtype last_completed_scan_job_date_time: ~datetime.datetime + """ super(UpdateSummary, self).__init__(**kwargs) self.device_version_number = device_version_number self.friendly_device_version_name = friendly_device_version_name @@ -5127,12 +5912,12 @@ class UploadCertificateRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param authentication_type: The authentication type. Possible values include: "Invalid", + :ivar authentication_type: The authentication type. Possible values include: "Invalid", "AzureActiveDirectory". - :type authentication_type: str or + :vartype authentication_type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AuthenticationType - :param certificate: Required. The base64 encoded certificate raw data. - :type certificate: str + :ivar certificate: Required. The base64 encoded certificate raw data. + :vartype certificate: str """ _validation = { @@ -5151,6 +5936,14 @@ def __init__( authentication_type: Optional[Union[str, "AuthenticationType"]] = None, **kwargs ): + """ + :keyword authentication_type: The authentication type. Possible values include: "Invalid", + "AzureActiveDirectory". + :paramtype authentication_type: str or + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AuthenticationType + :keyword certificate: Required. The base64 encoded certificate raw data. + :paramtype certificate: str + """ super(UploadCertificateRequest, self).__init__(**kwargs) self.authentication_type = authentication_type self.certificate = certificate @@ -5161,9 +5954,10 @@ class UploadCertificateResponse(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param auth_type: Specifies authentication type. Possible values include: "Invalid", + :ivar auth_type: Specifies authentication type. Possible values include: "Invalid", "AzureActiveDirectory". - :type auth_type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AuthenticationType + :vartype auth_type: str or + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AuthenticationType :ivar resource_id: The resource ID of the Data Box Edge/Gateway device. :vartype resource_id: str :ivar aad_authority: Azure Active Directory tenant authority. @@ -5208,6 +6002,12 @@ def __init__( auth_type: Optional[Union[str, "AuthenticationType"]] = None, **kwargs ): + """ + :keyword auth_type: Specifies authentication type. Possible values include: "Invalid", + "AzureActiveDirectory". + :paramtype auth_type: str or + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AuthenticationType + """ super(UploadCertificateResponse, self).__init__(**kwargs) self.auth_type = auth_type self.resource_id = None @@ -5232,15 +6032,15 @@ class User(ARMBaseModel): :vartype type: str :ivar system_data: User in DataBoxEdge Resource. :vartype system_data: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SystemData - :param encrypted_password: The password details. - :type encrypted_password: + :ivar encrypted_password: The password details. + :vartype encrypted_password: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AsymmetricEncryptedSecret :ivar share_access_rights: List of shares that the user has rights on. This field should not be specified during user creation. :vartype share_access_rights: list[~azure.mgmt.databoxedge.v2020_09_01_preview.models.ShareAccessRight] - :param user_type: Type of the user. Possible values include: "Share", "LocalManagement", "ARM". - :type user_type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.UserType + :ivar user_type: Type of the user. Possible values include: "Share", "LocalManagement", "ARM". + :vartype user_type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.UserType """ _validation = { @@ -5268,6 +6068,14 @@ def __init__( user_type: Optional[Union[str, "UserType"]] = None, **kwargs ): + """ + :keyword encrypted_password: The password details. + :paramtype encrypted_password: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.AsymmetricEncryptedSecret + :keyword user_type: Type of the user. Possible values include: "Share", "LocalManagement", + "ARM". + :paramtype user_type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.UserType + """ super(User, self).__init__(**kwargs) self.system_data = None self.encrypted_password = encrypted_password @@ -5280,11 +6088,11 @@ class UserAccessRight(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param user_id: Required. User ID (already existing in the device). - :type user_id: str - :param access_type: Required. Type of access to be allowed for the user. Possible values + :ivar user_id: Required. User ID (already existing in the device). + :vartype user_id: str + :ivar access_type: Required. Type of access to be allowed for the user. Possible values include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ShareAccessType + :vartype access_type: str or ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ShareAccessType """ _validation = { @@ -5304,6 +6112,14 @@ def __init__( access_type: Union[str, "ShareAccessType"], **kwargs ): + """ + :keyword user_id: Required. User ID (already existing in the device). + :paramtype user_id: str + :keyword access_type: Required. Type of access to be allowed for the user. Possible values + include: "Change", "Read", "Custom". + :paramtype access_type: str or + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.ShareAccessType + """ super(UserAccessRight, self).__init__(**kwargs) self.user_id = user_id self.access_type = access_type @@ -5334,6 +6150,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserList, self).__init__(**kwargs) self.value = None self.next_link = None diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_addons_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_addons_operations.py index 9365bc2d7256..7398c674b263 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_addons_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_addons_operations.py @@ -5,25 +5,191 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_role_request( + device_name: str, + role_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + role_name: str, + addon_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "addonName": _SERIALIZER.url("addon_name", addon_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + role_name: str, + addon_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "addonName": _SERIALIZER.url("addon_name", addon_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + role_name: str, + addon_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "addonName": _SERIALIZER.url("addon_name", addon_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AddonsOperations(object): """AddonsOperations operations. @@ -47,14 +213,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_role( self, - device_name, # type: str - role_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AddonList"] + device_name: str, + role_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.AddonList"]: """Lists all the addons configured in the role. :param device_name: The device name. @@ -65,7 +231,8 @@ def list_by_role( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AddonList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.AddonList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.AddonList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AddonList"] @@ -73,37 +240,35 @@ def list_by_role( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_role.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_role_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_role.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_role_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AddonList', pipeline_response) + deserialized = self._deserialize("AddonList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -121,20 +286,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_role.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - role_name, # type: str - addon_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Addon" + device_name: str, + role_name: str, + addon_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Addon": """Gets a specific addon by name. :param device_name: The device name. @@ -155,29 +321,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -191,51 +347,42 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - role_name, # type: str - addon_name, # type: str - resource_group_name, # type: str - addon, # type: "_models.Addon" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Addon"] + device_name: str, + role_name: str, + addon_name: str, + resource_group_name: str, + addon: "_models.Addon", + **kwargs: Any + ) -> Optional["_models.Addon"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Addon"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(addon, 'Addon') + + request = build_create_or_update_request_initial( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(addon, 'Addon') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -251,18 +398,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - role_name, # type: str - addon_name, # type: str - resource_group_name, # type: str - addon, # type: "_models.Addon" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Addon"] + device_name: str, + role_name: str, + addon_name: str, + resource_group_name: str, + addon: "_models.Addon", + **kwargs: Any + ) -> LROPoller["_models.Addon"]: """Create or update a addon. :param device_name: The device name. @@ -277,15 +426,18 @@ def begin_create_or_update( :type addon: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.Addon :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Addon or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Addon] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Addon"] lro_delay = kwargs.pop( 'polling_interval', @@ -299,29 +451,21 @@ def begin_create_or_update( addon_name=addon_name, resource_group_name=resource_group_name, addon=addon, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Addon', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -333,45 +477,35 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore def _delete_initial( self, - device_name, # type: str - role_name, # type: str - addon_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + role_name: str, + addon_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -384,15 +518,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - role_name, # type: str - addon_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + role_name: str, + addon_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the addon on the device. :param device_name: The device name. @@ -405,15 +540,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -429,23 +566,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -457,4 +585,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_alerts_operations.py index 5621d275fc8f..da155f220ee8 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_alerts_operations.py @@ -5,23 +5,97 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AlertsOperations(object): """AlertsOperations operations. @@ -45,13 +119,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AlertList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.AlertList"]: """Gets all the alerts for a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -60,7 +134,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AlertList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.AlertList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.AlertList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertList"] @@ -68,36 +143,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AlertList', pipeline_response) + deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,19 +187,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Alert" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Alert": """Gets an alert by name. Gets an alert by name. @@ -148,28 +221,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,4 +246,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_available_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_available_skus_operations.py index 07119aad4c34..4de5c2452a3d 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_available_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_available_skus_operations.py @@ -5,23 +5,56 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/availableSkus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AvailableSkusOperations(object): """AvailableSkusOperations operations. @@ -45,18 +78,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DataBoxEdgeSkuList"] + **kwargs: Any + ) -> Iterable["_models.DataBoxEdgeSkuList"]: """List all the available Skus and information related to them. List all the available Skus and information related to them. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DataBoxEdgeSkuList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeSkuList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeSkuList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeSkuList"] @@ -64,34 +98,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeSkuList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeSkuList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -109,6 +138,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_bandwidth_schedules_operations.py index 9d8a3cd35b81..bdf79a262288 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_bandwidth_schedules_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class BandwidthSchedulesOperations(object): """BandwidthSchedulesOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BandwidthSchedulesList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.BandwidthSchedulesList"]: """Gets all the bandwidth schedules for a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -61,8 +219,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BandwidthSchedulesList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.BandwidthSchedulesList] + :return: An iterator like instance of either BandwidthSchedulesList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.BandwidthSchedulesList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedulesList"] @@ -70,36 +230,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BandwidthSchedulesList', pipeline_response) + deserialized = self._deserialize("BandwidthSchedulesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,19 +274,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BandwidthSchedule" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.BandwidthSchedule": """Gets the properties of the specified bandwidth schedule. :param device_name: The device name. @@ -148,28 +306,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,49 +331,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.BandwidthSchedule" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.BandwidthSchedule"] + device_name: str, + name: str, + resource_group_name: str, + parameters: "_models.BandwidthSchedule", + **kwargs: Any + ) -> Optional["_models.BandwidthSchedule"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BandwidthSchedule"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BandwidthSchedule') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BandwidthSchedule') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -241,17 +380,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.BandwidthSchedule" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BandwidthSchedule"] + device_name: str, + name: str, + resource_group_name: str, + parameters: "_models.BandwidthSchedule", + **kwargs: Any + ) -> LROPoller["_models.BandwidthSchedule"]: """Creates or updates a bandwidth schedule. :param device_name: The device name. @@ -264,15 +405,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.BandwidthSchedule :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either BandwidthSchedule or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.BandwidthSchedule] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BandwidthSchedule or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.BandwidthSchedule] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedule"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +431,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BandwidthSchedule', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -318,43 +457,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -367,14 +496,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the specified bandwidth schedule. :param device_name: The device name. @@ -385,15 +515,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -408,22 +540,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -435,4 +559,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_containers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_containers_operations.py index 5e8e117e34fe..b8e872b527c6 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_containers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_containers_operations.py @@ -5,25 +5,230 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_storage_account_request( + device_name: str, + storage_account_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + storage_account_name: str, + container_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + storage_account_name: str, + container_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + storage_account_name: str, + container_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_refresh_request_initial( + device_name: str, + storage_account_name: str, + container_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ContainersOperations(object): """ContainersOperations operations. @@ -47,14 +252,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_storage_account( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ContainerList"] + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ContainerList"]: """Lists all the containers of a storage Account in a Data Box Edge/Data Box Gateway device. Lists all the containers of a storage Account in a Data Box Edge/Data Box Gateway device. @@ -67,7 +272,8 @@ def list_by_storage_account( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ContainerList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.ContainerList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.ContainerList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerList"] @@ -75,37 +281,35 @@ def list_by_storage_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_storage_account.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_account_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_storage_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_account_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ContainerList', pipeline_response) + deserialized = self._deserialize("ContainerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -123,20 +327,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_storage_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Container" + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Container": """Gets a container by name. Gets a container by name. @@ -159,29 +364,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -195,51 +390,42 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - container, # type: "_models.Container" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Container"] + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + container: "_models.Container", + **kwargs: Any + ) -> Optional["_models.Container"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Container"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(container, 'Container') + + request = build_create_or_update_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(container, 'Container') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -255,18 +441,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - container, # type: "_models.Container" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Container"] + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + container: "_models.Container", + **kwargs: Any + ) -> LROPoller["_models.Container"]: """Creates a new container or updates an existing container on the device. Creates a new container or updates an existing container on the device. @@ -283,15 +471,19 @@ def begin_create_or_update( :type container: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.Container :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Container or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Container] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Container] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Container"] lro_delay = kwargs.pop( 'polling_interval', @@ -305,29 +497,21 @@ def begin_create_or_update( container_name=container_name, resource_group_name=resource_group_name, container=container, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Container', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -339,45 +523,35 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore def _delete_initial( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -390,15 +564,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the container on the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -411,15 +586,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -435,23 +612,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -463,45 +631,35 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore def _refresh_initial( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -514,15 +672,16 @@ def _refresh_initial( _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh'} # type: ignore + + @distributed_trace def begin_refresh( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Refreshes the container metadata with the data from the cloud. Refreshes the container metadata with the data from the cloud. @@ -537,15 +696,17 @@ def begin_refresh( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -561,23 +722,14 @@ def begin_refresh( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -589,4 +741,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_devices_operations.py index a058fb8f62d2..c87ab7863291 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_devices_operations.py @@ -5,25 +5,635 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_subscription_request( + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_download_updates_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_generate_certificate_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/generateCertificate') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_extended_information_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_install_updates_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_network_settings_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/networkSettings/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_scan_for_updates_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_security_settings_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_extended_information_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateExtendedInformation') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_update_summary_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_upload_certificate_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/uploadCertificate') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class DevicesOperations(object): """DevicesOperations operations. @@ -47,20 +657,22 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DataBoxEdgeDeviceList"] + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.DataBoxEdgeDeviceList"]: """Gets all the Data Box Edge/Data Box Gateway devices in a subscription. :param expand: Specify $expand=details to populate additional fields related to the resource or Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -68,36 +680,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,18 +722,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DataBoxEdgeDeviceList"] + resource_group_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.DataBoxEdgeDeviceList"]: """Gets all the Data Box Edge/Data Box Gateway devices in a resource group. :param resource_group_name: The resource group name. @@ -135,8 +743,10 @@ def list_by_resource_group( Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -144,37 +754,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -192,18 +798,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDevice" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DataBoxEdgeDevice": """Gets the properties of the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -220,27 +827,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -254,47 +851,38 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - resource_group_name, # type: str - data_box_edge_device, # type: "_models.DataBoxEdgeDevice" - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDevice" + device_name: str, + resource_group_name: str, + data_box_edge_device: "_models.DataBoxEdgeDevice", + **kwargs: Any + ) -> "_models.DataBoxEdgeDevice": cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') + + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -308,16 +896,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - resource_group_name, # type: str - data_box_edge_device, # type: "_models.DataBoxEdgeDevice" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DataBoxEdgeDevice"] + device_name: str, + resource_group_name: str, + data_box_edge_device: "_models.DataBoxEdgeDevice", + **kwargs: Any + ) -> LROPoller["_models.DataBoxEdgeDevice"]: """Creates or updates a Data Box Edge/Data Box Gateway resource. :param device_name: The device name. @@ -325,18 +915,24 @@ def begin_create_or_update( :param resource_group_name: The resource group name. :type resource_group_name: str :param data_box_edge_device: The resource object. - :type data_box_edge_device: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeDevice + :type data_box_edge_device: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeDevice :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DataBoxEdgeDevice or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeDevice] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DataBoxEdgeDevice or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeDevice] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] lro_delay = kwargs.pop( 'polling_interval', @@ -348,27 +944,21 @@ def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, data_box_edge_device=data_box_edge_device, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DataBoxEdgeDevice', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -380,41 +970,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore def _delete_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -427,13 +1007,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -442,15 +1023,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -464,21 +1047,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -490,16 +1066,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + @distributed_trace def update( self, - device_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.DataBoxEdgeDevicePatch" - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDevice" + device_name: str, + resource_group_name: str, + parameters: "_models.DataBoxEdgeDevicePatch", + **kwargs: Any + ) -> "_models.DataBoxEdgeDevice": """Modifies a Data Box Edge/Data Box Gateway resource. :param device_name: The device name. @@ -518,32 +1095,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -557,41 +1124,32 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + def _download_updates_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._download_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_download_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._download_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -604,13 +1162,14 @@ def _download_updates_initial( _download_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + + @distributed_trace def begin_download_updates( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Downloads the updates on a Data Box Edge/Data Box Gateway device. Downloads the updates on a Data Box Edge/Data Box Gateway device. @@ -621,15 +1180,17 @@ def begin_download_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -643,21 +1204,14 @@ def begin_download_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -669,15 +1223,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_download_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + @distributed_trace def generate_certificate( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.GenerateCertResponse" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.GenerateCertResponse": """Generates certificate for activation key. :param device_name: The device name. @@ -694,27 +1249,17 @@ def generate_certificate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.generate_certificate.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_generate_certificate_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.generate_certificate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -728,15 +1273,17 @@ def generate_certificate( return cls(pipeline_response, deserialized, {}) return deserialized + generate_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/generateCertificate'} # type: ignore + + @distributed_trace def get_extended_information( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDeviceExtendedInfo" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DataBoxEdgeDeviceExtendedInfo": """Gets additional information for the specified Azure Stack Edge/Data Box Gateway device. :param device_name: The device name. @@ -753,27 +1300,17 @@ def get_extended_information( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_extended_information.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_extended_information_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_extended_information.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -787,41 +1324,32 @@ def get_extended_information( return cls(pipeline_response, deserialized, {}) return deserialized + get_extended_information.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation'} # type: ignore + def _install_updates_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._install_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_install_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._install_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -834,13 +1362,14 @@ def _install_updates_initial( _install_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + + @distributed_trace def begin_install_updates( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Installs the updates on the Data Box Edge/Data Box Gateway device. Installs the updates on the Data Box Edge/Data Box Gateway device. @@ -851,15 +1380,17 @@ def begin_install_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -873,21 +1404,14 @@ def begin_install_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -899,15 +1423,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_install_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + @distributed_trace def get_network_settings( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.NetworkSettings" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.NetworkSettings": """Gets the network settings of the specified Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -924,27 +1449,17 @@ def get_network_settings( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_network_settings.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_network_settings_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_network_settings.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -958,41 +1473,32 @@ def get_network_settings( return cls(pipeline_response, deserialized, {}) return deserialized + get_network_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/networkSettings/default'} # type: ignore + def _scan_for_updates_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._scan_for_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_scan_for_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._scan_for_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1005,13 +1511,14 @@ def _scan_for_updates_initial( _scan_for_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore + + @distributed_trace def begin_scan_for_updates( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Scans for updates on a Data Box Edge/Data Box Gateway device. Scans for updates on a Data Box Edge/Data Box Gateway device. @@ -1022,15 +1529,17 @@ def begin_scan_for_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1044,21 +1553,14 @@ def begin_scan_for_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1070,47 +1572,37 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_scan_for_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore def _create_or_update_security_settings_initial( self, - device_name, # type: str - resource_group_name, # type: str - security_settings, # type: "_models.SecuritySettings" - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + security_settings: "_models.SecuritySettings", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_security_settings_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(security_settings, 'SecuritySettings') + + request = build_create_or_update_security_settings_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_security_settings_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(security_settings, 'SecuritySettings') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1123,14 +1615,15 @@ def _create_or_update_security_settings_initial( _create_or_update_security_settings_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + + @distributed_trace def begin_create_or_update_security_settings( self, - device_name, # type: str - resource_group_name, # type: str - security_settings, # type: "_models.SecuritySettings" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + security_settings: "_models.SecuritySettings", + **kwargs: Any + ) -> LROPoller[None]: """Updates the security settings on a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -1141,15 +1634,18 @@ def begin_create_or_update_security_settings( :type security_settings: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.SecuritySettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1161,24 +1657,18 @@ def begin_create_or_update_security_settings( device_name=device_name, resource_group_name=resource_group_name, security_settings=security_settings, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1190,16 +1680,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_security_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + @distributed_trace def update_extended_information( self, - device_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.DataBoxEdgeDeviceExtendedInfoPatch" - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDeviceExtendedInfo" + device_name: str, + resource_group_name: str, + parameters: "_models.DataBoxEdgeDeviceExtendedInfoPatch", + **kwargs: Any + ) -> "_models.DataBoxEdgeDeviceExtendedInfo": """Gets additional information for the specified Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -1207,7 +1698,8 @@ def update_extended_information( :param resource_group_name: The resource group name. :type resource_group_name: str :param parameters: The patch object. - :type parameters: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeDeviceExtendedInfoPatch + :type parameters: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeDeviceExtendedInfoPatch :keyword callable cls: A custom type or function that will be passed the direct response :return: DataBoxEdgeDeviceExtendedInfo, or the result of cls(response) :rtype: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.DataBoxEdgeDeviceExtendedInfo @@ -1218,32 +1710,22 @@ def update_extended_information( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update_extended_information.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'DataBoxEdgeDeviceExtendedInfoPatch') + + request = build_update_extended_information_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.update_extended_information.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataBoxEdgeDeviceExtendedInfoPatch') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1257,16 +1739,19 @@ def update_extended_information( return cls(pipeline_response, deserialized, {}) return deserialized + update_extended_information.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateExtendedInformation'} # type: ignore + + @distributed_trace def get_update_summary( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.UpdateSummary" - """Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.UpdateSummary": + """Gets information about the availability of updates based on the last scan of the device. It + also gets information about any ongoing download or install jobs on the device. Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. @@ -1285,27 +1770,17 @@ def get_update_summary( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_update_summary.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_update_summary_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_update_summary.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1319,16 +1794,18 @@ def get_update_summary( return cls(pipeline_response, deserialized, {}) return deserialized + get_update_summary.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default'} # type: ignore + + @distributed_trace def upload_certificate( self, - device_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.UploadCertificateRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.UploadCertificateResponse" + device_name: str, + resource_group_name: str, + parameters: "_models.UploadCertificateRequest", + **kwargs: Any + ) -> "_models.UploadCertificateResponse": """Uploads registration certificate for the device. :param device_name: The device name. @@ -1347,32 +1824,22 @@ def upload_certificate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.upload_certificate.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'UploadCertificateRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_upload_certificate_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.upload_certificate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'UploadCertificateRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1386,4 +1853,6 @@ def upload_certificate( return cls(pipeline_response, deserialized, {}) return deserialized + upload_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/uploadCertificate'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_jobs_operations.py index 3093099186b6..2ea616263064 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_jobs_operations.py @@ -5,22 +5,61 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class JobsOperations(object): """JobsOperations operations. @@ -44,14 +83,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Job" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Job": """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. @@ -72,28 +111,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -107,4 +136,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_monitoring_config_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_monitoring_config_operations.py index dfe56fe7e990..8bec6dd6f710 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_monitoring_config_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_monitoring_config_operations.py @@ -5,25 +5,185 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + device_name: str, + role_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + role_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + role_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + role_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class MonitoringConfigOperations(object): """MonitoringConfigOperations operations. @@ -47,14 +207,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - device_name, # type: str - role_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.MonitoringMetricConfigurationList"] + device_name: str, + role_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.MonitoringMetricConfigurationList"]: """Lists metric configurations in a role. Lists metric configurations in a role. @@ -66,8 +226,10 @@ def list( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MonitoringMetricConfigurationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MonitoringMetricConfigurationList] + :return: An iterator like instance of either MonitoringMetricConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MonitoringMetricConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringMetricConfigurationList"] @@ -75,37 +237,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('MonitoringMetricConfigurationList', pipeline_response) + deserialized = self._deserialize("MonitoringMetricConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -123,19 +283,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - role_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.MonitoringMetricConfiguration" + device_name: str, + role_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.MonitoringMetricConfiguration": """Gets a metric configuration of a role. Gets a metric configuration of a role. @@ -156,28 +317,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -191,49 +342,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - role_name, # type: str - resource_group_name, # type: str - monitoring_metric_configuration, # type: "_models.MonitoringMetricConfiguration" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.MonitoringMetricConfiguration"] + device_name: str, + role_name: str, + resource_group_name: str, + monitoring_metric_configuration: "_models.MonitoringMetricConfiguration", + **kwargs: Any + ) -> Optional["_models.MonitoringMetricConfiguration"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MonitoringMetricConfiguration"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(monitoring_metric_configuration, 'MonitoringMetricConfiguration') + + request = build_create_or_update_request_initial( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(monitoring_metric_configuration, 'MonitoringMetricConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -249,17 +391,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - role_name, # type: str - resource_group_name, # type: str - monitoring_metric_configuration, # type: "_models.MonitoringMetricConfiguration" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.MonitoringMetricConfiguration"] + device_name: str, + role_name: str, + resource_group_name: str, + monitoring_metric_configuration: "_models.MonitoringMetricConfiguration", + **kwargs: Any + ) -> LROPoller["_models.MonitoringMetricConfiguration"]: """Creates a new metric configuration or updates an existing one for a role. Creates a new metric configuration or updates an existing one for a role. @@ -271,18 +415,24 @@ def begin_create_or_update( :param resource_group_name: The resource group name. :type resource_group_name: str :param monitoring_metric_configuration: The metric configuration. - :type monitoring_metric_configuration: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.MonitoringMetricConfiguration + :type monitoring_metric_configuration: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.MonitoringMetricConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either MonitoringMetricConfiguration or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MonitoringMetricConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringMetricConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.MonitoringMetricConfiguration] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringMetricConfiguration"] lro_delay = kwargs.pop( 'polling_interval', @@ -295,28 +445,21 @@ def begin_create_or_update( role_name=role_name, resource_group_name=resource_group_name, monitoring_metric_configuration=monitoring_metric_configuration, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MonitoringMetricConfiguration', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -328,43 +471,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore def _delete_initial( self, - device_name, # type: str - role_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + role_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -377,14 +510,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - role_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + role_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """deletes a new metric configuration for a role. deletes a new metric configuration for a role. @@ -397,15 +531,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -420,22 +556,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -447,4 +575,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_nodes_operations.py index 64bd64238045..ededd2afaec5 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_nodes_operations.py @@ -5,23 +5,60 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/nodes') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class NodesOperations(object): """NodesOperations operations. @@ -45,13 +82,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.NodeList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.NodeList"]: """Gets all the nodes currently configured under this Data Box Edge device. :param device_name: The device name. @@ -60,7 +97,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either NodeList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.NodeList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.NodeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeList"] @@ -68,36 +106,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('NodeList', pipeline_response) + deserialized = self._deserialize("NodeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,6 +150,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_operations.py index 9a70248228a1..93ea89c6964a 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.DataBoxEdge/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,18 +72,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationsList"] + **kwargs: Any + ) -> Iterable["_models.OperationsList"]: """List all the supported operations. List all the supported operations. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationsList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.OperationsList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.OperationsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationsList"] @@ -64,30 +92,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationsList', pipeline_response) + deserialized = self._deserialize("OperationsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -105,6 +130,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_operations_status_operations.py index 16307b29fbfb..1782401e0855 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_operations_status_operations.py @@ -5,22 +5,61 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/operationsStatus/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class OperationsStatusOperations(object): """OperationsStatusOperations operations. @@ -44,14 +83,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Job" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Job": """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. @@ -72,28 +111,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -107,4 +136,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/operationsStatus/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_orders_operations.py index 603494a81f39..942170df83e0 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_orders_operations.py @@ -5,25 +5,212 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_dc_access_code_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default/listDCAccessCode') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class OrdersOperations(object): """OrdersOperations operations. @@ -47,13 +234,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OrderList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.OrderList"]: """Lists all the orders related to a Data Box Edge/Data Box Gateway device. Lists all the orders related to a Data Box Edge/Data Box Gateway device. @@ -64,7 +251,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OrderList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.OrderList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.OrderList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OrderList"] @@ -72,36 +260,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OrderList', pipeline_response) + deserialized = self._deserialize("OrderList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,18 +304,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Order" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Order": """Gets a specific order by name. Gets a specific order by name. @@ -149,27 +335,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,47 +359,38 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - resource_group_name, # type: str - order, # type: "_models.Order" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Order"] + device_name: str, + resource_group_name: str, + order: "_models.Order", + **kwargs: Any + ) -> Optional["_models.Order"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Order"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(order, 'Order') + + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(order, 'Order') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,16 +406,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - resource_group_name, # type: str - order, # type: "_models.Order" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Order"] + device_name: str, + resource_group_name: str, + order: "_models.Order", + **kwargs: Any + ) -> LROPoller["_models.Order"]: """Creates or updates an order. Creates or updates an order. @@ -261,15 +430,18 @@ def begin_create_or_update( :type order: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.Order :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Order or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Order] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Order"] lro_delay = kwargs.pop( 'polling_interval', @@ -281,27 +453,21 @@ def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, order=order, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Order', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -313,41 +479,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore def _delete_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -360,13 +516,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the order related to the device. Deletes the order related to the device. @@ -377,15 +534,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -399,21 +558,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -425,15 +577,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + @distributed_trace def list_dc_access_code( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DCAccessCode" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DCAccessCode": """Gets the DCAccess Code. Gets the DCAccess Code. @@ -452,27 +605,17 @@ def list_dc_access_code( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_dc_access_code.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_dc_access_code_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_dc_access_code.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -486,4 +629,6 @@ def list_dc_access_code( return cls(pipeline_response, deserialized, {}) return deserialized + list_dc_access_code.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default/listDCAccessCode'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_roles_operations.py index 2a5c33e838ce..d58adbe919bb 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_roles_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class RolesOperations(object): """RolesOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RoleList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.RoleList"]: """Lists all the roles configured in a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -62,7 +220,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RoleList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.RoleList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleList"] @@ -70,36 +229,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RoleList', pipeline_response) + deserialized = self._deserialize("RoleList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,19 +273,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Role" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Role": """Gets a specific role by name. :param device_name: The device name. @@ -148,28 +305,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,49 +330,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - role, # type: "_models.Role" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Role"] + device_name: str, + name: str, + resource_group_name: str, + role: "_models.Role", + **kwargs: Any + ) -> Optional["_models.Role"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Role"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(role, 'Role') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(role, 'Role') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -241,17 +379,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - role, # type: "_models.Role" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Role"] + device_name: str, + name: str, + resource_group_name: str, + role: "_models.Role", + **kwargs: Any + ) -> LROPoller["_models.Role"]: """Create or update a role. :param device_name: The device name. @@ -264,15 +404,18 @@ def begin_create_or_update( :type role: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.Role :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Role or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Role] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Role"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +428,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, role=role, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Role', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -318,43 +454,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -367,14 +493,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the role on the device. :param device_name: The device name. @@ -385,15 +512,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -408,22 +537,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -435,4 +556,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_shares_operations.py index 501d30d91ea7..cedefa31ea69 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_shares_operations.py @@ -5,25 +5,220 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_refresh_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SharesOperations(object): """SharesOperations operations. @@ -47,13 +242,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ShareList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ShareList"]: """Lists all the shares in a Data Box Edge/Data Box Gateway device. Lists all the shares in a Data Box Edge/Data Box Gateway device. @@ -64,7 +259,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ShareList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.ShareList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.ShareList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ShareList"] @@ -72,36 +268,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ShareList', pipeline_response) + deserialized = self._deserialize("ShareList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +312,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Share" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Share": """Gets a share by name. Gets a share by name. @@ -152,28 +346,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -187,49 +371,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - share, # type: "_models.Share" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Share"] + device_name: str, + name: str, + resource_group_name: str, + share: "_models.Share", + **kwargs: Any + ) -> Optional["_models.Share"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Share"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(share, 'Share') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(share, 'Share') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,17 +420,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - share, # type: "_models.Share" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Share"] + device_name: str, + name: str, + resource_group_name: str, + share: "_models.Share", + **kwargs: Any + ) -> LROPoller["_models.Share"]: """Creates a new share or updates an existing share on the device. Creates a new share or updates an existing share on the device. @@ -270,15 +447,18 @@ def begin_create_or_update( :type share: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.Share :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Share or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Share] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Share"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +471,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, share=share, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Share', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -324,43 +497,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,14 +536,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the share on the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -391,15 +555,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -414,22 +580,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -441,43 +599,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore def _refresh_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -490,14 +638,15 @@ def _refresh_initial( _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore + + @distributed_trace def begin_refresh( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Refreshes the share metadata with the data from the cloud. Refreshes the share metadata with the data from the cloud. @@ -510,15 +659,17 @@ def begin_refresh( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -533,22 +684,14 @@ def begin_refresh( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -560,4 +703,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_storage_account_credentials_operations.py index 5f47caaaf368..c472e3ff47d4 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_storage_account_credentials_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class StorageAccountCredentialsOperations(object): """StorageAccountCredentialsOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountCredentialList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountCredentialList"]: """Gets all the storage account credentials in a Data Box Edge/Data Box Gateway device. Gets all the storage account credentials in a Data Box Edge/Data Box Gateway device. @@ -63,8 +221,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountCredentialList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.StorageAccountCredentialList] + :return: An iterator like instance of either StorageAccountCredentialList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.StorageAccountCredentialList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredentialList"] @@ -72,36 +232,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('StorageAccountCredentialList', pipeline_response) + deserialized = self._deserialize("StorageAccountCredentialList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +276,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountCredential" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.StorageAccountCredential": """Gets the properties of the specified storage account credential. :param device_name: The device name. @@ -150,28 +308,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,49 +333,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - storage_account_credential, # type: "_models.StorageAccountCredential" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageAccountCredential"] + device_name: str, + name: str, + resource_group_name: str, + storage_account_credential: "_models.StorageAccountCredential", + **kwargs: Any + ) -> Optional["_models.StorageAccountCredential"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccountCredential"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(storage_account_credential, 'StorageAccountCredential') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_account_credential, 'StorageAccountCredential') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -243,17 +382,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - storage_account_credential, # type: "_models.StorageAccountCredential" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageAccountCredential"] + device_name: str, + name: str, + resource_group_name: str, + storage_account_credential: "_models.StorageAccountCredential", + **kwargs: Any + ) -> LROPoller["_models.StorageAccountCredential"]: """Creates or updates the storage account credential. :param device_name: The device name. @@ -263,18 +404,24 @@ def begin_create_or_update( :param resource_group_name: The resource group name. :type resource_group_name: str :param storage_account_credential: The storage account credential. - :type storage_account_credential: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.StorageAccountCredential + :type storage_account_credential: + ~azure.mgmt.databoxedge.v2020_09_01_preview.models.StorageAccountCredential :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either StorageAccountCredential or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.StorageAccountCredential] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either StorageAccountCredential or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.StorageAccountCredential] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredential"] lro_delay = kwargs.pop( 'polling_interval', @@ -287,28 +434,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, storage_account_credential=storage_account_credential, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccountCredential', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -320,43 +460,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -369,14 +499,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the storage account credential. :param device_name: The device name. @@ -387,15 +518,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -410,22 +543,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -437,4 +562,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_storage_accounts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_storage_accounts_operations.py index 0aac41580fed..f8df98de0f8c 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_storage_accounts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_storage_accounts_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + storage_account_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + storage_account_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + storage_account_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountList"]: """Lists all the StorageAccounts in a Data Box Edge/Data Box Gateway device. Lists all the StorageAccounts in a Data Box Edge/Data Box Gateway device. @@ -64,7 +222,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either StorageAccountList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.StorageAccountList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.StorageAccountList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountList"] @@ -72,36 +231,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('StorageAccountList', pipeline_response) + deserialized = self._deserialize("StorageAccountList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +275,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.StorageAccount": """Gets a StorageAccount by name. Gets a StorageAccount by name. @@ -152,28 +309,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -187,49 +334,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - storage_account, # type: "_models.StorageAccount" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageAccount"] + device_name: str, + storage_account_name: str, + resource_group_name: str, + storage_account: "_models.StorageAccount", + **kwargs: Any + ) -> Optional["_models.StorageAccount"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(storage_account, 'StorageAccount') + + request = build_create_or_update_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_account, 'StorageAccount') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,17 +383,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - storage_account, # type: "_models.StorageAccount" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageAccount"] + device_name: str, + storage_account_name: str, + resource_group_name: str, + storage_account: "_models.StorageAccount", + **kwargs: Any + ) -> LROPoller["_models.StorageAccount"]: """Creates a new StorageAccount or updates an existing StorageAccount on the device. Creates a new StorageAccount or updates an existing StorageAccount on the device. @@ -270,15 +410,20 @@ def begin_create_or_update( :type storage_account: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.StorageAccount :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either StorageAccount or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +436,21 @@ def begin_create_or_update( storage_account_name=storage_account_name, resource_group_name=resource_group_name, storage_account=storage_account, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -324,43 +462,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore def _delete_initial( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,14 +501,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the StorageAccount on the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -391,15 +520,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -414,22 +545,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -441,4 +564,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_triggers_operations.py index 107270847ee8..e733af37b5a3 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_triggers_operations.py @@ -5,25 +5,187 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class TriggersOperations(object): """TriggersOperations operations. @@ -47,14 +209,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.TriggerList"] + device_name: str, + resource_group_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.TriggerList"]: """Lists all the triggers configured in the device. :param device_name: The device name. @@ -66,7 +228,8 @@ def list_by_data_box_edge_device( :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TriggerList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.TriggerList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.TriggerList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TriggerList"] @@ -74,38 +237,35 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TriggerList', pipeline_response) + deserialized = self._deserialize("TriggerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -123,19 +283,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Trigger" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Trigger": """Get a specific trigger by name. :param device_name: The device name. @@ -154,28 +315,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -189,49 +340,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - trigger, # type: "_models.Trigger" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Trigger"] + device_name: str, + name: str, + resource_group_name: str, + trigger: "_models.Trigger", + **kwargs: Any + ) -> Optional["_models.Trigger"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Trigger"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(trigger, 'Trigger') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(trigger, 'Trigger') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,17 +389,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - trigger, # type: "_models.Trigger" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Trigger"] + device_name: str, + name: str, + resource_group_name: str, + trigger: "_models.Trigger", + **kwargs: Any + ) -> LROPoller["_models.Trigger"]: """Creates or updates a trigger. :param device_name: Creates or updates a trigger. @@ -270,15 +414,19 @@ def begin_create_or_update( :type trigger: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.Trigger :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Trigger or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Trigger] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.Trigger] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Trigger"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +439,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, trigger=trigger, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Trigger', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -324,43 +465,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,14 +504,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the trigger on the gateway device. :param device_name: The device name. @@ -391,15 +523,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -414,22 +548,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -441,4 +567,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_users_operations.py index 569bcc44fd46..0aa862773b85 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_users_operations.py @@ -5,25 +5,187 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class UsersOperations(object): """UsersOperations operations. @@ -47,14 +209,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UserList"] + device_name: str, + resource_group_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.UserList"]: """Gets all the users registered on a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -66,7 +228,8 @@ def list_by_data_box_edge_device( :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.UserList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2020_09_01_preview.models.UserList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UserList"] @@ -74,38 +237,35 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('UserList', pipeline_response) + deserialized = self._deserialize("UserList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -123,19 +283,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.User" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.User": """Gets the properties of the specified user. :param device_name: The device name. @@ -154,28 +315,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -189,49 +340,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - user, # type: "_models.User" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.User"] + device_name: str, + name: str, + resource_group_name: str, + user: "_models.User", + **kwargs: Any + ) -> Optional["_models.User"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.User"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(user, 'User') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(user, 'User') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,17 +389,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - user, # type: "_models.User" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.User"] + device_name: str, + name: str, + resource_group_name: str, + user: "_models.User", + **kwargs: Any + ) -> LROPoller["_models.User"]: """Creates a new user or updates an existing user's information on a Data Box Edge/Data Box Gateway device. @@ -271,15 +415,18 @@ def begin_create_or_update( :type user: ~azure.mgmt.databoxedge.v2020_09_01_preview.models.User :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either User or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2020_09_01_preview.models.User] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.User"] lro_delay = kwargs.pop( 'polling_interval', @@ -292,28 +439,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, user=user, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('User', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -325,43 +465,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -374,14 +504,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the user on a databox edge/gateway device. :param device_name: The device name. @@ -392,15 +523,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -415,22 +548,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -442,4 +567,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/__init__.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/__init__.py new file mode 100644 index 000000000000..577ebf317c02 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/__init__.py @@ -0,0 +1,18 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._data_box_edge_management_client import DataBoxEdgeManagementClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['DataBoxEdgeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_configuration.py new file mode 100644 index 000000000000..9e675b620ff4 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_configuration.py @@ -0,0 +1,68 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class DataBoxEdgeManagementClientConfiguration(Configuration): + """Configuration for DataBoxEdgeManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The subscription ID. + :type subscription_id: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-02-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-databoxedge/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_data_box_edge_management_client.py new file mode 100644 index 000000000000..a2515d98f3fd --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_data_box_edge_management_client.py @@ -0,0 +1,157 @@ +# 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 copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +from . import models +from ._configuration import DataBoxEdgeManagementClientConfiguration +from .operations import AddonsOperations, AlertsOperations, AvailableSkusOperations, BandwidthSchedulesOperations, ContainersOperations, DevicesOperations, DiagnosticSettingsOperations, JobsOperations, MonitoringConfigOperations, NodesOperations, Operations, OperationsStatusOperations, OrdersOperations, RolesOperations, SharesOperations, StorageAccountCredentialsOperations, StorageAccountsOperations, SupportPackagesOperations, TriggersOperations, UsersOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + +class DataBoxEdgeManagementClient: + """The DataBoxEdge Client. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.databoxedge.v2021_02_01.operations.Operations + :ivar available_skus: AvailableSkusOperations operations + :vartype available_skus: azure.mgmt.databoxedge.v2021_02_01.operations.AvailableSkusOperations + :ivar devices: DevicesOperations operations + :vartype devices: azure.mgmt.databoxedge.v2021_02_01.operations.DevicesOperations + :ivar alerts: AlertsOperations operations + :vartype alerts: azure.mgmt.databoxedge.v2021_02_01.operations.AlertsOperations + :ivar bandwidth_schedules: BandwidthSchedulesOperations operations + :vartype bandwidth_schedules: + azure.mgmt.databoxedge.v2021_02_01.operations.BandwidthSchedulesOperations + :ivar diagnostic_settings: DiagnosticSettingsOperations operations + :vartype diagnostic_settings: + azure.mgmt.databoxedge.v2021_02_01.operations.DiagnosticSettingsOperations + :ivar jobs: JobsOperations operations + :vartype jobs: azure.mgmt.databoxedge.v2021_02_01.operations.JobsOperations + :ivar nodes: NodesOperations operations + :vartype nodes: azure.mgmt.databoxedge.v2021_02_01.operations.NodesOperations + :ivar operations_status: OperationsStatusOperations operations + :vartype operations_status: + azure.mgmt.databoxedge.v2021_02_01.operations.OperationsStatusOperations + :ivar orders: OrdersOperations operations + :vartype orders: azure.mgmt.databoxedge.v2021_02_01.operations.OrdersOperations + :ivar roles: RolesOperations operations + :vartype roles: azure.mgmt.databoxedge.v2021_02_01.operations.RolesOperations + :ivar addons: AddonsOperations operations + :vartype addons: azure.mgmt.databoxedge.v2021_02_01.operations.AddonsOperations + :ivar monitoring_config: MonitoringConfigOperations operations + :vartype monitoring_config: + azure.mgmt.databoxedge.v2021_02_01.operations.MonitoringConfigOperations + :ivar shares: SharesOperations operations + :vartype shares: azure.mgmt.databoxedge.v2021_02_01.operations.SharesOperations + :ivar storage_account_credentials: StorageAccountCredentialsOperations operations + :vartype storage_account_credentials: + azure.mgmt.databoxedge.v2021_02_01.operations.StorageAccountCredentialsOperations + :ivar storage_accounts: StorageAccountsOperations operations + :vartype storage_accounts: + azure.mgmt.databoxedge.v2021_02_01.operations.StorageAccountsOperations + :ivar containers: ContainersOperations operations + :vartype containers: azure.mgmt.databoxedge.v2021_02_01.operations.ContainersOperations + :ivar triggers: TriggersOperations operations + :vartype triggers: azure.mgmt.databoxedge.v2021_02_01.operations.TriggersOperations + :ivar support_packages: SupportPackagesOperations operations + :vartype support_packages: + azure.mgmt.databoxedge.v2021_02_01.operations.SupportPackagesOperations + :ivar users: UsersOperations operations + :vartype users: azure.mgmt.databoxedge.v2021_02_01.operations.UsersOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The subscription ID. + :type subscription_id: str + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = DataBoxEdgeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.available_skus = AvailableSkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bandwidth_schedules = BandwidthSchedulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.diagnostic_settings = DiagnosticSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations_status = OperationsStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) + self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize) + self.monitoring_config = MonitoringConfigOperations(self._client, self._config, self._serialize, self._deserialize) + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_account_credentials = StorageAccountCredentialsOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) + self.support_packages = SupportPackagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> DataBoxEdgeManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_metadata.json b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_metadata.json new file mode 100644 index 000000000000..8fe11bcdb5c0 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_metadata.json @@ -0,0 +1,121 @@ +{ + "chosen_version": "2021-02-01", + "total_api_version_list": ["2021-02-01"], + "client": { + "name": "DataBoxEdgeManagementClient", + "filename": "_data_box_edge_management_client", + "description": "The DataBoxEdge Client.", + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The subscription ID.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The subscription ID.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=\"https://management.azure.com\", # type: str", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "operations": "Operations", + "available_skus": "AvailableSkusOperations", + "devices": "DevicesOperations", + "alerts": "AlertsOperations", + "bandwidth_schedules": "BandwidthSchedulesOperations", + "diagnostic_settings": "DiagnosticSettingsOperations", + "jobs": "JobsOperations", + "nodes": "NodesOperations", + "operations_status": "OperationsStatusOperations", + "orders": "OrdersOperations", + "roles": "RolesOperations", + "addons": "AddonsOperations", + "monitoring_config": "MonitoringConfigOperations", + "shares": "SharesOperations", + "storage_account_credentials": "StorageAccountCredentialsOperations", + "storage_accounts": "StorageAccountsOperations", + "containers": "ContainersOperations", + "triggers": "TriggersOperations", + "support_packages": "SupportPackagesOperations", + "users": "UsersOperations" + } +} \ No newline at end of file diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_patch.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_vendor.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_version.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/__init__.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/__init__.py new file mode 100644 index 000000000000..f33cac1fd9b0 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/__init__.py @@ -0,0 +1,15 @@ +# 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 ._data_box_edge_management_client import DataBoxEdgeManagementClient +__all__ = ['DataBoxEdgeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/_configuration.py new file mode 100644 index 000000000000..037bf8fbf4f3 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class DataBoxEdgeManagementClientConfiguration(Configuration): + """Configuration for DataBoxEdgeManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The subscription ID. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-02-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-databoxedge/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/_data_box_edge_management_client.py new file mode 100644 index 000000000000..12dd034ee976 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/_data_box_edge_management_client.py @@ -0,0 +1,155 @@ +# 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 copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +from .. import models +from ._configuration import DataBoxEdgeManagementClientConfiguration +from .operations import AddonsOperations, AlertsOperations, AvailableSkusOperations, BandwidthSchedulesOperations, ContainersOperations, DevicesOperations, DiagnosticSettingsOperations, JobsOperations, MonitoringConfigOperations, NodesOperations, Operations, OperationsStatusOperations, OrdersOperations, RolesOperations, SharesOperations, StorageAccountCredentialsOperations, StorageAccountsOperations, SupportPackagesOperations, TriggersOperations, UsersOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +class DataBoxEdgeManagementClient: + """The DataBoxEdge Client. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.databoxedge.v2021_02_01.aio.operations.Operations + :ivar available_skus: AvailableSkusOperations operations + :vartype available_skus: + azure.mgmt.databoxedge.v2021_02_01.aio.operations.AvailableSkusOperations + :ivar devices: DevicesOperations operations + :vartype devices: azure.mgmt.databoxedge.v2021_02_01.aio.operations.DevicesOperations + :ivar alerts: AlertsOperations operations + :vartype alerts: azure.mgmt.databoxedge.v2021_02_01.aio.operations.AlertsOperations + :ivar bandwidth_schedules: BandwidthSchedulesOperations operations + :vartype bandwidth_schedules: + azure.mgmt.databoxedge.v2021_02_01.aio.operations.BandwidthSchedulesOperations + :ivar diagnostic_settings: DiagnosticSettingsOperations operations + :vartype diagnostic_settings: + azure.mgmt.databoxedge.v2021_02_01.aio.operations.DiagnosticSettingsOperations + :ivar jobs: JobsOperations operations + :vartype jobs: azure.mgmt.databoxedge.v2021_02_01.aio.operations.JobsOperations + :ivar nodes: NodesOperations operations + :vartype nodes: azure.mgmt.databoxedge.v2021_02_01.aio.operations.NodesOperations + :ivar operations_status: OperationsStatusOperations operations + :vartype operations_status: + azure.mgmt.databoxedge.v2021_02_01.aio.operations.OperationsStatusOperations + :ivar orders: OrdersOperations operations + :vartype orders: azure.mgmt.databoxedge.v2021_02_01.aio.operations.OrdersOperations + :ivar roles: RolesOperations operations + :vartype roles: azure.mgmt.databoxedge.v2021_02_01.aio.operations.RolesOperations + :ivar addons: AddonsOperations operations + :vartype addons: azure.mgmt.databoxedge.v2021_02_01.aio.operations.AddonsOperations + :ivar monitoring_config: MonitoringConfigOperations operations + :vartype monitoring_config: + azure.mgmt.databoxedge.v2021_02_01.aio.operations.MonitoringConfigOperations + :ivar shares: SharesOperations operations + :vartype shares: azure.mgmt.databoxedge.v2021_02_01.aio.operations.SharesOperations + :ivar storage_account_credentials: StorageAccountCredentialsOperations operations + :vartype storage_account_credentials: + azure.mgmt.databoxedge.v2021_02_01.aio.operations.StorageAccountCredentialsOperations + :ivar storage_accounts: StorageAccountsOperations operations + :vartype storage_accounts: + azure.mgmt.databoxedge.v2021_02_01.aio.operations.StorageAccountsOperations + :ivar containers: ContainersOperations operations + :vartype containers: azure.mgmt.databoxedge.v2021_02_01.aio.operations.ContainersOperations + :ivar triggers: TriggersOperations operations + :vartype triggers: azure.mgmt.databoxedge.v2021_02_01.aio.operations.TriggersOperations + :ivar support_packages: SupportPackagesOperations operations + :vartype support_packages: + azure.mgmt.databoxedge.v2021_02_01.aio.operations.SupportPackagesOperations + :ivar users: UsersOperations operations + :vartype users: azure.mgmt.databoxedge.v2021_02_01.aio.operations.UsersOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The subscription ID. + :type subscription_id: str + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = DataBoxEdgeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.available_skus = AvailableSkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bandwidth_schedules = BandwidthSchedulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.diagnostic_settings = DiagnosticSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations_status = OperationsStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) + self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize) + self.monitoring_config = MonitoringConfigOperations(self._client, self._config, self._serialize, self._deserialize) + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_account_credentials = StorageAccountCredentialsOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) + self.support_packages = SupportPackagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "DataBoxEdgeManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/_patch.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/__init__.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/__init__.py new file mode 100644 index 000000000000..fc7347b19d14 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/__init__.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._available_skus_operations import AvailableSkusOperations +from ._devices_operations import DevicesOperations +from ._alerts_operations import AlertsOperations +from ._bandwidth_schedules_operations import BandwidthSchedulesOperations +from ._diagnostic_settings_operations import DiagnosticSettingsOperations +from ._jobs_operations import JobsOperations +from ._nodes_operations import NodesOperations +from ._operations_status_operations import OperationsStatusOperations +from ._orders_operations import OrdersOperations +from ._roles_operations import RolesOperations +from ._addons_operations import AddonsOperations +from ._monitoring_config_operations import MonitoringConfigOperations +from ._shares_operations import SharesOperations +from ._storage_account_credentials_operations import StorageAccountCredentialsOperations +from ._storage_accounts_operations import StorageAccountsOperations +from ._containers_operations import ContainersOperations +from ._triggers_operations import TriggersOperations +from ._support_packages_operations import SupportPackagesOperations +from ._users_operations import UsersOperations + +__all__ = [ + 'Operations', + 'AvailableSkusOperations', + 'DevicesOperations', + 'AlertsOperations', + 'BandwidthSchedulesOperations', + 'DiagnosticSettingsOperations', + 'JobsOperations', + 'NodesOperations', + 'OperationsStatusOperations', + 'OrdersOperations', + 'RolesOperations', + 'AddonsOperations', + 'MonitoringConfigOperations', + 'SharesOperations', + 'StorageAccountCredentialsOperations', + 'StorageAccountsOperations', + 'ContainersOperations', + 'TriggersOperations', + 'SupportPackagesOperations', + 'UsersOperations', +] diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_addons_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_addons_operations.py new file mode 100644 index 000000000000..0d4c1cdbca7c --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_addons_operations.py @@ -0,0 +1,424 @@ +# 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 functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._addons_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_role_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AddonsOperations: + """AddonsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_role( + self, + device_name: str, + role_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.AddonList"]: + """Lists all the addons configured in the role. + + :param device_name: The device name. + :type device_name: str + :param role_name: The role name. + :type role_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AddonList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.AddonList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AddonList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_role_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_role.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_role_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AddonList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_role.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons'} # type: ignore + + @distributed_trace_async + async def get( + self, + device_name: str, + role_name: str, + addon_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Addon": + """Gets a specific addon by name. + + :param device_name: The device name. + :type device_name: str + :param role_name: The role name. + :type role_name: str + :param addon_name: The addon name. + :type addon_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Addon, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.Addon + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Addon"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Addon', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + + + async def _create_or_update_initial( + self, + device_name: str, + role_name: str, + addon_name: str, + resource_group_name: str, + addon: "_models.Addon", + **kwargs: Any + ) -> Optional["_models.Addon"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Addon"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(addon, 'Addon') + + request = build_create_or_update_request_initial( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Addon', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + device_name: str, + role_name: str, + addon_name: str, + resource_group_name: str, + addon: "_models.Addon", + **kwargs: Any + ) -> AsyncLROPoller["_models.Addon"]: + """Create or update a addon. + + :param device_name: The device name. + :type device_name: str + :param role_name: The role name. + :type role_name: str + :param addon_name: The addon name. + :type addon_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param addon: The addon properties. + :type addon: ~azure.mgmt.databoxedge.v2021_02_01.models.Addon + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Addon or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01.models.Addon] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Addon"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + resource_group_name=resource_group_name, + addon=addon, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Addon', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + + async def _delete_initial( + self, + device_name: str, + role_name: str, + addon_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + device_name: str, + role_name: str, + addon_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the addon on the device. + + :param device_name: The device name. + :type device_name: str + :param role_name: The role name. + :type role_name: str + :param addon_name: The addon name. + :type addon_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_alerts_operations.py new file mode 100644 index 000000000000..73adb8b2d085 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_alerts_operations.py @@ -0,0 +1,178 @@ +# 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 functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._alerts_operations import build_get_request, build_list_by_data_box_edge_device_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AlertsOperations: + """AlertsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_data_box_edge_device( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.AlertList"]: + """Gets all the alerts for a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AlertList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.AlertList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AlertList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts'} # type: ignore + + @distributed_trace_async + async def get( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Alert": + """Gets an alert by name. + + Gets an alert by name. + + :param device_name: The device name. + :type device_name: str + :param name: The alert name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Alert, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.Alert + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Alert"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Alert', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_available_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_available_skus_operations.py new file mode 100644 index 000000000000..54f9667be9ba --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_available_skus_operations.py @@ -0,0 +1,113 @@ +# 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 functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._available_skus_operations import build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AvailableSkusOperations: + """AvailableSkusOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.DataBoxEdgeSkuList"]: + """List all the available Skus and information related to them. + + List all the available Skus and information related to them. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataBoxEdgeSkuList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.DataBoxEdgeSkuList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeSkuList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DataBoxEdgeSkuList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/availableSkus'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_bandwidth_schedules_operations.py new file mode 100644 index 000000000000..b7f089998e3a --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_bandwidth_schedules_operations.py @@ -0,0 +1,406 @@ +# 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 functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._bandwidth_schedules_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class BandwidthSchedulesOperations: + """BandwidthSchedulesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_data_box_edge_device( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.BandwidthSchedulesList"]: + """Gets all the bandwidth schedules for a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BandwidthSchedulesList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.BandwidthSchedulesList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedulesList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BandwidthSchedulesList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules'} # type: ignore + + @distributed_trace_async + async def get( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.BandwidthSchedule": + """Gets the properties of the specified bandwidth schedule. + + :param device_name: The device name. + :type device_name: str + :param name: The bandwidth schedule name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BandwidthSchedule, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.BandwidthSchedule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BandwidthSchedule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + + async def _create_or_update_initial( + self, + device_name: str, + name: str, + resource_group_name: str, + parameters: "_models.BandwidthSchedule", + **kwargs: Any + ) -> Optional["_models.BandwidthSchedule"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BandwidthSchedule"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BandwidthSchedule') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('BandwidthSchedule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + device_name: str, + name: str, + resource_group_name: str, + parameters: "_models.BandwidthSchedule", + **kwargs: Any + ) -> AsyncLROPoller["_models.BandwidthSchedule"]: + """Creates or updates a bandwidth schedule. + + :param device_name: The device name. + :type device_name: str + :param name: The bandwidth schedule name which needs to be added/updated. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param parameters: The bandwidth schedule to be added or updated. + :type parameters: ~azure.mgmt.databoxedge.v2021_02_01.models.BandwidthSchedule + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BandwidthSchedule or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01.models.BandwidthSchedule] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedule"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + device_name=device_name, + name=name, + resource_group_name=resource_group_name, + parameters=parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('BandwidthSchedule', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + async def _delete_initial( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified bandwidth schedule. + + :param device_name: The device name. + :type device_name: str + :param name: The bandwidth schedule name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + device_name=device_name, + name=name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_containers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_containers_operations.py new file mode 100644 index 000000000000..af7c3b3baec1 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_containers_operations.py @@ -0,0 +1,542 @@ +# 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 functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._containers_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_storage_account_request, build_refresh_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ContainersOperations: + """ContainersOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_storage_account( + self, + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ContainerList"]: + """Lists all the containers of a storage Account in a Data Box Edge/Data Box Gateway device. + + Lists all the containers of a storage Account in a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param storage_account_name: The storage Account name. + :type storage_account_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ContainerList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.ContainerList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_storage_account_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_storage_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_storage_account_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ContainerList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_storage_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers'} # type: ignore + + @distributed_trace_async + async def get( + self, + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Container": + """Gets a container by name. + + Gets a container by name. + + :param device_name: The device name. + :type device_name: str + :param storage_account_name: The Storage Account Name. + :type storage_account_name: str + :param container_name: The container Name. + :type container_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Container, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.Container + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Container"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Container', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + + async def _create_or_update_initial( + self, + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + container: "_models.Container", + **kwargs: Any + ) -> Optional["_models.Container"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Container"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(container, 'Container') + + request = build_create_or_update_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Container', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + container: "_models.Container", + **kwargs: Any + ) -> AsyncLROPoller["_models.Container"]: + """Creates a new container or updates an existing container on the device. + + Creates a new container or updates an existing container on the device. + + :param device_name: The device name. + :type device_name: str + :param storage_account_name: The Storage Account Name. + :type storage_account_name: str + :param container_name: The container name. + :type container_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param container: The container properties. + :type container: ~azure.mgmt.databoxedge.v2021_02_01.models.Container + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Container or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01.models.Container] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Container"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + resource_group_name=resource_group_name, + container=container, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Container', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + async def _delete_initial( + self, + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the container on the Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param storage_account_name: The Storage Account Name. + :type storage_account_name: str + :param container_name: The container name. + :type container_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + async def _refresh_initial( + self, + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_refresh_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh'} # type: ignore + + + @distributed_trace_async + async def begin_refresh( + self, + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Refreshes the container metadata with the data from the cloud. + + Refreshes the container metadata with the data from the cloud. + + :param device_name: The device name. + :type device_name: str + :param storage_account_name: The Storage Account Name. + :type storage_account_name: str + :param container_name: The container name. + :type container_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._refresh_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_devices_operations.py new file mode 100644 index 000000000000..771b88b6f71b --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_devices_operations.py @@ -0,0 +1,1189 @@ +# 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 functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._devices_operations import build_create_or_update_request, build_create_or_update_security_settings_request_initial, build_delete_request_initial, build_download_updates_request_initial, build_generate_certificate_request, build_get_extended_information_request, build_get_network_settings_request, build_get_request, build_get_update_summary_request, build_install_updates_request_initial, build_list_by_resource_group_request, build_list_by_subscription_request, build_scan_for_updates_request_initial, build_update_extended_information_request, build_update_request, build_upload_certificate_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DevicesOperations: + """DevicesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_subscription( + self, + expand: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.DataBoxEdgeDeviceList"]: + """Gets all the Data Box Edge/Data Box Gateway devices in a subscription. + + :param expand: Specify $expand=details to populate additional fields related to the resource or + Specify $skipToken=:code:`` to populate the next page in the list. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.DataBoxEdgeDeviceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.DataBoxEdgeDeviceList"]: + """Gets all the Data Box Edge/Data Box Gateway devices in a resource group. + + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param expand: Specify $expand=details to populate additional fields related to the resource or + Specify $skipToken=:code:`` to populate the next page in the list. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.DataBoxEdgeDeviceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + + @distributed_trace_async + async def get( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DataBoxEdgeDevice": + """Gets the properties of the Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataBoxEdgeDevice, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.DataBoxEdgeDevice + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataBoxEdgeDevice', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + + @distributed_trace_async + async def create_or_update( + self, + device_name: str, + resource_group_name: str, + data_box_edge_device: "_models.DataBoxEdgeDevice", + **kwargs: Any + ) -> "_models.DataBoxEdgeDevice": + """Creates or updates a Data Box Edge/Data Box Gateway resource. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param data_box_edge_device: The resource object. + :type data_box_edge_device: ~azure.mgmt.databoxedge.v2021_02_01.models.DataBoxEdgeDevice + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataBoxEdgeDevice, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.DataBoxEdgeDevice + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') + + request = build_create_or_update_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataBoxEdgeDevice', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + + async def _delete_initial( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + device_name=device_name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace_async + async def update( + self, + device_name: str, + resource_group_name: str, + parameters: "_models.DataBoxEdgeDevicePatch", + **kwargs: Any + ) -> "_models.DataBoxEdgeDevice": + """Modifies a Data Box Edge/Data Box Gateway resource. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param parameters: The resource parameters. + :type parameters: ~azure.mgmt.databoxedge.v2021_02_01.models.DataBoxEdgeDevicePatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataBoxEdgeDevice, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.DataBoxEdgeDevice + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') + + request = build_update_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataBoxEdgeDevice', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + + async def _download_updates_initial( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_download_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._download_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _download_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + + + @distributed_trace_async + async def begin_download_updates( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Downloads the updates on a Data Box Edge/Data Box Gateway device. + + Downloads the updates on a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._download_updates_initial( + device_name=device_name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_download_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + + @distributed_trace_async + async def generate_certificate( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.GenerateCertResponse": + """Generates certificate for activation key. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GenerateCertResponse, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.GenerateCertResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenerateCertResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_generate_certificate_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.generate_certificate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GenerateCertResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + generate_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/generateCertificate'} # type: ignore + + + @distributed_trace_async + async def get_extended_information( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DataBoxEdgeDeviceExtendedInfo": + """Gets additional information for the specified Azure Stack Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataBoxEdgeDeviceExtendedInfo, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.DataBoxEdgeDeviceExtendedInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceExtendedInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_extended_information_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_extended_information.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataBoxEdgeDeviceExtendedInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_extended_information.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation'} # type: ignore + + + async def _install_updates_initial( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_install_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._install_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _install_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + + + @distributed_trace_async + async def begin_install_updates( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Installs the updates on the Data Box Edge/Data Box Gateway device. + + Installs the updates on the Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._install_updates_initial( + device_name=device_name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_install_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + + @distributed_trace_async + async def get_network_settings( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.NetworkSettings": + """Gets the network settings of the specified Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkSettings, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.NetworkSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkSettings"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_network_settings_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_network_settings.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_network_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/networkSettings/default'} # type: ignore + + + async def _scan_for_updates_initial( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_scan_for_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._scan_for_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _scan_for_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore + + + @distributed_trace_async + async def begin_scan_for_updates( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Scans for updates on a Data Box Edge/Data Box Gateway device. + + Scans for updates on a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._scan_for_updates_initial( + device_name=device_name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_scan_for_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore + + async def _create_or_update_security_settings_initial( + self, + device_name: str, + resource_group_name: str, + security_settings: "_models.SecuritySettings", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(security_settings, 'SecuritySettings') + + request = build_create_or_update_security_settings_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_security_settings_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _create_or_update_security_settings_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update_security_settings( + self, + device_name: str, + resource_group_name: str, + security_settings: "_models.SecuritySettings", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates the security settings on a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param security_settings: The security settings. + :type security_settings: ~azure.mgmt.databoxedge.v2021_02_01.models.SecuritySettings + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_security_settings_initial( + device_name=device_name, + resource_group_name=resource_group_name, + security_settings=security_settings, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update_security_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + + @distributed_trace_async + async def update_extended_information( + self, + device_name: str, + resource_group_name: str, + parameters: "_models.DataBoxEdgeDeviceExtendedInfoPatch", + **kwargs: Any + ) -> "_models.DataBoxEdgeDeviceExtendedInfo": + """Gets additional information for the specified Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param parameters: The patch object. + :type parameters: ~azure.mgmt.databoxedge.v2021_02_01.models.DataBoxEdgeDeviceExtendedInfoPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataBoxEdgeDeviceExtendedInfo, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.DataBoxEdgeDeviceExtendedInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceExtendedInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DataBoxEdgeDeviceExtendedInfoPatch') + + request = build_update_extended_information_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.update_extended_information.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataBoxEdgeDeviceExtendedInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_extended_information.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateExtendedInformation'} # type: ignore + + + @distributed_trace_async + async def get_update_summary( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.UpdateSummary": + """Gets information about the availability of updates based on the last scan of the device. It + also gets information about any ongoing download or install jobs on the device. + + Gets information about the availability of updates based on the last scan of the device. It + also gets information about any ongoing download or install jobs on the device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UpdateSummary, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.UpdateSummary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UpdateSummary"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_update_summary_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_update_summary.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('UpdateSummary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_update_summary.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default'} # type: ignore + + + @distributed_trace_async + async def upload_certificate( + self, + device_name: str, + resource_group_name: str, + parameters: "_models.UploadCertificateRequest", + **kwargs: Any + ) -> "_models.UploadCertificateResponse": + """Uploads registration certificate for the device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param parameters: The upload certificate request. + :type parameters: ~azure.mgmt.databoxedge.v2021_02_01.models.UploadCertificateRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UploadCertificateResponse, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.UploadCertificateResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UploadCertificateResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'UploadCertificateRequest') + + request = build_upload_certificate_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.upload_certificate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('UploadCertificateResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + upload_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/uploadCertificate'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_diagnostic_settings_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_diagnostic_settings_operations.py new file mode 100644 index 000000000000..2b34a637ec21 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_diagnostic_settings_operations.py @@ -0,0 +1,369 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._diagnostic_settings_operations import build_get_diagnostic_proactive_log_collection_settings_request, build_get_diagnostic_remote_support_settings_request, build_update_diagnostic_proactive_log_collection_settings_request_initial, build_update_diagnostic_remote_support_settings_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DiagnosticSettingsOperations: + """DiagnosticSettingsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get_diagnostic_proactive_log_collection_settings( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DiagnosticProactiveLogCollectionSettings": + """Gets the proactive log collection settings of the specified Data Box Edge/Data Box Gateway + device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticProactiveLogCollectionSettings, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.DiagnosticProactiveLogCollectionSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticProactiveLogCollectionSettings"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_diagnostic_proactive_log_collection_settings_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_diagnostic_proactive_log_collection_settings.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticProactiveLogCollectionSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_diagnostic_proactive_log_collection_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/diagnosticProactiveLogCollectionSettings/default'} # type: ignore + + + async def _update_diagnostic_proactive_log_collection_settings_initial( + self, + device_name: str, + resource_group_name: str, + proactive_log_collection_settings: "_models.DiagnosticProactiveLogCollectionSettings", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(proactive_log_collection_settings, 'DiagnosticProactiveLogCollectionSettings') + + request = build_update_diagnostic_proactive_log_collection_settings_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._update_diagnostic_proactive_log_collection_settings_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _update_diagnostic_proactive_log_collection_settings_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/diagnosticProactiveLogCollectionSettings/default'} # type: ignore + + + @distributed_trace_async + async def begin_update_diagnostic_proactive_log_collection_settings( + self, + device_name: str, + resource_group_name: str, + proactive_log_collection_settings: "_models.DiagnosticProactiveLogCollectionSettings", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates the proactive log collection settings on a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param proactive_log_collection_settings: The proactive log collection settings. + :type proactive_log_collection_settings: + ~azure.mgmt.databoxedge.v2021_02_01.models.DiagnosticProactiveLogCollectionSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_diagnostic_proactive_log_collection_settings_initial( + device_name=device_name, + resource_group_name=resource_group_name, + proactive_log_collection_settings=proactive_log_collection_settings, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_diagnostic_proactive_log_collection_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/diagnosticProactiveLogCollectionSettings/default'} # type: ignore + + @distributed_trace_async + async def get_diagnostic_remote_support_settings( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DiagnosticRemoteSupportSettings": + """Gets the diagnostic remote support settings of the specified Data Box Edge/Data Box Gateway + device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticRemoteSupportSettings, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.DiagnosticRemoteSupportSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticRemoteSupportSettings"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_diagnostic_remote_support_settings_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_diagnostic_remote_support_settings.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticRemoteSupportSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_diagnostic_remote_support_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/diagnosticRemoteSupportSettings/default'} # type: ignore + + + async def _update_diagnostic_remote_support_settings_initial( + self, + device_name: str, + resource_group_name: str, + diagnostic_remote_support_settings: "_models.DiagnosticRemoteSupportSettings", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_remote_support_settings, 'DiagnosticRemoteSupportSettings') + + request = build_update_diagnostic_remote_support_settings_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._update_diagnostic_remote_support_settings_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _update_diagnostic_remote_support_settings_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/diagnosticRemoteSupportSettings/default'} # type: ignore + + + @distributed_trace_async + async def begin_update_diagnostic_remote_support_settings( + self, + device_name: str, + resource_group_name: str, + diagnostic_remote_support_settings: "_models.DiagnosticRemoteSupportSettings", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates the diagnostic remote support settings on a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param diagnostic_remote_support_settings: The diagnostic remote support settings. + :type diagnostic_remote_support_settings: + ~azure.mgmt.databoxedge.v2021_02_01.models.DiagnosticRemoteSupportSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_diagnostic_remote_support_settings_initial( + device_name=device_name, + resource_group_name=resource_group_name, + diagnostic_remote_support_settings=diagnostic_remote_support_settings, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_diagnostic_remote_support_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/diagnosticRemoteSupportSettings/default'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_jobs_operations.py new file mode 100644 index 000000000000..02e0bc00134a --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_jobs_operations.py @@ -0,0 +1,102 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._jobs_operations import build_get_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class JobsOperations: + """JobsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Job": + """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. + + Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param name: The job name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Job, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.Job + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Job"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Job', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_monitoring_config_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_monitoring_config_operations.py new file mode 100644 index 000000000000..a63c0695add2 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_monitoring_config_operations.py @@ -0,0 +1,420 @@ +# 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 functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._monitoring_config_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MonitoringConfigOperations: + """MonitoringConfigOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + device_name: str, + role_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.MonitoringMetricConfigurationList"]: + """Lists metric configurations in a role. + + Lists metric configurations in a role. + + :param device_name: The device name. + :type device_name: str + :param role_name: The role name. + :type role_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MonitoringMetricConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.MonitoringMetricConfigurationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringMetricConfigurationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("MonitoringMetricConfigurationList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig'} # type: ignore + + @distributed_trace_async + async def get( + self, + device_name: str, + role_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.MonitoringMetricConfiguration": + """Gets a metric configuration of a role. + + Gets a metric configuration of a role. + + :param device_name: The device name. + :type device_name: str + :param role_name: The role name. + :type role_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MonitoringMetricConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.MonitoringMetricConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringMetricConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MonitoringMetricConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + + + async def _create_or_update_initial( + self, + device_name: str, + role_name: str, + resource_group_name: str, + monitoring_metric_configuration: "_models.MonitoringMetricConfiguration", + **kwargs: Any + ) -> Optional["_models.MonitoringMetricConfiguration"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MonitoringMetricConfiguration"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_metric_configuration, 'MonitoringMetricConfiguration') + + request = build_create_or_update_request_initial( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MonitoringMetricConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + device_name: str, + role_name: str, + resource_group_name: str, + monitoring_metric_configuration: "_models.MonitoringMetricConfiguration", + **kwargs: Any + ) -> AsyncLROPoller["_models.MonitoringMetricConfiguration"]: + """Creates a new metric configuration or updates an existing one for a role. + + Creates a new metric configuration or updates an existing one for a role. + + :param device_name: The device name. + :type device_name: str + :param role_name: The role name. + :type role_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param monitoring_metric_configuration: The metric configuration. + :type monitoring_metric_configuration: + ~azure.mgmt.databoxedge.v2021_02_01.models.MonitoringMetricConfiguration + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringMetricConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01.models.MonitoringMetricConfiguration] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringMetricConfiguration"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + device_name=device_name, + role_name=role_name, + resource_group_name=resource_group_name, + monitoring_metric_configuration=monitoring_metric_configuration, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('MonitoringMetricConfiguration', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + + async def _delete_initial( + self, + device_name: str, + role_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + device_name: str, + role_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """deletes a new metric configuration for a role. + + deletes a new metric configuration for a role. + + :param device_name: The device name. + :type device_name: str + :param role_name: The role name. + :type role_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + device_name=device_name, + role_name=role_name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_nodes_operations.py new file mode 100644 index 000000000000..4453f6ee8999 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_nodes_operations.py @@ -0,0 +1,121 @@ +# 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 functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._nodes_operations import build_list_by_data_box_edge_device_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class NodesOperations: + """NodesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_data_box_edge_device( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.NodeList"]: + """Gets all the nodes currently configured under this Data Box Edge device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NodeList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.NodeList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NodeList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/nodes'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_operations.py new file mode 100644 index 000000000000..4e926f65da9f --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_operations.py @@ -0,0 +1,111 @@ +# 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 functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.OperationsList"]: + """List all the supported operations. + + List all the supported operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationsList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.OperationsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OperationsList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.DataBoxEdge/operations'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_operations_status_operations.py new file mode 100644 index 000000000000..3a50772c12bf --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_operations_status_operations.py @@ -0,0 +1,102 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations_status_operations import build_get_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class OperationsStatusOperations: + """OperationsStatusOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Job": + """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. + + Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param name: The job name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Job, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.Job + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Job"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Job', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/operationsStatus/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_orders_operations.py new file mode 100644 index 000000000000..6d7a901f801f --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_orders_operations.py @@ -0,0 +1,448 @@ +# 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 functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._orders_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request, build_list_dc_access_code_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class OrdersOperations: + """OrdersOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_data_box_edge_device( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.OrderList"]: + """Lists all the orders related to a Data Box Edge/Data Box Gateway device. + + Lists all the orders related to a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OrderList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.OrderList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OrderList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OrderList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders'} # type: ignore + + @distributed_trace_async + async def get( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Order": + """Gets a specific order by name. + + Gets a specific order by name. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Order, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.Order + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Order"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Order', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + + async def _create_or_update_initial( + self, + device_name: str, + resource_group_name: str, + order: "_models.Order", + **kwargs: Any + ) -> Optional["_models.Order"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Order"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(order, 'Order') + + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Order', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + device_name: str, + resource_group_name: str, + order: "_models.Order", + **kwargs: Any + ) -> AsyncLROPoller["_models.Order"]: + """Creates or updates an order. + + Creates or updates an order. + + :param device_name: The order details of a device. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param order: The order to be created or updated. + :type order: ~azure.mgmt.databoxedge.v2021_02_01.models.Order + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Order or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01.models.Order] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Order"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + device_name=device_name, + resource_group_name=resource_group_name, + order=order, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Order', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + async def _delete_initial( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the order related to the device. + + Deletes the order related to the device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + device_name=device_name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace_async + async def list_dc_access_code( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DCAccessCode": + """Gets the DCAccess Code. + + Gets the DCAccess Code. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DCAccessCode, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.DCAccessCode + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DCAccessCode"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_dc_access_code_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_dc_access_code.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DCAccessCode', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_dc_access_code.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default/listDCAccessCode'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_roles_operations.py new file mode 100644 index 000000000000..1dc7b52fe61a --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_roles_operations.py @@ -0,0 +1,403 @@ +# 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 functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._roles_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RolesOperations: + """RolesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_data_box_edge_device( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.RoleList"]: + """Lists all the roles configured in a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RoleList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.RoleList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("RoleList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles'} # type: ignore + + @distributed_trace_async + async def get( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Role": + """Gets a specific role by name. + + :param device_name: The device name. + :type device_name: str + :param name: The role name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Role, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.Role + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Role"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Role', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + + async def _create_or_update_initial( + self, + device_name: str, + name: str, + resource_group_name: str, + role: "_models.Role", + **kwargs: Any + ) -> Optional["_models.Role"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Role"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(role, 'Role') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Role', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + device_name: str, + name: str, + resource_group_name: str, + role: "_models.Role", + **kwargs: Any + ) -> AsyncLROPoller["_models.Role"]: + """Create or update a role. + + :param device_name: The device name. + :type device_name: str + :param name: The role name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param role: The role properties. + :type role: ~azure.mgmt.databoxedge.v2021_02_01.models.Role + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Role or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01.models.Role] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Role"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + device_name=device_name, + name=name, + resource_group_name=resource_group_name, + role=role, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Role', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + async def _delete_initial( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the role on the device. + + :param device_name: The device name. + :type device_name: str + :param name: The role name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + device_name=device_name, + name=name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_shares_operations.py new file mode 100644 index 000000000000..c0b510d62434 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_shares_operations.py @@ -0,0 +1,513 @@ +# 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 functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._shares_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request, build_refresh_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SharesOperations: + """SharesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_data_box_edge_device( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ShareList"]: + """Lists all the shares in a Data Box Edge/Data Box Gateway device. + + Lists all the shares in a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ShareList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.ShareList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ShareList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ShareList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares'} # type: ignore + + @distributed_trace_async + async def get( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Share": + """Gets a share by name. + + Gets a share by name. + + :param device_name: The device name. + :type device_name: str + :param name: The share name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Share, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.Share + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Share"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Share', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + + async def _create_or_update_initial( + self, + device_name: str, + name: str, + resource_group_name: str, + share: "_models.Share", + **kwargs: Any + ) -> Optional["_models.Share"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Share"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(share, 'Share') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Share', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + device_name: str, + name: str, + resource_group_name: str, + share: "_models.Share", + **kwargs: Any + ) -> AsyncLROPoller["_models.Share"]: + """Creates a new share or updates an existing share on the device. + + Creates a new share or updates an existing share on the device. + + :param device_name: The device name. + :type device_name: str + :param name: The share name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param share: The share properties. + :type share: ~azure.mgmt.databoxedge.v2021_02_01.models.Share + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Share or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01.models.Share] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Share"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + device_name=device_name, + name=name, + resource_group_name=resource_group_name, + share=share, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Share', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + async def _delete_initial( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the share on the Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param name: The share name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + device_name=device_name, + name=name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + async def _refresh_initial( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_refresh_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore + + + @distributed_trace_async + async def begin_refresh( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Refreshes the share metadata with the data from the cloud. + + Refreshes the share metadata with the data from the cloud. + + :param device_name: The device name. + :type device_name: str + :param name: The share name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._refresh_initial( + device_name=device_name, + name=name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_storage_account_credentials_operations.py new file mode 100644 index 000000000000..e7ee0d675eac --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_storage_account_credentials_operations.py @@ -0,0 +1,409 @@ +# 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 functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._storage_account_credentials_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class StorageAccountCredentialsOperations: + """StorageAccountCredentialsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_data_box_edge_device( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.StorageAccountCredentialList"]: + """Gets all the storage account credentials in a Data Box Edge/Data Box Gateway device. + + Gets all the storage account credentials in a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StorageAccountCredentialList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.StorageAccountCredentialList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredentialList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("StorageAccountCredentialList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials'} # type: ignore + + @distributed_trace_async + async def get( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.StorageAccountCredential": + """Gets the properties of the specified storage account credential. + + :param device_name: The device name. + :type device_name: str + :param name: The storage account credential name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageAccountCredential, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.StorageAccountCredential + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredential"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StorageAccountCredential', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + + async def _create_or_update_initial( + self, + device_name: str, + name: str, + resource_group_name: str, + storage_account_credential: "_models.StorageAccountCredential", + **kwargs: Any + ) -> Optional["_models.StorageAccountCredential"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccountCredential"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(storage_account_credential, 'StorageAccountCredential') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('StorageAccountCredential', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + device_name: str, + name: str, + resource_group_name: str, + storage_account_credential: "_models.StorageAccountCredential", + **kwargs: Any + ) -> AsyncLROPoller["_models.StorageAccountCredential"]: + """Creates or updates the storage account credential. + + :param device_name: The device name. + :type device_name: str + :param name: The storage account credential name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param storage_account_credential: The storage account credential. + :type storage_account_credential: + ~azure.mgmt.databoxedge.v2021_02_01.models.StorageAccountCredential + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageAccountCredential or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01.models.StorageAccountCredential] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredential"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + device_name=device_name, + name=name, + resource_group_name=resource_group_name, + storage_account_credential=storage_account_credential, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('StorageAccountCredential', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + async def _delete_initial( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the storage account credential. + + :param device_name: The device name. + :type device_name: str + :param name: The storage account credential name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + device_name=device_name, + name=name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_storage_accounts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_storage_accounts_operations.py new file mode 100644 index 000000000000..30106a70aed3 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_storage_accounts_operations.py @@ -0,0 +1,411 @@ +# 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 functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._storage_accounts_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class StorageAccountsOperations: + """StorageAccountsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_data_box_edge_device( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.StorageAccountList"]: + """Lists all the StorageAccounts in a Data Box Edge/Data Box Gateway device. + + Lists all the StorageAccounts in a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StorageAccountList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.StorageAccountList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("StorageAccountList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts'} # type: ignore + + @distributed_trace_async + async def get( + self, + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.StorageAccount": + """Gets a StorageAccount by name. + + Gets a StorageAccount by name. + + :param device_name: The device name. + :type device_name: str + :param storage_account_name: The storage account name. + :type storage_account_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageAccount, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.StorageAccount + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccount"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StorageAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + + async def _create_or_update_initial( + self, + device_name: str, + storage_account_name: str, + resource_group_name: str, + storage_account: "_models.StorageAccount", + **kwargs: Any + ) -> Optional["_models.StorageAccount"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(storage_account, 'StorageAccount') + + request = build_create_or_update_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('StorageAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + device_name: str, + storage_account_name: str, + resource_group_name: str, + storage_account: "_models.StorageAccount", + **kwargs: Any + ) -> AsyncLROPoller["_models.StorageAccount"]: + """Creates a new StorageAccount or updates an existing StorageAccount on the device. + + Creates a new StorageAccount or updates an existing StorageAccount on the device. + + :param device_name: The device name. + :type device_name: str + :param storage_account_name: The StorageAccount name. + :type storage_account_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param storage_account: The StorageAccount properties. + :type storage_account: ~azure.mgmt.databoxedge.v2021_02_01.models.StorageAccount + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccount"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + device_name=device_name, + storage_account_name=storage_account_name, + resource_group_name=resource_group_name, + storage_account=storage_account, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('StorageAccount', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + async def _delete_initial( + self, + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the StorageAccount on the Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param storage_account_name: The StorageAccount name. + :type storage_account_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + device_name=device_name, + storage_account_name=storage_account_name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_support_packages_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_support_packages_operations.py new file mode 100644 index 000000000000..d3606a5f433a --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_support_packages_operations.py @@ -0,0 +1,158 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._support_packages_operations import build_trigger_support_package_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SupportPackagesOperations: + """SupportPackagesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _trigger_support_package_initial( + self, + device_name: str, + resource_group_name: str, + trigger_support_package_request: "_models.TriggerSupportPackageRequest", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(trigger_support_package_request, 'TriggerSupportPackageRequest') + + request = build_trigger_support_package_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._trigger_support_package_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _trigger_support_package_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggerSupportPackage'} # type: ignore + + + @distributed_trace_async + async def begin_trigger_support_package( + self, + device_name: str, + resource_group_name: str, + trigger_support_package_request: "_models.TriggerSupportPackageRequest", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Triggers support package on the device. + + Triggers support package on the device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param trigger_support_package_request: The trigger support package request object. + :type trigger_support_package_request: + ~azure.mgmt.databoxedge.v2021_02_01.models.TriggerSupportPackageRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._trigger_support_package_initial( + device_name=device_name, + resource_group_name=resource_group_name, + trigger_support_package_request=trigger_support_package_request, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_trigger_support_package.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggerSupportPackage'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_triggers_operations.py new file mode 100644 index 000000000000..02ab58a8cdb9 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_triggers_operations.py @@ -0,0 +1,410 @@ +# 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 functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._triggers_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TriggersOperations: + """TriggersOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_data_box_edge_device( + self, + device_name: str, + resource_group_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.TriggerList"]: + """Lists all the triggers configured in the device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param filter: Specify $filter='CustomContextTag eq :code:``' to filter on custom context + tag property. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TriggerList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.TriggerList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TriggerList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("TriggerList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers'} # type: ignore + + @distributed_trace_async + async def get( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Trigger": + """Get a specific trigger by name. + + :param device_name: The device name. + :type device_name: str + :param name: The trigger name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Trigger, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.Trigger + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Trigger"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Trigger', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + + async def _create_or_update_initial( + self, + device_name: str, + name: str, + resource_group_name: str, + trigger: "_models.Trigger", + **kwargs: Any + ) -> Optional["_models.Trigger"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Trigger"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(trigger, 'Trigger') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Trigger', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + device_name: str, + name: str, + resource_group_name: str, + trigger: "_models.Trigger", + **kwargs: Any + ) -> AsyncLROPoller["_models.Trigger"]: + """Creates or updates a trigger. + + :param device_name: Creates or updates a trigger. + :type device_name: str + :param name: The trigger name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param trigger: The trigger. + :type trigger: ~azure.mgmt.databoxedge.v2021_02_01.models.Trigger + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Trigger or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01.models.Trigger] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Trigger"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + device_name=device_name, + name=name, + resource_group_name=resource_group_name, + trigger=trigger, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Trigger', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + async def _delete_initial( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the trigger on the gateway device. + + :param device_name: The device name. + :type device_name: str + :param name: The trigger name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + device_name=device_name, + name=name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_users_operations.py new file mode 100644 index 000000000000..15d2db1c1014 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_users_operations.py @@ -0,0 +1,409 @@ +# 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 functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._users_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class UsersOperations: + """UsersOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_data_box_edge_device( + self, + device_name: str, + resource_group_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.UserList"]: + """Gets all the users registered on a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param filter: Specify $filter='Type eq :code:``' to filter on user type property. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UserList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.UserList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("UserList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users'} # type: ignore + + @distributed_trace_async + async def get( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.User": + """Gets the properties of the specified user. + + :param device_name: The device name. + :type device_name: str + :param name: The user name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: User, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.User + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.User"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + + async def _create_or_update_initial( + self, + device_name: str, + name: str, + resource_group_name: str, + user: "_models.User", + **kwargs: Any + ) -> Optional["_models.User"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.User"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(user, 'User') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + device_name: str, + name: str, + resource_group_name: str, + user: "_models.User", + **kwargs: Any + ) -> AsyncLROPoller["_models.User"]: + """Creates a new user or updates an existing user's information on a Data Box Edge/Data Box + Gateway device. + + :param device_name: The device name. + :type device_name: str + :param name: The user name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param user: The user details. + :type user: ~azure.mgmt.databoxedge.v2021_02_01.models.User + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either User or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01.models.User] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.User"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + device_name=device_name, + name=name, + resource_group_name=resource_group_name, + user=user, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('User', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + async def _delete_initial( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the user on a databox edge/gateway device. + + :param device_name: The device name. + :type device_name: str + :param name: The user name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + device_name=device_name, + name=name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/models/__init__.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/models/__init__.py new file mode 100644 index 000000000000..4a17230a221f --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/models/__init__.py @@ -0,0 +1,391 @@ +# 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 ._models_py3 import ARMBaseModel +from ._models_py3 import Addon +from ._models_py3 import AddonList +from ._models_py3 import Address +from ._models_py3 import Alert +from ._models_py3 import AlertErrorDetails +from ._models_py3 import AlertList +from ._models_py3 import ArcAddon +from ._models_py3 import AsymmetricEncryptedSecret +from ._models_py3 import Authentication +from ._models_py3 import AzureContainerInfo +from ._models_py3 import BandwidthSchedule +from ._models_py3 import BandwidthSchedulesList +from ._models_py3 import ClientAccessRight +from ._models_py3 import CloudEdgeManagementRole +from ._models_py3 import CloudErrorBody +from ._models_py3 import CniConfig +from ._models_py3 import ComputeResource +from ._models_py3 import ContactDetails +from ._models_py3 import Container +from ._models_py3 import ContainerList +from ._models_py3 import DCAccessCode +from ._models_py3 import DataBoxEdgeDevice +from ._models_py3 import DataBoxEdgeDeviceExtendedInfo +from ._models_py3 import DataBoxEdgeDeviceExtendedInfoPatch +from ._models_py3 import DataBoxEdgeDeviceList +from ._models_py3 import DataBoxEdgeDevicePatch +from ._models_py3 import DataBoxEdgeMoveRequest +from ._models_py3 import DataBoxEdgeSku +from ._models_py3 import DataBoxEdgeSkuList +from ._models_py3 import DataResidency +from ._models_py3 import DiagnosticProactiveLogCollectionSettings +from ._models_py3 import DiagnosticRemoteSupportSettings +from ._models_py3 import EdgeProfile +from ._models_py3 import EdgeProfilePatch +from ._models_py3 import EdgeProfileSubscription +from ._models_py3 import EdgeProfileSubscriptionPatch +from ._models_py3 import EtcdInfo +from ._models_py3 import FileEventTrigger +from ._models_py3 import FileSourceInfo +from ._models_py3 import GenerateCertResponse +from ._models_py3 import ImageRepositoryCredential +from ._models_py3 import IoTAddon +from ._models_py3 import IoTDeviceInfo +from ._models_py3 import IoTEdgeAgentInfo +from ._models_py3 import IoTRole +from ._models_py3 import Ipv4Config +from ._models_py3 import Ipv6Config +from ._models_py3 import Job +from ._models_py3 import JobErrorDetails +from ._models_py3 import JobErrorItem +from ._models_py3 import KubernetesClusterInfo +from ._models_py3 import KubernetesIPConfiguration +from ._models_py3 import KubernetesRole +from ._models_py3 import KubernetesRoleCompute +from ._models_py3 import KubernetesRoleNetwork +from ._models_py3 import KubernetesRoleResources +from ._models_py3 import KubernetesRoleStorage +from ._models_py3 import KubernetesRoleStorageClassInfo +from ._models_py3 import LoadBalancerConfig +from ._models_py3 import MECRole +from ._models_py3 import MetricConfiguration +from ._models_py3 import MetricCounter +from ._models_py3 import MetricCounterSet +from ._models_py3 import MetricDimension +from ._models_py3 import MetricDimensionV1 +from ._models_py3 import MetricSpecificationV1 +from ._models_py3 import MonitoringMetricConfiguration +from ._models_py3 import MonitoringMetricConfigurationList +from ._models_py3 import MountPointMap +from ._models_py3 import NetworkAdapter +from ._models_py3 import NetworkAdapterPosition +from ._models_py3 import NetworkSettings +from ._models_py3 import Node +from ._models_py3 import NodeInfo +from ._models_py3 import NodeList +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationsList +from ._models_py3 import Order +from ._models_py3 import OrderList +from ._models_py3 import OrderStatus +from ._models_py3 import PeriodicTimerEventTrigger +from ._models_py3 import PeriodicTimerSourceInfo +from ._models_py3 import RefreshDetails +from ._models_py3 import RemoteSupportSettings +from ._models_py3 import ResourceIdentity +from ._models_py3 import ResourceMoveDetails +from ._models_py3 import ResourceTypeSku +from ._models_py3 import Role +from ._models_py3 import RoleList +from ._models_py3 import RoleSinkInfo +from ._models_py3 import Secret +from ._models_py3 import SecuritySettings +from ._models_py3 import ServiceSpecification +from ._models_py3 import Share +from ._models_py3 import ShareAccessRight +from ._models_py3 import ShareList +from ._models_py3 import Sku +from ._models_py3 import SkuCapability +from ._models_py3 import SkuCost +from ._models_py3 import SkuInformation +from ._models_py3 import SkuInformationList +from ._models_py3 import SkuLocationInfo +from ._models_py3 import StorageAccount +from ._models_py3 import StorageAccountCredential +from ._models_py3 import StorageAccountCredentialList +from ._models_py3 import StorageAccountList +from ._models_py3 import SubscriptionRegisteredFeatures +from ._models_py3 import SymmetricKey +from ._models_py3 import SystemData +from ._models_py3 import TrackingInfo +from ._models_py3 import Trigger +from ._models_py3 import TriggerList +from ._models_py3 import TriggerSupportPackageRequest +from ._models_py3 import UpdateDetails +from ._models_py3 import UpdateDownloadProgress +from ._models_py3 import UpdateInstallProgress +from ._models_py3 import UpdateSummary +from ._models_py3 import UploadCertificateRequest +from ._models_py3 import UploadCertificateResponse +from ._models_py3 import User +from ._models_py3 import UserAccessRight +from ._models_py3 import UserList + + +from ._data_box_edge_management_client_enums import ( + AccessLevel, + AccountType, + AddonState, + AddonType, + AlertSeverity, + AuthenticationType, + AzureContainerDataFormat, + ClientPermissionType, + ContainerStatus, + CreatedByType, + DataBoxEdgeDeviceKind, + DataBoxEdgeDeviceStatus, + DataPolicy, + DataResidencyType, + DayOfWeek, + DeviceType, + DownloadPhase, + EncryptionAlgorithm, + HostPlatformType, + InstallRebootBehavior, + InstallationImpact, + JobStatus, + JobType, + KeyVaultSyncStatus, + KubernetesNodeType, + KubernetesState, + MetricAggregationType, + MetricCategory, + MetricUnit, + MonitoringStatus, + MountType, + MsiIdentityType, + NetworkAdapterDHCPStatus, + NetworkAdapterRDMAStatus, + NetworkAdapterStatus, + NetworkGroup, + NodeStatus, + OrderState, + PlatformType, + PosixComplianceStatus, + ProactiveDiagnosticsConsent, + RemoteApplicationType, + ResourceMoveStatus, + RoleStatus, + RoleTypes, + SSLStatus, + ShareAccessProtocol, + ShareAccessType, + ShareStatus, + ShipmentType, + SkuAvailability, + SkuName, + SkuSignupOption, + SkuTier, + SkuVersion, + StorageAccountStatus, + SubscriptionState, + TimeGrain, + TriggerEventType, + UpdateOperation, + UpdateOperationStage, + UpdateStatus, + UpdateType, + UserType, +) + +__all__ = [ + 'ARMBaseModel', + 'Addon', + 'AddonList', + 'Address', + 'Alert', + 'AlertErrorDetails', + 'AlertList', + 'ArcAddon', + 'AsymmetricEncryptedSecret', + 'Authentication', + 'AzureContainerInfo', + 'BandwidthSchedule', + 'BandwidthSchedulesList', + 'ClientAccessRight', + 'CloudEdgeManagementRole', + 'CloudErrorBody', + 'CniConfig', + 'ComputeResource', + 'ContactDetails', + 'Container', + 'ContainerList', + 'DCAccessCode', + 'DataBoxEdgeDevice', + 'DataBoxEdgeDeviceExtendedInfo', + 'DataBoxEdgeDeviceExtendedInfoPatch', + 'DataBoxEdgeDeviceList', + 'DataBoxEdgeDevicePatch', + 'DataBoxEdgeMoveRequest', + 'DataBoxEdgeSku', + 'DataBoxEdgeSkuList', + 'DataResidency', + 'DiagnosticProactiveLogCollectionSettings', + 'DiagnosticRemoteSupportSettings', + 'EdgeProfile', + 'EdgeProfilePatch', + 'EdgeProfileSubscription', + 'EdgeProfileSubscriptionPatch', + 'EtcdInfo', + 'FileEventTrigger', + 'FileSourceInfo', + 'GenerateCertResponse', + 'ImageRepositoryCredential', + 'IoTAddon', + 'IoTDeviceInfo', + 'IoTEdgeAgentInfo', + 'IoTRole', + 'Ipv4Config', + 'Ipv6Config', + 'Job', + 'JobErrorDetails', + 'JobErrorItem', + 'KubernetesClusterInfo', + 'KubernetesIPConfiguration', + 'KubernetesRole', + 'KubernetesRoleCompute', + 'KubernetesRoleNetwork', + 'KubernetesRoleResources', + 'KubernetesRoleStorage', + 'KubernetesRoleStorageClassInfo', + 'LoadBalancerConfig', + 'MECRole', + 'MetricConfiguration', + 'MetricCounter', + 'MetricCounterSet', + 'MetricDimension', + 'MetricDimensionV1', + 'MetricSpecificationV1', + 'MonitoringMetricConfiguration', + 'MonitoringMetricConfigurationList', + 'MountPointMap', + 'NetworkAdapter', + 'NetworkAdapterPosition', + 'NetworkSettings', + 'Node', + 'NodeInfo', + 'NodeList', + 'Operation', + 'OperationDisplay', + 'OperationsList', + 'Order', + 'OrderList', + 'OrderStatus', + 'PeriodicTimerEventTrigger', + 'PeriodicTimerSourceInfo', + 'RefreshDetails', + 'RemoteSupportSettings', + 'ResourceIdentity', + 'ResourceMoveDetails', + 'ResourceTypeSku', + 'Role', + 'RoleList', + 'RoleSinkInfo', + 'Secret', + 'SecuritySettings', + 'ServiceSpecification', + 'Share', + 'ShareAccessRight', + 'ShareList', + 'Sku', + 'SkuCapability', + 'SkuCost', + 'SkuInformation', + 'SkuInformationList', + 'SkuLocationInfo', + 'StorageAccount', + 'StorageAccountCredential', + 'StorageAccountCredentialList', + 'StorageAccountList', + 'SubscriptionRegisteredFeatures', + 'SymmetricKey', + 'SystemData', + 'TrackingInfo', + 'Trigger', + 'TriggerList', + 'TriggerSupportPackageRequest', + 'UpdateDetails', + 'UpdateDownloadProgress', + 'UpdateInstallProgress', + 'UpdateSummary', + 'UploadCertificateRequest', + 'UploadCertificateResponse', + 'User', + 'UserAccessRight', + 'UserList', + 'AccessLevel', + 'AccountType', + 'AddonState', + 'AddonType', + 'AlertSeverity', + 'AuthenticationType', + 'AzureContainerDataFormat', + 'ClientPermissionType', + 'ContainerStatus', + 'CreatedByType', + 'DataBoxEdgeDeviceKind', + 'DataBoxEdgeDeviceStatus', + 'DataPolicy', + 'DataResidencyType', + 'DayOfWeek', + 'DeviceType', + 'DownloadPhase', + 'EncryptionAlgorithm', + 'HostPlatformType', + 'InstallRebootBehavior', + 'InstallationImpact', + 'JobStatus', + 'JobType', + 'KeyVaultSyncStatus', + 'KubernetesNodeType', + 'KubernetesState', + 'MetricAggregationType', + 'MetricCategory', + 'MetricUnit', + 'MonitoringStatus', + 'MountType', + 'MsiIdentityType', + 'NetworkAdapterDHCPStatus', + 'NetworkAdapterRDMAStatus', + 'NetworkAdapterStatus', + 'NetworkGroup', + 'NodeStatus', + 'OrderState', + 'PlatformType', + 'PosixComplianceStatus', + 'ProactiveDiagnosticsConsent', + 'RemoteApplicationType', + 'ResourceMoveStatus', + 'RoleStatus', + 'RoleTypes', + 'SSLStatus', + 'ShareAccessProtocol', + 'ShareAccessType', + 'ShareStatus', + 'ShipmentType', + 'SkuAvailability', + 'SkuName', + 'SkuSignupOption', + 'SkuTier', + 'SkuVersion', + 'StorageAccountStatus', + 'SubscriptionState', + 'TimeGrain', + 'TriggerEventType', + 'UpdateOperation', + 'UpdateOperationStage', + 'UpdateStatus', + 'UpdateType', + 'UserType', +] diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/models/_data_box_edge_management_client_enums.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/models/_data_box_edge_management_client_enums.py new file mode 100644 index 000000000000..eaee6d34805c --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/models/_data_box_edge_management_client_enums.py @@ -0,0 +1,605 @@ +# 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 +from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta + + +class AccessLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Access level allowed for this remote application type + """ + + NONE = "None" + READ_ONLY = "ReadOnly" + READ_WRITE = "ReadWrite" + FULL_ACCESS = "FullAccess" + +class AccountType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Type of storage accessed on the storage account. + """ + + GENERAL_PURPOSE_STORAGE = "GeneralPurposeStorage" + BLOB_STORAGE = "BlobStorage" + +class AddonState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Addon Provisioning State + """ + + INVALID = "Invalid" + CREATING = "Creating" + CREATED = "Created" + UPDATING = "Updating" + RECONFIGURING = "Reconfiguring" + FAILED = "Failed" + DELETING = "Deleting" + +class AddonType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Addon type. + """ + + IOT_EDGE = "IotEdge" + ARC_FOR_KUBERNETES = "ArcForKubernetes" + +class AlertSeverity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Severity of the alert. + """ + + INFORMATIONAL = "Informational" + WARNING = "Warning" + CRITICAL = "Critical" + +class AuthenticationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The authentication type. + """ + + INVALID = "Invalid" + AZURE_ACTIVE_DIRECTORY = "AzureActiveDirectory" + +class AzureContainerDataFormat(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Storage format used for the file represented by the share. + """ + + BLOCK_BLOB = "BlockBlob" + PAGE_BLOB = "PageBlob" + AZURE_FILE = "AzureFile" + +class ClientPermissionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Type of access to be allowed for the client. + """ + + NO_ACCESS = "NoAccess" + READ_ONLY = "ReadOnly" + READ_WRITE = "ReadWrite" + +class ContainerStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Current status of the container. + """ + + OK = "OK" + OFFLINE = "Offline" + UNKNOWN = "Unknown" + UPDATING = "Updating" + NEEDS_ATTENTION = "NeedsAttention" + +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class DataBoxEdgeDeviceKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The kind of the device. + """ + + AZURE_DATA_BOX_GATEWAY = "AzureDataBoxGateway" + AZURE_STACK_EDGE = "AzureStackEdge" + AZURE_STACK_HUB = "AzureStackHub" + AZURE_MODULAR_DATA_CENTRE = "AzureModularDataCentre" + +class DataBoxEdgeDeviceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The status of the Data Box Edge/Gateway device. + """ + + READY_TO_SETUP = "ReadyToSetup" + ONLINE = "Online" + OFFLINE = "Offline" + NEEDS_ATTENTION = "NeedsAttention" + DISCONNECTED = "Disconnected" + PARTIALLY_DISCONNECTED = "PartiallyDisconnected" + MAINTENANCE = "Maintenance" + +class DataPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Data policy of the share. + """ + + CLOUD = "Cloud" + LOCAL = "Local" + +class DataResidencyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """DataResidencyType enum + """ + + GEO_ZONE_REPLICATION = "GeoZoneReplication" + ZONE_REPLICATION = "ZoneReplication" + +class DayOfWeek(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + SUNDAY = "Sunday" + MONDAY = "Monday" + TUESDAY = "Tuesday" + WEDNESDAY = "Wednesday" + THURSDAY = "Thursday" + FRIDAY = "Friday" + SATURDAY = "Saturday" + +class DeviceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of the Data Box Edge/Gateway device. + """ + + DATA_BOX_EDGE_DEVICE = "DataBoxEdgeDevice" + +class DownloadPhase(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The download phase. + """ + + UNKNOWN = "Unknown" + INITIALIZING = "Initializing" + DOWNLOADING = "Downloading" + VERIFYING = "Verifying" + +class EncryptionAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The algorithm used to encrypt "Value". + """ + + NONE = "None" + AES256 = "AES256" + RSAES_PKCS1_V1_5 = "RSAES_PKCS1_v_1_5" + +class HostPlatformType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Platform where the runtime is hosted. + """ + + KUBERNETES_CLUSTER = "KubernetesCluster" + LINUX_VM = "LinuxVM" + +class InstallationImpact(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Impact of Installing an updateType + """ + + NONE = "None" + DEVICE_REBOOTED = "DeviceRebooted" + KUBERNETES_WORKLOADS_DOWN = "KubernetesWorkloadsDown" + +class InstallRebootBehavior(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Indicates if updates are available and at least one of the updates needs a reboot. + """ + + NEVER_REBOOTS = "NeverReboots" + REQUIRES_REBOOT = "RequiresReboot" + REQUEST_REBOOT = "RequestReboot" + +class JobStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The current status of the job. + """ + + INVALID = "Invalid" + RUNNING = "Running" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + PAUSED = "Paused" + SCHEDULED = "Scheduled" + +class JobType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of the job. + """ + + INVALID = "Invalid" + SCAN_FOR_UPDATES = "ScanForUpdates" + DOWNLOAD_UPDATES = "DownloadUpdates" + INSTALL_UPDATES = "InstallUpdates" + REFRESH_SHARE = "RefreshShare" + REFRESH_CONTAINER = "RefreshContainer" + BACKUP = "Backup" + RESTORE = "Restore" + TRIGGER_SUPPORT_PACKAGE = "TriggerSupportPackage" + +class KeyVaultSyncStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """For changing or to initiate the resync to key-vault set the status to KeyVaultSyncPending, rest + of the status will not be applicable. + """ + + KEY_VAULT_SYNCED = "KeyVaultSynced" + KEY_VAULT_SYNC_FAILED = "KeyVaultSyncFailed" + KEY_VAULT_NOT_CONFIGURED = "KeyVaultNotConfigured" + KEY_VAULT_SYNC_PENDING = "KeyVaultSyncPending" + KEY_VAULT_SYNCING = "KeyVaultSyncing" + KEY_VAULT_NOT_SYNCED = "KeyVaultNotSynced" + +class KubernetesNodeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Node type - Master/Worker + """ + + INVALID = "Invalid" + MASTER = "Master" + WORKER = "Worker" + +class KubernetesState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """State of Kubernetes deployment + """ + + INVALID = "Invalid" + CREATING = "Creating" + CREATED = "Created" + UPDATING = "Updating" + RECONFIGURING = "Reconfiguring" + FAILED = "Failed" + DELETING = "Deleting" + +class MetricAggregationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Metric aggregation type. + """ + + NOT_SPECIFIED = "NotSpecified" + NONE = "None" + AVERAGE = "Average" + MINIMUM = "Minimum" + MAXIMUM = "Maximum" + TOTAL = "Total" + COUNT = "Count" + +class MetricCategory(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Metric category. + """ + + CAPACITY = "Capacity" + TRANSACTION = "Transaction" + +class MetricUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Metric units. + """ + + NOT_SPECIFIED = "NotSpecified" + PERCENT = "Percent" + COUNT = "Count" + SECONDS = "Seconds" + MILLISECONDS = "Milliseconds" + BYTES = "Bytes" + BYTES_PER_SECOND = "BytesPerSecond" + COUNT_PER_SECOND = "CountPerSecond" + +class MonitoringStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Current monitoring status of the share. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class MountType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Mounting type. + """ + + VOLUME = "Volume" + HOST_PATH = "HostPath" + +class MsiIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Identity type + """ + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + +class NetworkAdapterDHCPStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Value indicating whether this adapter has DHCP enabled. + """ + + DISABLED = "Disabled" + ENABLED = "Enabled" + +class NetworkAdapterRDMAStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Value indicating whether this adapter is RDMA capable. + """ + + INCAPABLE = "Incapable" + CAPABLE = "Capable" + +class NetworkAdapterStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Value indicating whether this adapter is valid. + """ + + INACTIVE = "Inactive" + ACTIVE = "Active" + +class NetworkGroup(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The network group. + """ + + NONE = "None" + NON_RDMA = "NonRDMA" + RDMA = "RDMA" + +class NodeStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The current status of the individual node + """ + + UNKNOWN = "Unknown" + UP = "Up" + DOWN = "Down" + REBOOTING = "Rebooting" + SHUTTING_DOWN = "ShuttingDown" + +class OrderState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Status of the order as per the allowed status types. + """ + + UNTRACKED = "Untracked" + AWAITING_FULFILLMENT = "AwaitingFulfillment" + AWAITING_PREPARATION = "AwaitingPreparation" + AWAITING_SHIPMENT = "AwaitingShipment" + SHIPPED = "Shipped" + ARRIVING = "Arriving" + DELIVERED = "Delivered" + REPLACEMENT_REQUESTED = "ReplacementRequested" + LOST_DEVICE = "LostDevice" + DECLINED = "Declined" + RETURN_INITIATED = "ReturnInitiated" + AWAITING_RETURN_SHIPMENT = "AwaitingReturnShipment" + SHIPPED_BACK = "ShippedBack" + COLLECTED_AT_MICROSOFT = "CollectedAtMicrosoft" + AWAITING_PICKUP = "AwaitingPickup" + PICKUP_COMPLETED = "PickupCompleted" + AWAITING_DROP = "AwaitingDrop" + +class PlatformType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Host OS supported by the Arc addon. + """ + + WINDOWS = "Windows" + LINUX = "Linux" + +class PosixComplianceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """If provisioned storage is posix compliant. + """ + + INVALID = "Invalid" + ENABLED = "Enabled" + DISABLED = "Disabled" + +class ProactiveDiagnosticsConsent(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Proactive diagnostic collection consent flag + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class RemoteApplicationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Remote application type + """ + + POWERSHELL = "Powershell" + WAC = "WAC" + LOCAL_UI = "LocalUI" + ALL_APPLICATIONS = "AllApplications" + +class ResourceMoveStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Denotes whether move operation is in progress + """ + + NONE = "None" + RESOURCE_MOVE_IN_PROGRESS = "ResourceMoveInProgress" + RESOURCE_MOVE_FAILED = "ResourceMoveFailed" + +class RoleStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Local Edge Management Status + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class RoleTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + IOT = "IOT" + ASA = "ASA" + FUNCTIONS = "Functions" + COGNITIVE = "Cognitive" + MEC = "MEC" + CLOUD_EDGE_MANAGEMENT = "CloudEdgeManagement" + KUBERNETES = "Kubernetes" + +class ShareAccessProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Access protocol to be used by the share. + """ + + SMB = "SMB" + NFS = "NFS" + +class ShareAccessType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Type of access to be allowed on the share for this user. + """ + + CHANGE = "Change" + READ = "Read" + CUSTOM = "Custom" + +class ShareStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Current status of the share. + """ + + OFFLINE = "Offline" + UNKNOWN = "Unknown" + OK = "OK" + UPDATING = "Updating" + NEEDS_ATTENTION = "NeedsAttention" + +class ShipmentType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + NOT_APPLICABLE = "NotApplicable" + SHIPPED_TO_CUSTOMER = "ShippedToCustomer" + SELF_PICKUP = "SelfPickup" + +class SkuAvailability(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Links to the next set of results + """ + + AVAILABLE = "Available" + UNAVAILABLE = "Unavailable" + +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The Sku name. + """ + + GATEWAY = "Gateway" + EDGE = "Edge" + TEA1_NODE = "TEA_1Node" + TEA1_NODE_UPS = "TEA_1Node_UPS" + TEA1_NODE_HEATER = "TEA_1Node_Heater" + TEA1_NODE_UPS_HEATER = "TEA_1Node_UPS_Heater" + TEA4_NODE_HEATER = "TEA_4Node_Heater" + TEA4_NODE_UPS_HEATER = "TEA_4Node_UPS_Heater" + TMA = "TMA" + TDC = "TDC" + TCA_SMALL = "TCA_Small" + GPU = "GPU" + TCA_LARGE = "TCA_Large" + EDGE_P_BASE = "EdgeP_Base" + EDGE_P_HIGH = "EdgeP_High" + EDGE_PR_BASE = "EdgePR_Base" + EDGE_PR_BASE_UPS = "EdgePR_Base_UPS" + EP2_64_1_VPU_W = "EP2_64_1VPU_W" + EP2_128_1_T4_MX1_W = "EP2_128_1T4_Mx1_W" + EP2_256_2_T4_W = "EP2_256_2T4_W" + EDGE_MR_MINI = "EdgeMR_Mini" + RCA_SMALL = "RCA_Small" + RCA_LARGE = "RCA_Large" + RDC = "RDC" + MANAGEMENT = "Management" + +class SkuSignupOption(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Sku can be signed up by customer or not. + """ + + NONE = "None" + AVAILABLE = "Available" + +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The Sku tier. + """ + + STANDARD = "Standard" + +class SkuVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Availability of the Sku as preview/stable. + """ + + STABLE = "Stable" + PREVIEW = "Preview" + +class SSLStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Signifies whether SSL needs to be enabled or not. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class StorageAccountStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Current status of the storage account + """ + + OK = "OK" + OFFLINE = "Offline" + UNKNOWN = "Unknown" + UPDATING = "Updating" + NEEDS_ATTENTION = "NeedsAttention" + +class SubscriptionState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + REGISTERED = "Registered" + WARNED = "Warned" + SUSPENDED = "Suspended" + DELETED = "Deleted" + UNREGISTERED = "Unregistered" + +class TimeGrain(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + PT1_M = "PT1M" + PT5_M = "PT5M" + PT15_M = "PT15M" + PT30_M = "PT30M" + PT1_H = "PT1H" + PT6_H = "PT6H" + PT12_H = "PT12H" + PT1_D = "PT1D" + +class TriggerEventType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Trigger Kind. + """ + + FILE_EVENT = "FileEvent" + PERIODIC_TIMER_EVENT = "PeriodicTimerEvent" + +class UpdateOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The current update operation. + """ + + NONE = "None" + SCAN = "Scan" + DOWNLOAD = "Download" + INSTALL = "Install" + +class UpdateOperationStage(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Current stage of the update operation. + """ + + UNKNOWN = "Unknown" + INITIAL = "Initial" + SCAN_STARTED = "ScanStarted" + SCAN_COMPLETE = "ScanComplete" + SCAN_FAILED = "ScanFailed" + DOWNLOAD_STARTED = "DownloadStarted" + DOWNLOAD_COMPLETE = "DownloadComplete" + DOWNLOAD_FAILED = "DownloadFailed" + INSTALL_STARTED = "InstallStarted" + INSTALL_COMPLETE = "InstallComplete" + INSTALL_FAILED = "InstallFailed" + REBOOT_INITIATED = "RebootInitiated" + SUCCESS = "Success" + FAILURE = "Failure" + RESCAN_STARTED = "RescanStarted" + RESCAN_COMPLETE = "RescanComplete" + RESCAN_FAILED = "RescanFailed" + +class UpdateStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Status of the update. + """ + + DOWNLOAD_PENDING = "DownloadPending" + DOWNLOAD_STARTED = "DownloadStarted" + DOWNLOAD_COMPLETED = "DownloadCompleted" + INSTALL_STARTED = "InstallStarted" + INSTALL_COMPLETED = "InstallCompleted" + +class UpdateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Type of the Update + """ + + SOFTWARE = "Software" + KUBERNETES = "Kubernetes" + FIRMWARE = "Firmware" + +class UserType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Type of the user. + """ + + SHARE = "Share" + LOCAL_MANAGEMENT = "LocalManagement" + ARM = "ARM" diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/models/_models.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/models/_models_py3.py similarity index 54% rename from sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/models/_models.py rename to sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/models/_models_py3.py index ed1d3c45a4dc..1edae55e2fc7 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/models/_models.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/models/_models_py3.py @@ -6,8 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import datetime +from typing import Dict, List, Optional, Union + import msrest.serialization +from ._data_box_edge_management_client_enums import * + class ARMBaseModel(msrest.serialization.Model): """Represents the base class for all object models. @@ -38,6 +43,8 @@ def __init__( self, **kwargs ): + """ + """ super(ARMBaseModel, self).__init__(**kwargs) self.id = None self.name = None @@ -60,11 +67,11 @@ class Addon(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Addon type.Constant filled by server. Possible values include: - "IotEdge", "ArcForKubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AddonType + :ivar kind: Required. Addon type.Constant filled by server. Possible values include: "IotEdge", + "ArcForKubernetes". + :vartype kind: str or ~azure.mgmt.databoxedge.v2021_02_01.models.AddonType :ivar system_data: Addon type. - :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData + :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01.models.SystemData """ _validation = { @@ -91,6 +98,8 @@ def __init__( self, **kwargs ): + """ + """ super(Addon, self).__init__(**kwargs) self.kind = 'Addon' # type: str self.system_data = None @@ -102,7 +111,7 @@ class AddonList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: The Value. - :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Addon] + :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01.models.Addon] :ivar next_link: Link to the next set of results. :vartype next_link: str """ @@ -121,6 +130,8 @@ def __init__( self, **kwargs ): + """ + """ super(AddonList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -131,20 +142,20 @@ class Address(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param address_line1: The address line1. - :type address_line1: str - :param address_line2: The address line2. - :type address_line2: str - :param address_line3: The address line3. - :type address_line3: str - :param postal_code: The postal code. - :type postal_code: str - :param city: The city name. - :type city: str - :param state: The state name. - :type state: str - :param country: Required. The country name. - :type country: str + :ivar address_line1: The address line1. + :vartype address_line1: str + :ivar address_line2: The address line2. + :vartype address_line2: str + :ivar address_line3: The address line3. + :vartype address_line3: str + :ivar postal_code: The postal code. + :vartype postal_code: str + :ivar city: The city name. + :vartype city: str + :ivar state: The state name. + :vartype state: str + :ivar country: Required. The country name. + :vartype country: str """ _validation = { @@ -163,16 +174,40 @@ class Address(msrest.serialization.Model): def __init__( self, + *, + country: str, + address_line1: Optional[str] = None, + address_line2: Optional[str] = None, + address_line3: Optional[str] = None, + postal_code: Optional[str] = None, + city: Optional[str] = None, + state: Optional[str] = None, **kwargs ): + """ + :keyword address_line1: The address line1. + :paramtype address_line1: str + :keyword address_line2: The address line2. + :paramtype address_line2: str + :keyword address_line3: The address line3. + :paramtype address_line3: str + :keyword postal_code: The postal code. + :paramtype postal_code: str + :keyword city: The city name. + :paramtype city: str + :keyword state: The state name. + :paramtype state: str + :keyword country: Required. The country name. + :paramtype country: str + """ super(Address, self).__init__(**kwargs) - self.address_line1 = kwargs.get('address_line1', None) - self.address_line2 = kwargs.get('address_line2', None) - self.address_line3 = kwargs.get('address_line3', None) - self.postal_code = kwargs.get('postal_code', None) - self.city = kwargs.get('city', None) - self.state = kwargs.get('state', None) - self.country = kwargs['country'] + self.address_line1 = address_line1 + self.address_line2 = address_line2 + self.address_line3 = address_line3 + self.postal_code = postal_code + self.city = city + self.state = state + self.country = country class Alert(ARMBaseModel): @@ -187,7 +222,7 @@ class Alert(ARMBaseModel): :ivar type: The hierarchical type of the object. :vartype type: str :ivar system_data: Alert generated in the resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData + :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01.models.SystemData :ivar title: Alert title. :vartype title: str :ivar alert_type: Alert type. @@ -198,9 +233,9 @@ class Alert(ARMBaseModel): :vartype recommendation: str :ivar severity: Severity of the alert. Possible values include: "Informational", "Warning", "Critical". - :vartype severity: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AlertSeverity + :vartype severity: str or ~azure.mgmt.databoxedge.v2021_02_01.models.AlertSeverity :ivar error_details: Error details of the alert. - :vartype error_details: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AlertErrorDetails + :vartype error_details: ~azure.mgmt.databoxedge.v2021_02_01.models.AlertErrorDetails :ivar detailed_information: Alert details. :vartype detailed_information: dict[str, str] """ @@ -237,6 +272,8 @@ def __init__( self, **kwargs ): + """ + """ super(Alert, self).__init__(**kwargs) self.system_data = None self.title = None @@ -277,6 +314,8 @@ def __init__( self, **kwargs ): + """ + """ super(AlertErrorDetails, self).__init__(**kwargs) self.error_code = None self.error_message = None @@ -289,7 +328,7 @@ class AlertList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: The value. - :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Alert] + :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01.models.Alert] :ivar next_link: Link to the next set of results. :vartype next_link: str """ @@ -308,6 +347,8 @@ def __init__( self, **kwargs ): + """ + """ super(AlertList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -326,32 +367,30 @@ class ArcAddon(Addon): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Addon type.Constant filled by server. Possible values include: - "IotEdge", "ArcForKubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AddonType + :ivar kind: Required. Addon type.Constant filled by server. Possible values include: "IotEdge", + "ArcForKubernetes". + :vartype kind: str or ~azure.mgmt.databoxedge.v2021_02_01.models.AddonType :ivar system_data: Addon type. - :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param subscription_id: Required. Arc resource subscription Id. - :type subscription_id: str - :param resource_group_name: Required. Arc resource group name. - :type resource_group_name: str - :param resource_name: Required. Arc resource Name. - :type resource_name: str - :param resource_location: Required. Arc resource location. - :type resource_location: str + :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01.models.SystemData + :ivar subscription_id: Required. Arc resource subscription Id. + :vartype subscription_id: str + :ivar resource_group_name: Required. Arc resource group name. + :vartype resource_group_name: str + :ivar resource_name: Required. Arc resource Name. + :vartype resource_name: str + :ivar resource_location: Required. Arc resource location. + :vartype resource_location: str :ivar version: Arc resource version. :vartype version: str :ivar host_platform: Host OS supported by the Arc addon. Possible values include: "Windows", "Linux". - :vartype host_platform: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.PlatformType + :vartype host_platform: str or ~azure.mgmt.databoxedge.v2021_02_01.models.PlatformType :ivar host_platform_type: Platform where the runtime is hosted. Possible values include: "KubernetesCluster", "LinuxVM". - :vartype host_platform_type: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.HostPlatformType + :vartype host_platform_type: str or ~azure.mgmt.databoxedge.v2021_02_01.models.HostPlatformType :ivar provisioning_state: Addon Provisioning State. Possible values include: "Invalid", "Creating", "Created", "Updating", "Reconfiguring", "Failed", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AddonState + :vartype provisioning_state: str or ~azure.mgmt.databoxedge.v2021_02_01.models.AddonState """ _validation = { @@ -388,14 +427,29 @@ class ArcAddon(Addon): def __init__( self, + *, + subscription_id: str, + resource_group_name: str, + resource_name: str, + resource_location: str, **kwargs ): + """ + :keyword subscription_id: Required. Arc resource subscription Id. + :paramtype subscription_id: str + :keyword resource_group_name: Required. Arc resource group name. + :paramtype resource_group_name: str + :keyword resource_name: Required. Arc resource Name. + :paramtype resource_name: str + :keyword resource_location: Required. Arc resource location. + :paramtype resource_location: str + """ super(ArcAddon, self).__init__(**kwargs) self.kind = 'ArcForKubernetes' # type: str - self.subscription_id = kwargs['subscription_id'] - self.resource_group_name = kwargs['resource_group_name'] - self.resource_name = kwargs['resource_name'] - self.resource_location = kwargs['resource_location'] + self.subscription_id = subscription_id + self.resource_group_name = resource_group_name + self.resource_name = resource_name + self.resource_location = resource_location self.version = None self.host_platform = None self.host_platform_type = None @@ -407,15 +461,15 @@ class AsymmetricEncryptedSecret(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The value of the secret. - :type value: str - :param encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the + :ivar value: Required. The value of the secret. + :vartype value: str + :ivar encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the value is unencrypted, it will be null. - :type encryption_cert_thumbprint: str - :param encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values + :vartype encryption_cert_thumbprint: str + :ivar encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values include: "None", "AES256", "RSAES_PKCS1_v_1_5". - :type encryption_algorithm: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.EncryptionAlgorithm + :vartype encryption_algorithm: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.EncryptionAlgorithm """ _validation = { @@ -431,19 +485,34 @@ class AsymmetricEncryptedSecret(msrest.serialization.Model): def __init__( self, + *, + value: str, + encryption_algorithm: Union[str, "EncryptionAlgorithm"], + encryption_cert_thumbprint: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The value of the secret. + :paramtype value: str + :keyword encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the + value is unencrypted, it will be null. + :paramtype encryption_cert_thumbprint: str + :keyword encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values + include: "None", "AES256", "RSAES_PKCS1_v_1_5". + :paramtype encryption_algorithm: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.EncryptionAlgorithm + """ super(AsymmetricEncryptedSecret, self).__init__(**kwargs) - self.value = kwargs['value'] - self.encryption_cert_thumbprint = kwargs.get('encryption_cert_thumbprint', None) - self.encryption_algorithm = kwargs['encryption_algorithm'] + self.value = value + self.encryption_cert_thumbprint = encryption_cert_thumbprint + self.encryption_algorithm = encryption_algorithm class Authentication(msrest.serialization.Model): """Authentication mechanism for IoT devices. - :param symmetric_key: Symmetric key for authentication. - :type symmetric_key: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SymmetricKey + :ivar symmetric_key: Symmetric key for authentication. + :vartype symmetric_key: ~azure.mgmt.databoxedge.v2021_02_01.models.SymmetricKey """ _attribute_map = { @@ -452,10 +521,16 @@ class Authentication(msrest.serialization.Model): def __init__( self, + *, + symmetric_key: Optional["SymmetricKey"] = None, **kwargs ): + """ + :keyword symmetric_key: Symmetric key for authentication. + :paramtype symmetric_key: ~azure.mgmt.databoxedge.v2021_02_01.models.SymmetricKey + """ super(Authentication, self).__init__(**kwargs) - self.symmetric_key = kwargs.get('symmetric_key', None) + self.symmetric_key = symmetric_key class AzureContainerInfo(msrest.serialization.Model): @@ -463,16 +538,16 @@ class AzureContainerInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param storage_account_credential_id: Required. ID of the storage account credential used to + :ivar storage_account_credential_id: Required. ID of the storage account credential used to access storage. - :type storage_account_credential_id: str - :param container_name: Required. Container name (Based on the data format specified, this + :vartype storage_account_credential_id: str + :ivar container_name: Required. Container name (Based on the data format specified, this represents the name of Azure Files/Page blob/Block blob). - :type container_name: str - :param data_format: Required. Storage format used for the file represented by the share. + :vartype container_name: str + :ivar data_format: Required. Storage format used for the file represented by the share. Possible values include: "BlockBlob", "PageBlob", "AzureFile". - :type data_format: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AzureContainerDataFormat + :vartype data_format: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.AzureContainerDataFormat """ _validation = { @@ -489,12 +564,28 @@ class AzureContainerInfo(msrest.serialization.Model): def __init__( self, + *, + storage_account_credential_id: str, + container_name: str, + data_format: Union[str, "AzureContainerDataFormat"], **kwargs ): + """ + :keyword storage_account_credential_id: Required. ID of the storage account credential used to + access storage. + :paramtype storage_account_credential_id: str + :keyword container_name: Required. Container name (Based on the data format specified, this + represents the name of Azure Files/Page blob/Block blob). + :paramtype container_name: str + :keyword data_format: Required. Storage format used for the file represented by the share. + Possible values include: "BlockBlob", "PageBlob", "AzureFile". + :paramtype data_format: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.AzureContainerDataFormat + """ super(AzureContainerInfo, self).__init__(**kwargs) - self.storage_account_credential_id = kwargs['storage_account_credential_id'] - self.container_name = kwargs['container_name'] - self.data_format = kwargs['data_format'] + self.storage_account_credential_id = storage_account_credential_id + self.container_name = container_name + self.data_format = data_format class BandwidthSchedule(ARMBaseModel): @@ -511,15 +602,15 @@ class BandwidthSchedule(ARMBaseModel): :ivar type: The hierarchical type of the object. :vartype type: str :ivar system_data: Bandwidth object related to ASE resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param start: Required. The start time of the schedule in UTC. - :type start: str - :param stop: Required. The stop time of the schedule in UTC. - :type stop: str - :param rate_in_mbps: Required. The bandwidth rate in Mbps. - :type rate_in_mbps: int - :param days: Required. The days of the week when this schedule is applicable. - :type days: list[str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.DayOfWeek] + :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01.models.SystemData + :ivar start: Required. The start time of the schedule in UTC. + :vartype start: str + :ivar stop: Required. The stop time of the schedule in UTC. + :vartype stop: str + :ivar rate_in_mbps: Required. The bandwidth rate in Mbps. + :vartype rate_in_mbps: int + :ivar days: Required. The days of the week when this schedule is applicable. + :vartype days: list[str or ~azure.mgmt.databoxedge.v2021_02_01.models.DayOfWeek] """ _validation = { @@ -546,14 +637,29 @@ class BandwidthSchedule(ARMBaseModel): def __init__( self, + *, + start: str, + stop: str, + rate_in_mbps: int, + days: List[Union[str, "DayOfWeek"]], **kwargs ): + """ + :keyword start: Required. The start time of the schedule in UTC. + :paramtype start: str + :keyword stop: Required. The stop time of the schedule in UTC. + :paramtype stop: str + :keyword rate_in_mbps: Required. The bandwidth rate in Mbps. + :paramtype rate_in_mbps: int + :keyword days: Required. The days of the week when this schedule is applicable. + :paramtype days: list[str or ~azure.mgmt.databoxedge.v2021_02_01.models.DayOfWeek] + """ super(BandwidthSchedule, self).__init__(**kwargs) self.system_data = None - self.start = kwargs['start'] - self.stop = kwargs['stop'] - self.rate_in_mbps = kwargs['rate_in_mbps'] - self.days = kwargs['days'] + self.start = start + self.stop = stop + self.rate_in_mbps = rate_in_mbps + self.days = days class BandwidthSchedulesList(msrest.serialization.Model): @@ -562,7 +668,7 @@ class BandwidthSchedulesList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: The list of bandwidth schedules. - :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.BandwidthSchedule] + :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01.models.BandwidthSchedule] :ivar next_link: Link to the next set of results. :vartype next_link: str """ @@ -581,6 +687,8 @@ def __init__( self, **kwargs ): + """ + """ super(BandwidthSchedulesList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -591,12 +699,12 @@ class ClientAccessRight(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param client: Required. IP of the client. - :type client: str - :param access_permission: Required. Type of access to be allowed for the client. Possible - values include: "NoAccess", "ReadOnly", "ReadWrite". - :type access_permission: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ClientPermissionType + :ivar client: Required. IP of the client. + :vartype client: str + :ivar access_permission: Required. Type of access to be allowed for the client. Possible values + include: "NoAccess", "ReadOnly", "ReadWrite". + :vartype access_permission: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.ClientPermissionType """ _validation = { @@ -611,11 +719,22 @@ class ClientAccessRight(msrest.serialization.Model): def __init__( self, + *, + client: str, + access_permission: Union[str, "ClientPermissionType"], **kwargs ): + """ + :keyword client: Required. IP of the client. + :paramtype client: str + :keyword access_permission: Required. Type of access to be allowed for the client. Possible + values include: "NoAccess", "ReadOnly", "ReadWrite". + :paramtype access_permission: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.ClientPermissionType + """ super(ClientAccessRight, self).__init__(**kwargs) - self.client = kwargs['client'] - self.access_permission = kwargs['access_permission'] + self.client = client + self.access_permission = access_permission class Role(ARMBaseModel): @@ -634,11 +753,11 @@ class Role(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleTypes + :vartype kind: str or ~azure.mgmt.databoxedge.v2021_02_01.models.RoleTypes :ivar system_data: Role configured on ASE resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData + :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01.models.SystemData """ _validation = { @@ -665,13 +784,17 @@ def __init__( self, **kwargs ): + """ + """ super(Role, self).__init__(**kwargs) self.kind = 'Role' # type: str self.system_data = None class CloudEdgeManagementRole(Role): - """CloudEdgeManagementRole role. + """The preview of Virtual Machine Cloud Management from the Azure supports deploying and managing VMs on your Azure Stack Edge device from Azure Portal. +For more information, refer to: https://docs.microsoft.com/en-us/azure/databox-online/azure-stack-edge-gpu-virtual-machine-overview +By using this feature, you agree to the preview legal terms. See the https://azure.microsoft.com/en-us/support/legal/preview-supplemental-terms/ for additional details. Variables are only populated by the server, and will be ignored when sending a request. @@ -683,19 +806,18 @@ class CloudEdgeManagementRole(Role): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleTypes + :vartype kind: str or ~azure.mgmt.databoxedge.v2021_02_01.models.RoleTypes :ivar system_data: Role configured on ASE resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData + :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01.models.SystemData :ivar local_management_status: Local Edge Management Status. Possible values include: "Enabled", "Disabled". - :vartype local_management_status: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleStatus + :vartype local_management_status: str or ~azure.mgmt.databoxedge.v2021_02_01.models.RoleStatus :ivar edge_profile: Edge Profile of the resource. - :vartype edge_profile: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.EdgeProfile - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleStatus + :vartype edge_profile: ~azure.mgmt.databoxedge.v2021_02_01.models.EdgeProfile + :ivar role_status: Role status. Possible values include: "Enabled", "Disabled". + :vartype role_status: str or ~azure.mgmt.databoxedge.v2021_02_01.models.RoleStatus """ _validation = { @@ -721,26 +843,32 @@ class CloudEdgeManagementRole(Role): def __init__( self, + *, + role_status: Optional[Union[str, "RoleStatus"]] = None, **kwargs ): + """ + :keyword role_status: Role status. Possible values include: "Enabled", "Disabled". + :paramtype role_status: str or ~azure.mgmt.databoxedge.v2021_02_01.models.RoleStatus + """ super(CloudEdgeManagementRole, self).__init__(**kwargs) self.kind = 'CloudEdgeManagement' # type: str self.local_management_status = None self.edge_profile = None - self.role_status = kwargs.get('role_status', None) + self.role_status = role_status class CloudErrorBody(msrest.serialization.Model): """An error response from the service. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.CloudErrorBody] + :vartype message: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.databoxedge.v2021_02_01.models.CloudErrorBody] """ _attribute_map = { @@ -751,12 +879,26 @@ class CloudErrorBody(msrest.serialization.Model): def __init__( self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.databoxedge.v2021_02_01.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.details = kwargs.get('details', None) + self.code = code + self.message = message + self.details = details class CniConfig(msrest.serialization.Model): @@ -792,6 +934,8 @@ def __init__( self, **kwargs ): + """ + """ super(CniConfig, self).__init__(**kwargs) self.type = None self.version = None @@ -804,10 +948,10 @@ class ComputeResource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param processor_count: Required. Processor count. - :type processor_count: int - :param memory_in_gb: Required. Memory in GB. - :type memory_in_gb: long + :ivar processor_count: Required. Processor count. + :vartype processor_count: int + :ivar memory_in_gb: Required. Memory in GB. + :vartype memory_in_gb: long """ _validation = { @@ -822,11 +966,20 @@ class ComputeResource(msrest.serialization.Model): def __init__( self, + *, + processor_count: int, + memory_in_gb: int, **kwargs ): + """ + :keyword processor_count: Required. Processor count. + :paramtype processor_count: int + :keyword memory_in_gb: Required. Memory in GB. + :paramtype memory_in_gb: long + """ super(ComputeResource, self).__init__(**kwargs) - self.processor_count = kwargs['processor_count'] - self.memory_in_gb = kwargs['memory_in_gb'] + self.processor_count = processor_count + self.memory_in_gb = memory_in_gb class ContactDetails(msrest.serialization.Model): @@ -834,14 +987,14 @@ class ContactDetails(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param contact_person: Required. The contact person name. - :type contact_person: str - :param company_name: Required. The name of the company. - :type company_name: str - :param phone: Required. The phone number. - :type phone: str - :param email_list: Required. The email list. - :type email_list: list[str] + :ivar contact_person: Required. The contact person name. + :vartype contact_person: str + :ivar company_name: Required. The name of the company. + :vartype company_name: str + :ivar phone: Required. The phone number. + :vartype phone: str + :ivar email_list: Required. The email list. + :vartype email_list: list[str] """ _validation = { @@ -860,13 +1013,28 @@ class ContactDetails(msrest.serialization.Model): def __init__( self, + *, + contact_person: str, + company_name: str, + phone: str, + email_list: List[str], **kwargs ): + """ + :keyword contact_person: Required. The contact person name. + :paramtype contact_person: str + :keyword company_name: Required. The name of the company. + :paramtype company_name: str + :keyword phone: Required. The phone number. + :paramtype phone: str + :keyword email_list: Required. The email list. + :paramtype email_list: list[str] + """ super(ContactDetails, self).__init__(**kwargs) - self.contact_person = kwargs['contact_person'] - self.company_name = kwargs['company_name'] - self.phone = kwargs['phone'] - self.email_list = kwargs['email_list'] + self.contact_person = contact_person + self.company_name = company_name + self.phone = phone + self.email_list = email_list class Container(ARMBaseModel): @@ -883,17 +1051,16 @@ class Container(ARMBaseModel): :ivar type: The hierarchical type of the object. :vartype type: str :ivar system_data: Container in DataBoxEdge Resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData + :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01.models.SystemData :ivar container_status: Current status of the container. Possible values include: "OK", "Offline", "Unknown", "Updating", "NeedsAttention". - :vartype container_status: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ContainerStatus - :param data_format: Required. DataFormat for Container. Possible values include: "BlockBlob", + :vartype container_status: str or ~azure.mgmt.databoxedge.v2021_02_01.models.ContainerStatus + :ivar data_format: Required. DataFormat for Container. Possible values include: "BlockBlob", "PageBlob", "AzureFile". - :type data_format: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AzureContainerDataFormat + :vartype data_format: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.AzureContainerDataFormat :ivar refresh_details: Details of the refresh job on this container. - :vartype refresh_details: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RefreshDetails + :vartype refresh_details: ~azure.mgmt.databoxedge.v2021_02_01.models.RefreshDetails :ivar created_date_time: The UTC time when container got created. :vartype created_date_time: ~datetime.datetime """ @@ -922,12 +1089,20 @@ class Container(ARMBaseModel): def __init__( self, + *, + data_format: Union[str, "AzureContainerDataFormat"], **kwargs ): + """ + :keyword data_format: Required. DataFormat for Container. Possible values include: "BlockBlob", + "PageBlob", "AzureFile". + :paramtype data_format: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.AzureContainerDataFormat + """ super(Container, self).__init__(**kwargs) self.system_data = None self.container_status = None - self.data_format = kwargs['data_format'] + self.data_format = data_format self.refresh_details = None self.created_date_time = None @@ -938,7 +1113,7 @@ class ContainerList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: The list of containers. - :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Container] + :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01.models.Container] :ivar next_link: Link to the next set of results. :vartype next_link: str """ @@ -957,6 +1132,8 @@ def __init__( self, **kwargs ): + """ + """ super(ContainerList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -975,30 +1152,33 @@ class DataBoxEdgeDevice(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param location: Required. The location of the device. This is a supported and registered Azure + :ivar location: Required. The location of the device. This is a supported and registered Azure geographical region (for example, West US, East US, or Southeast Asia). The geographical region of a device cannot be changed once it is created, but if an identical geographical region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. The list of tags that describe the device. These tags can be used - to view and group this device (across resource groups). - :type tags: dict[str, str] - :param sku: The SKU type. - :type sku: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.Sku - :param etag: The etag for the devices. - :type etag: str - :param identity: Msi identity of the resource. - :type identity: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ResourceIdentity - :ivar kind: The etag for the devices. Possible values include: "AzureDataBoxGateway", + :vartype location: str + :ivar tags: A set of tags. The list of tags that describe the device. These tags can be used to + view and group this device (across resource groups). + :vartype tags: dict[str, str] + :ivar sku: The SKU type. + :vartype sku: ~azure.mgmt.databoxedge.v2021_02_01.models.Sku + :ivar etag: The etag for the devices. + :vartype etag: str + :ivar identity: Msi identity of the resource. + :vartype identity: ~azure.mgmt.databoxedge.v2021_02_01.models.ResourceIdentity + :ivar kind: The kind of the device. Possible values include: "AzureDataBoxGateway", "AzureStackEdge", "AzureStackHub", "AzureModularDataCentre". - :vartype kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeDeviceKind + :vartype kind: str or ~azure.mgmt.databoxedge.v2021_02_01.models.DataBoxEdgeDeviceKind :ivar system_data: DataBoxEdge Resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible + :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01.models.SystemData + :ivar system_data_properties_system_data: DataBoxEdge Device Properties. + :vartype system_data_properties_system_data: + ~azure.mgmt.databoxedge.v2021_02_01.models.SystemData + :ivar data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible values include: "ReadyToSetup", "Online", "Offline", "NeedsAttention", "Disconnected", "PartiallyDisconnected", "Maintenance". - :type data_box_edge_device_status: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeDeviceStatus + :vartype data_box_edge_device_status: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.DataBoxEdgeDeviceStatus :ivar serial_number: The Serial Number of Data Box Edge/Gateway device. :vartype serial_number: str :ivar description: The Description of the Data Box Edge/Gateway device. @@ -1007,7 +1187,7 @@ class DataBoxEdgeDevice(ARMBaseModel): :vartype model_description: str :ivar device_type: The type of the Data Box Edge/Gateway device. Possible values include: "DataBoxEdgeDevice". - :vartype device_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.DeviceType + :vartype device_type: str or ~azure.mgmt.databoxedge.v2021_02_01.models.DeviceType :ivar friendly_name: The Data Box Edge/Gateway device name. :vartype friendly_name: str :ivar culture: The Data Box Edge/Gateway device culture. @@ -1024,14 +1204,15 @@ class DataBoxEdgeDevice(ARMBaseModel): :vartype device_hcs_version: str :ivar configured_role_types: Type of compute roles configured. :vartype configured_role_types: list[str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleTypes] + ~azure.mgmt.databoxedge.v2021_02_01.models.RoleTypes] :ivar node_count: The number of nodes in the cluster. :vartype node_count: int :ivar resource_move_details: The details of the move operation on this resource. - :vartype resource_move_details: - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ResourceMoveDetails + :vartype resource_move_details: ~azure.mgmt.databoxedge.v2021_02_01.models.ResourceMoveDetails :ivar edge_profile: The details of Edge Profile for this resource. - :vartype edge_profile: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.EdgeProfile + :vartype edge_profile: ~azure.mgmt.databoxedge.v2021_02_01.models.EdgeProfile + :ivar data_residency: The details of data-residency related properties for this resource. + :vartype data_residency: ~azure.mgmt.databoxedge.v2021_02_01.models.DataResidency """ _validation = { @@ -1039,8 +1220,8 @@ class DataBoxEdgeDevice(ARMBaseModel): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, - 'kind': {'readonly': True}, 'system_data': {'readonly': True}, + 'system_data_properties_system_data': {'readonly': True}, 'serial_number': {'readonly': True}, 'description': {'readonly': True}, 'model_description': {'readonly': True}, @@ -1069,6 +1250,7 @@ class DataBoxEdgeDevice(ARMBaseModel): 'identity': {'key': 'identity', 'type': 'ResourceIdentity'}, 'kind': {'key': 'kind', 'type': 'str'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'system_data_properties_system_data': {'key': 'properties.systemData', 'type': 'SystemData'}, 'data_box_edge_device_status': {'key': 'properties.dataBoxEdgeDeviceStatus', 'type': 'str'}, 'serial_number': {'key': 'properties.serialNumber', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, @@ -1085,21 +1267,58 @@ class DataBoxEdgeDevice(ARMBaseModel): 'node_count': {'key': 'properties.nodeCount', 'type': 'int'}, 'resource_move_details': {'key': 'properties.resourceMoveDetails', 'type': 'ResourceMoveDetails'}, 'edge_profile': {'key': 'properties.edgeProfile', 'type': 'EdgeProfile'}, + 'data_residency': {'key': 'properties.dataResidency', 'type': 'DataResidency'}, } def __init__( self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + sku: Optional["Sku"] = None, + etag: Optional[str] = None, + identity: Optional["ResourceIdentity"] = None, + kind: Optional[Union[str, "DataBoxEdgeDeviceKind"]] = None, + data_box_edge_device_status: Optional[Union[str, "DataBoxEdgeDeviceStatus"]] = None, + data_residency: Optional["DataResidency"] = None, **kwargs ): + """ + :keyword location: Required. The location of the device. This is a supported and registered + Azure geographical region (for example, West US, East US, or Southeast Asia). The geographical + region of a device cannot be changed once it is created, but if an identical geographical + region is specified on update, the request will succeed. + :paramtype location: str + :keyword tags: A set of tags. The list of tags that describe the device. These tags can be used + to view and group this device (across resource groups). + :paramtype tags: dict[str, str] + :keyword sku: The SKU type. + :paramtype sku: ~azure.mgmt.databoxedge.v2021_02_01.models.Sku + :keyword etag: The etag for the devices. + :paramtype etag: str + :keyword identity: Msi identity of the resource. + :paramtype identity: ~azure.mgmt.databoxedge.v2021_02_01.models.ResourceIdentity + :keyword kind: The kind of the device. Possible values include: "AzureDataBoxGateway", + "AzureStackEdge", "AzureStackHub", "AzureModularDataCentre". + :paramtype kind: str or ~azure.mgmt.databoxedge.v2021_02_01.models.DataBoxEdgeDeviceKind + :keyword data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible + values include: "ReadyToSetup", "Online", "Offline", "NeedsAttention", "Disconnected", + "PartiallyDisconnected", "Maintenance". + :paramtype data_box_edge_device_status: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.DataBoxEdgeDeviceStatus + :keyword data_residency: The details of data-residency related properties for this resource. + :paramtype data_residency: ~azure.mgmt.databoxedge.v2021_02_01.models.DataResidency + """ super(DataBoxEdgeDevice, self).__init__(**kwargs) - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.etag = kwargs.get('etag', None) - self.identity = kwargs.get('identity', None) - self.kind = None + self.location = location + self.tags = tags + self.sku = sku + self.etag = etag + self.identity = identity + self.kind = kind self.system_data = None - self.data_box_edge_device_status = kwargs.get('data_box_edge_device_status', None) + self.system_data_properties_system_data = None + self.data_box_edge_device_status = data_box_edge_device_status self.serial_number = None self.description = None self.model_description = None @@ -1115,6 +1334,7 @@ def __init__( self.node_count = None self.resource_move_details = None self.edge_profile = None + self.data_residency = data_residency class DataBoxEdgeDeviceExtendedInfo(ARMBaseModel): @@ -1128,31 +1348,31 @@ class DataBoxEdgeDeviceExtendedInfo(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param encryption_key_thumbprint: The digital signature of encrypted certificate. - :type encryption_key_thumbprint: str - :param encryption_key: The public part of the encryption certificate. Client uses this to + :ivar encryption_key_thumbprint: The digital signature of encrypted certificate. + :vartype encryption_key_thumbprint: str + :ivar encryption_key: The public part of the encryption certificate. Client uses this to encrypt any secret. - :type encryption_key: str + :vartype encryption_key: str :ivar resource_key: The Resource ID of the Resource. :vartype resource_key: str - :param client_secret_store_id: The Key Vault ARM Id for client secrets. - :type client_secret_store_id: str - :param client_secret_store_url: The url to access the Client Key Vault. - :type client_secret_store_url: str - :param channel_integrity_key_name: The name of Channel Integrity Key stored in the Client Key + :ivar client_secret_store_id: The Key Vault ARM Id for client secrets. + :vartype client_secret_store_id: str + :ivar client_secret_store_url: The url to access the Client Key Vault. + :vartype client_secret_store_url: str + :ivar channel_integrity_key_name: The name of Channel Integrity Key stored in the Client Key Vault. - :type channel_integrity_key_name: str - :param channel_integrity_key_version: The version of Channel Integrity Key stored in the Client + :vartype channel_integrity_key_name: str + :ivar channel_integrity_key_version: The version of Channel Integrity Key stored in the Client Key Vault. - :type channel_integrity_key_version: str - :param key_vault_sync_status: Key vault sync status. Possible values include: "KeyVaultSynced", + :vartype channel_integrity_key_version: str + :ivar key_vault_sync_status: Key vault sync status. Possible values include: "KeyVaultSynced", "KeyVaultSyncFailed", "KeyVaultNotConfigured", "KeyVaultSyncPending", "KeyVaultSyncing", "KeyVaultNotSynced". - :type key_vault_sync_status: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.KeyVaultSyncStatus + :vartype key_vault_sync_status: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.KeyVaultSyncStatus :ivar device_secrets: Device secrets, will be returned only with ODataFilter $expand=deviceSecrets. - :vartype device_secrets: dict[str, ~azure.mgmt.databoxedge.v2021_02_01_preview.models.Secret] + :vartype device_secrets: dict[str, ~azure.mgmt.databoxedge.v2021_02_01.models.Secret] """ _validation = { @@ -1180,38 +1400,68 @@ class DataBoxEdgeDeviceExtendedInfo(ARMBaseModel): def __init__( self, + *, + encryption_key_thumbprint: Optional[str] = None, + encryption_key: Optional[str] = None, + client_secret_store_id: Optional[str] = None, + client_secret_store_url: Optional[str] = None, + channel_integrity_key_name: Optional[str] = None, + channel_integrity_key_version: Optional[str] = None, + key_vault_sync_status: Optional[Union[str, "KeyVaultSyncStatus"]] = None, **kwargs ): + """ + :keyword encryption_key_thumbprint: The digital signature of encrypted certificate. + :paramtype encryption_key_thumbprint: str + :keyword encryption_key: The public part of the encryption certificate. Client uses this to + encrypt any secret. + :paramtype encryption_key: str + :keyword client_secret_store_id: The Key Vault ARM Id for client secrets. + :paramtype client_secret_store_id: str + :keyword client_secret_store_url: The url to access the Client Key Vault. + :paramtype client_secret_store_url: str + :keyword channel_integrity_key_name: The name of Channel Integrity Key stored in the Client Key + Vault. + :paramtype channel_integrity_key_name: str + :keyword channel_integrity_key_version: The version of Channel Integrity Key stored in the + Client Key Vault. + :paramtype channel_integrity_key_version: str + :keyword key_vault_sync_status: Key vault sync status. Possible values include: + "KeyVaultSynced", "KeyVaultSyncFailed", "KeyVaultNotConfigured", "KeyVaultSyncPending", + "KeyVaultSyncing", "KeyVaultNotSynced". + :paramtype key_vault_sync_status: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.KeyVaultSyncStatus + """ super(DataBoxEdgeDeviceExtendedInfo, self).__init__(**kwargs) - self.encryption_key_thumbprint = kwargs.get('encryption_key_thumbprint', None) - self.encryption_key = kwargs.get('encryption_key', None) + self.encryption_key_thumbprint = encryption_key_thumbprint + self.encryption_key = encryption_key self.resource_key = None - self.client_secret_store_id = kwargs.get('client_secret_store_id', None) - self.client_secret_store_url = kwargs.get('client_secret_store_url', None) - self.channel_integrity_key_name = kwargs.get('channel_integrity_key_name', None) - self.channel_integrity_key_version = kwargs.get('channel_integrity_key_version', None) - self.key_vault_sync_status = kwargs.get('key_vault_sync_status', None) + self.client_secret_store_id = client_secret_store_id + self.client_secret_store_url = client_secret_store_url + self.channel_integrity_key_name = channel_integrity_key_name + self.channel_integrity_key_version = channel_integrity_key_version + self.key_vault_sync_status = key_vault_sync_status self.device_secrets = None class DataBoxEdgeDeviceExtendedInfoPatch(msrest.serialization.Model): """The Data Box Edge/Gateway device extended info patch. - :param client_secret_store_id: The Key Vault ARM Id for client secrets. - :type client_secret_store_id: str - :param client_secret_store_url: The url to access the Client Key Vault. - :type client_secret_store_url: str - :param channel_integrity_key_name: The name for Channel Integrity Key stored in the Client Key + :ivar client_secret_store_id: The Key Vault ARM Id for client secrets. + :vartype client_secret_store_id: str + :ivar client_secret_store_url: The url to access the Client Key Vault. + :vartype client_secret_store_url: str + :ivar channel_integrity_key_name: The name for Channel Integrity Key stored in the Client Key Vault. - :type channel_integrity_key_name: str - :param channel_integrity_key_version: The version of Channel Integrity Key stored in the Client + :vartype channel_integrity_key_name: str + :ivar channel_integrity_key_version: The version of Channel Integrity Key stored in the Client Key Vault. - :type channel_integrity_key_version: str - :param sync_status: For changing or to initiate the resync to key-vault set the status to + :vartype channel_integrity_key_version: str + :ivar sync_status: For changing or to initiate the resync to key-vault set the status to KeyVaultSyncPending, rest of the status will not be applicable. Possible values include: "KeyVaultSynced", "KeyVaultSyncFailed", "KeyVaultNotConfigured", "KeyVaultSyncPending", "KeyVaultSyncing", "KeyVaultNotSynced". - :type sync_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.KeyVaultSyncStatus + :vartype sync_status: str or ~azure.mgmt.databoxedge.v2021_02_01.models.KeyVaultSyncStatus """ _attribute_map = { @@ -1224,14 +1474,37 @@ class DataBoxEdgeDeviceExtendedInfoPatch(msrest.serialization.Model): def __init__( self, + *, + client_secret_store_id: Optional[str] = None, + client_secret_store_url: Optional[str] = None, + channel_integrity_key_name: Optional[str] = None, + channel_integrity_key_version: Optional[str] = None, + sync_status: Optional[Union[str, "KeyVaultSyncStatus"]] = None, **kwargs ): + """ + :keyword client_secret_store_id: The Key Vault ARM Id for client secrets. + :paramtype client_secret_store_id: str + :keyword client_secret_store_url: The url to access the Client Key Vault. + :paramtype client_secret_store_url: str + :keyword channel_integrity_key_name: The name for Channel Integrity Key stored in the Client + Key Vault. + :paramtype channel_integrity_key_name: str + :keyword channel_integrity_key_version: The version of Channel Integrity Key stored in the + Client Key Vault. + :paramtype channel_integrity_key_version: str + :keyword sync_status: For changing or to initiate the resync to key-vault set the status to + KeyVaultSyncPending, rest of the status will not be applicable. Possible values include: + "KeyVaultSynced", "KeyVaultSyncFailed", "KeyVaultNotConfigured", "KeyVaultSyncPending", + "KeyVaultSyncing", "KeyVaultNotSynced". + :paramtype sync_status: str or ~azure.mgmt.databoxedge.v2021_02_01.models.KeyVaultSyncStatus + """ super(DataBoxEdgeDeviceExtendedInfoPatch, self).__init__(**kwargs) - self.client_secret_store_id = kwargs.get('client_secret_store_id', None) - self.client_secret_store_url = kwargs.get('client_secret_store_url', None) - self.channel_integrity_key_name = kwargs.get('channel_integrity_key_name', None) - self.channel_integrity_key_version = kwargs.get('channel_integrity_key_version', None) - self.sync_status = kwargs.get('sync_status', None) + self.client_secret_store_id = client_secret_store_id + self.client_secret_store_url = client_secret_store_url + self.channel_integrity_key_name = channel_integrity_key_name + self.channel_integrity_key_version = channel_integrity_key_version + self.sync_status = sync_status class DataBoxEdgeDeviceList(msrest.serialization.Model): @@ -1240,7 +1513,7 @@ class DataBoxEdgeDeviceList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: The list of Data Box Edge/Gateway devices. - :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeDevice] + :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01.models.DataBoxEdgeDevice] :ivar next_link: Link to the next set of results. :vartype next_link: str """ @@ -1259,6 +1532,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataBoxEdgeDeviceList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1267,12 +1542,12 @@ def __init__( class DataBoxEdgeDevicePatch(msrest.serialization.Model): """The Data Box Edge/Gateway device patch. - :param tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. - :type tags: dict[str, str] - :param identity: Msi identity of the resource. - :type identity: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ResourceIdentity - :param edge_profile: Edge Profile property of the Data Box Edge/Gateway device. - :type edge_profile: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.EdgeProfilePatch + :ivar tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. + :vartype tags: dict[str, str] + :ivar identity: Msi identity of the resource. + :vartype identity: ~azure.mgmt.databoxedge.v2021_02_01.models.ResourceIdentity + :ivar edge_profile: Edge Profile property of the Data Box Edge/Gateway device. + :vartype edge_profile: ~azure.mgmt.databoxedge.v2021_02_01.models.EdgeProfilePatch """ _attribute_map = { @@ -1283,12 +1558,24 @@ class DataBoxEdgeDevicePatch(msrest.serialization.Model): def __init__( self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["ResourceIdentity"] = None, + edge_profile: Optional["EdgeProfilePatch"] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. + :paramtype tags: dict[str, str] + :keyword identity: Msi identity of the resource. + :paramtype identity: ~azure.mgmt.databoxedge.v2021_02_01.models.ResourceIdentity + :keyword edge_profile: Edge Profile property of the Data Box Edge/Gateway device. + :paramtype edge_profile: ~azure.mgmt.databoxedge.v2021_02_01.models.EdgeProfilePatch + """ super(DataBoxEdgeDevicePatch, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.edge_profile = kwargs.get('edge_profile', None) + self.tags = tags + self.identity = identity + self.edge_profile = edge_profile class DataBoxEdgeMoveRequest(msrest.serialization.Model): @@ -1296,10 +1583,10 @@ class DataBoxEdgeMoveRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param target_resource_group: Required. Target resource group ARMId. - :type target_resource_group: str - :param resources: Required. List of resources to be moved. - :type resources: list[str] + :ivar target_resource_group: Required. Target resource group ARMId. + :vartype target_resource_group: str + :ivar resources: Required. List of resources to be moved. + :vartype resources: list[str] """ _validation = { @@ -1314,11 +1601,20 @@ class DataBoxEdgeMoveRequest(msrest.serialization.Model): def __init__( self, + *, + target_resource_group: str, + resources: List[str], **kwargs ): + """ + :keyword target_resource_group: Required. Target resource group ARMId. + :paramtype target_resource_group: str + :keyword resources: Required. List of resources to be moved. + :paramtype resources: list[str] + """ super(DataBoxEdgeMoveRequest, self).__init__(**kwargs) - self.target_resource_group = kwargs['target_resource_group'] - self.resources = kwargs['resources'] + self.target_resource_group = target_resource_group + self.resources = resources class DataBoxEdgeSku(msrest.serialization.Model): @@ -1333,11 +1629,11 @@ class DataBoxEdgeSku(msrest.serialization.Model): "TEA_4Node_UPS_Heater", "TMA", "TDC", "TCA_Small", "GPU", "TCA_Large", "EdgeP_Base", "EdgeP_High", "EdgePR_Base", "EdgePR_Base_UPS", "EP2_64_1VPU_W", "EP2_128_1T4_Mx1_W", "EP2_256_2T4_W", "EdgeMR_Mini", "RCA_Small", "RCA_Large", "RDC", "Management". - :vartype name: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SkuName + :vartype name: str or ~azure.mgmt.databoxedge.v2021_02_01.models.SkuName :ivar kind: The Sku kind. :vartype kind: str :ivar tier: The Sku tier. Possible values include: "Standard". - :vartype tier: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SkuTier + :vartype tier: str or ~azure.mgmt.databoxedge.v2021_02_01.models.SkuTier :ivar size: The Sku kind. :vartype size: str :ivar family: The Sku family. @@ -1347,24 +1643,22 @@ class DataBoxEdgeSku(msrest.serialization.Model): :ivar api_versions: The API versions in which Sku is available. :vartype api_versions: list[str] :ivar location_info: Availability of the Sku for the location/zone/site. - :vartype location_info: - list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.SkuLocationInfo] + :vartype location_info: list[~azure.mgmt.databoxedge.v2021_02_01.models.SkuLocationInfo] :ivar costs: The pricing info of the Sku. - :vartype costs: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.SkuCost] + :vartype costs: list[~azure.mgmt.databoxedge.v2021_02_01.models.SkuCost] :ivar signup_option: Sku can be signed up by customer or not. Possible values include: "None", "Available". - :vartype signup_option: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SkuSignupOption + :vartype signup_option: str or ~azure.mgmt.databoxedge.v2021_02_01.models.SkuSignupOption :ivar version: Availability of the Sku as preview/stable. Possible values include: "Stable", "Preview". - :vartype version: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SkuVersion + :vartype version: str or ~azure.mgmt.databoxedge.v2021_02_01.models.SkuVersion :ivar availability: Links to the next set of results. Possible values include: "Available", "Unavailable". - :vartype availability: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SkuAvailability + :vartype availability: str or ~azure.mgmt.databoxedge.v2021_02_01.models.SkuAvailability :ivar shipment_types: List of Shipment Types supported by this SKU. - :vartype shipment_types: list[str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ShipmentType] + :vartype shipment_types: list[str or ~azure.mgmt.databoxedge.v2021_02_01.models.ShipmentType] + :ivar capabilities: The capability info of the SKU. + :vartype capabilities: list[~azure.mgmt.databoxedge.v2021_02_01.models.SkuCapability] """ _validation = { @@ -1382,6 +1676,7 @@ class DataBoxEdgeSku(msrest.serialization.Model): 'version': {'readonly': True}, 'availability': {'readonly': True}, 'shipment_types': {'readonly': True}, + 'capabilities': {'readonly': True}, } _attribute_map = { @@ -1399,12 +1694,15 @@ class DataBoxEdgeSku(msrest.serialization.Model): 'version': {'key': 'version', 'type': 'str'}, 'availability': {'key': 'availability', 'type': 'str'}, 'shipment_types': {'key': 'shipmentTypes', 'type': '[str]'}, + 'capabilities': {'key': 'capabilities', 'type': '[SkuCapability]'}, } def __init__( self, **kwargs ): + """ + """ super(DataBoxEdgeSku, self).__init__(**kwargs) self.resource_type = None self.name = None @@ -1420,6 +1718,7 @@ def __init__( self.version = None self.availability = None self.shipment_types = None + self.capabilities = None class DataBoxEdgeSkuList(msrest.serialization.Model): @@ -1428,7 +1727,7 @@ class DataBoxEdgeSkuList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: List of ResourceType Sku. - :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeSku] + :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01.models.DataBoxEdgeSku] :ivar next_link: Links to the next set of results. :vartype next_link: str """ @@ -1447,16 +1746,45 @@ def __init__( self, **kwargs ): + """ + """ super(DataBoxEdgeSkuList, self).__init__(**kwargs) self.value = None self.next_link = None +class DataResidency(msrest.serialization.Model): + """Wraps data-residency related information for edge-resource and this should be used with ARM layer. + + :ivar type: DataResidencyType enum. Possible values include: "GeoZoneReplication", + "ZoneReplication". + :vartype type: str or ~azure.mgmt.databoxedge.v2021_02_01.models.DataResidencyType + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "DataResidencyType"]] = None, + **kwargs + ): + """ + :keyword type: DataResidencyType enum. Possible values include: "GeoZoneReplication", + "ZoneReplication". + :paramtype type: str or ~azure.mgmt.databoxedge.v2021_02_01.models.DataResidencyType + """ + super(DataResidency, self).__init__(**kwargs) + self.type = type + + class DCAccessCode(msrest.serialization.Model): """DC Access code in the case of Self Managed Shipping. - :param auth_code: DCAccess Code for the Self Managed shipment. - :type auth_code: str + :ivar auth_code: DCAccess Code for the Self Managed shipment. + :vartype auth_code: str """ _attribute_map = { @@ -1465,17 +1793,128 @@ class DCAccessCode(msrest.serialization.Model): def __init__( self, + *, + auth_code: Optional[str] = None, **kwargs ): + """ + :keyword auth_code: DCAccess Code for the Self Managed shipment. + :paramtype auth_code: str + """ super(DCAccessCode, self).__init__(**kwargs) - self.auth_code = kwargs.get('auth_code', None) + self.auth_code = auth_code + + +class DiagnosticProactiveLogCollectionSettings(ARMBaseModel): + """The diagnostic proactive log collection settings of a device. + + 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 path ID that uniquely identifies the object. + :vartype id: str + :ivar name: The object name. + :vartype name: str + :ivar type: The hierarchical type of the object. + :vartype type: str + :ivar system_data: DiagnosticProactiveLogCollectionSettings. + :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01.models.SystemData + :ivar user_consent: Required. Proactive diagnostic collection consent flag. Possible values + include: "Enabled", "Disabled". + :vartype user_consent: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.ProactiveDiagnosticsConsent + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'user_consent': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'user_consent': {'key': 'properties.userConsent', 'type': 'str'}, + } + + def __init__( + self, + *, + user_consent: Union[str, "ProactiveDiagnosticsConsent"], + **kwargs + ): + """ + :keyword user_consent: Required. Proactive diagnostic collection consent flag. Possible values + include: "Enabled", "Disabled". + :paramtype user_consent: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.ProactiveDiagnosticsConsent + """ + super(DiagnosticProactiveLogCollectionSettings, self).__init__(**kwargs) + self.system_data = None + self.user_consent = user_consent + + +class DiagnosticRemoteSupportSettings(ARMBaseModel): + """The remote support settings of a device. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The path ID that uniquely identifies the object. + :vartype id: str + :ivar name: The object name. + :vartype name: str + :ivar type: The hierarchical type of the object. + :vartype type: str + :ivar system_data: DiagnosticRemoteSupportSettings. + :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01.models.SystemData + :ivar remote_support_settings_list: Remote support settings list according to the + RemoteApplicationType. + :vartype remote_support_settings_list: + list[~azure.mgmt.databoxedge.v2021_02_01.models.RemoteSupportSettings] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'remote_support_settings_list': {'key': 'properties.remoteSupportSettingsList', 'type': '[RemoteSupportSettings]'}, + } + + def __init__( + self, + *, + remote_support_settings_list: Optional[List["RemoteSupportSettings"]] = None, + **kwargs + ): + """ + :keyword remote_support_settings_list: Remote support settings list according to the + RemoteApplicationType. + :paramtype remote_support_settings_list: + list[~azure.mgmt.databoxedge.v2021_02_01.models.RemoteSupportSettings] + """ + super(DiagnosticRemoteSupportSettings, self).__init__(**kwargs) + self.system_data = None + self.remote_support_settings_list = remote_support_settings_list class EdgeProfile(msrest.serialization.Model): """Details about Edge Profile for the resource. - :param subscription: Edge Profile Subscription. - :type subscription: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.EdgeProfileSubscription + :ivar subscription: Edge Profile Subscription. + :vartype subscription: ~azure.mgmt.databoxedge.v2021_02_01.models.EdgeProfileSubscription """ _attribute_map = { @@ -1484,18 +1923,23 @@ class EdgeProfile(msrest.serialization.Model): def __init__( self, + *, + subscription: Optional["EdgeProfileSubscription"] = None, **kwargs ): + """ + :keyword subscription: Edge Profile Subscription. + :paramtype subscription: ~azure.mgmt.databoxedge.v2021_02_01.models.EdgeProfileSubscription + """ super(EdgeProfile, self).__init__(**kwargs) - self.subscription = kwargs.get('subscription', None) + self.subscription = subscription class EdgeProfilePatch(msrest.serialization.Model): """The Data Box Edge/Gateway Edge Profile patch. - :param subscription: The Data Box Edge/Gateway Edge Profile Subscription patch. - :type subscription: - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.EdgeProfileSubscriptionPatch + :ivar subscription: The Data Box Edge/Gateway Edge Profile Subscription patch. + :vartype subscription: ~azure.mgmt.databoxedge.v2021_02_01.models.EdgeProfileSubscriptionPatch """ _attribute_map = { @@ -1504,37 +1948,44 @@ class EdgeProfilePatch(msrest.serialization.Model): def __init__( self, + *, + subscription: Optional["EdgeProfileSubscriptionPatch"] = None, **kwargs ): + """ + :keyword subscription: The Data Box Edge/Gateway Edge Profile Subscription patch. + :paramtype subscription: + ~azure.mgmt.databoxedge.v2021_02_01.models.EdgeProfileSubscriptionPatch + """ super(EdgeProfilePatch, self).__init__(**kwargs) - self.subscription = kwargs.get('subscription', None) + self.subscription = subscription class EdgeProfileSubscription(msrest.serialization.Model): """Subscription details for the Edge Profile. - :param registration_id: Edge Subscription Registration ID. - :type registration_id: str - :param id: ARM ID of the subscription. - :type id: str - :param state: Possible values include: "Registered", "Warned", "Suspended", "Deleted", + :ivar registration_id: Edge Subscription Registration ID. + :vartype registration_id: str + :ivar id: ARM ID of the subscription. + :vartype id: str + :ivar state: Possible values include: "Registered", "Warned", "Suspended", "Deleted", "Unregistered". - :type state: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SubscriptionState - :param registration_date: - :type registration_date: str - :param subscription_id: - :type subscription_id: str - :param tenant_id: - :type tenant_id: str - :param location_placement_id: - :type location_placement_id: str - :param quota_id: - :type quota_id: str - :param serialized_details: - :type serialized_details: str - :param registered_features: - :type registered_features: - list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.SubscriptionRegisteredFeatures] + :vartype state: str or ~azure.mgmt.databoxedge.v2021_02_01.models.SubscriptionState + :ivar registration_date: + :vartype registration_date: str + :ivar subscription_id: + :vartype subscription_id: str + :ivar tenant_id: + :vartype tenant_id: str + :ivar location_placement_id: + :vartype location_placement_id: str + :ivar quota_id: + :vartype quota_id: str + :ivar serialized_details: + :vartype serialized_details: str + :ivar registered_features: + :vartype registered_features: + list[~azure.mgmt.databoxedge.v2021_02_01.models.SubscriptionRegisteredFeatures] """ _attribute_map = { @@ -1552,26 +2003,61 @@ class EdgeProfileSubscription(msrest.serialization.Model): def __init__( self, + *, + registration_id: Optional[str] = None, + id: Optional[str] = None, + state: Optional[Union[str, "SubscriptionState"]] = None, + registration_date: Optional[str] = None, + subscription_id: Optional[str] = None, + tenant_id: Optional[str] = None, + location_placement_id: Optional[str] = None, + quota_id: Optional[str] = None, + serialized_details: Optional[str] = None, + registered_features: Optional[List["SubscriptionRegisteredFeatures"]] = None, **kwargs ): + """ + :keyword registration_id: Edge Subscription Registration ID. + :paramtype registration_id: str + :keyword id: ARM ID of the subscription. + :paramtype id: str + :keyword state: Possible values include: "Registered", "Warned", "Suspended", "Deleted", + "Unregistered". + :paramtype state: str or ~azure.mgmt.databoxedge.v2021_02_01.models.SubscriptionState + :keyword registration_date: + :paramtype registration_date: str + :keyword subscription_id: + :paramtype subscription_id: str + :keyword tenant_id: + :paramtype tenant_id: str + :keyword location_placement_id: + :paramtype location_placement_id: str + :keyword quota_id: + :paramtype quota_id: str + :keyword serialized_details: + :paramtype serialized_details: str + :keyword registered_features: + :paramtype registered_features: + list[~azure.mgmt.databoxedge.v2021_02_01.models.SubscriptionRegisteredFeatures] + """ super(EdgeProfileSubscription, self).__init__(**kwargs) - self.registration_id = kwargs.get('registration_id', None) - self.id = kwargs.get('id', None) - self.state = kwargs.get('state', None) - self.registration_date = kwargs.get('registration_date', None) - self.subscription_id = kwargs.get('subscription_id', None) - self.tenant_id = kwargs.get('tenant_id', None) - self.location_placement_id = kwargs.get('location_placement_id', None) - self.quota_id = kwargs.get('quota_id', None) - self.serialized_details = kwargs.get('serialized_details', None) - self.registered_features = kwargs.get('registered_features', None) + self.registration_id = registration_id + self.id = id + self.state = state + self.registration_date = registration_date + self.subscription_id = subscription_id + self.tenant_id = tenant_id + self.location_placement_id = location_placement_id + self.quota_id = quota_id + self.serialized_details = serialized_details + self.registered_features = registered_features class EdgeProfileSubscriptionPatch(msrest.serialization.Model): """The Data Box Edge/Gateway Edge Profile Subscription patch. - :param id: The path ID that uniquely identifies the subscription of the edge profile. - :type id: str + :ivar id: The path ID that uniquely identifies the subscription of the edge profile. + :vartype id: str """ _attribute_map = { @@ -1580,10 +2066,16 @@ class EdgeProfileSubscriptionPatch(msrest.serialization.Model): def __init__( self, + *, + id: Optional[str] = None, **kwargs ): + """ + :keyword id: The path ID that uniquely identifies the subscription of the edge profile. + :paramtype id: str + """ super(EdgeProfileSubscriptionPatch, self).__init__(**kwargs) - self.id = kwargs.get('id', None) + self.id = id class EtcdInfo(msrest.serialization.Model): @@ -1611,6 +2103,8 @@ def __init__( self, **kwargs ): + """ + """ super(EtcdInfo, self).__init__(**kwargs) self.type = None self.version = None @@ -1633,10 +2127,10 @@ class Trigger(ARMBaseModel): :ivar type: The hierarchical type of the object. :vartype type: str :ivar system_data: Trigger in DataBoxEdge Resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: + :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01.models.SystemData + :ivar kind: Required. Trigger Kind.Constant filled by server. Possible values include: "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.TriggerEventType + :vartype kind: str or ~azure.mgmt.databoxedge.v2021_02_01.models.TriggerEventType """ _validation = { @@ -1663,6 +2157,8 @@ def __init__( self, **kwargs ): + """ + """ super(Trigger, self).__init__(**kwargs) self.system_data = None self.kind = 'Trigger' # type: str @@ -1682,18 +2178,18 @@ class FileEventTrigger(Trigger): :ivar type: The hierarchical type of the object. :vartype type: str :ivar system_data: Trigger in DataBoxEdge Resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: + :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01.models.SystemData + :ivar kind: Required. Trigger Kind.Constant filled by server. Possible values include: "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.TriggerEventType - :param source_info: Required. File event source details. - :type source_info: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.FileSourceInfo - :param sink_info: Required. Role sink info. - :type sink_info: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against + :vartype kind: str or ~azure.mgmt.databoxedge.v2021_02_01.models.TriggerEventType + :ivar source_info: Required. File event source details. + :vartype source_info: ~azure.mgmt.databoxedge.v2021_02_01.models.FileSourceInfo + :ivar sink_info: Required. Role sink info. + :vartype sink_info: ~azure.mgmt.databoxedge.v2021_02_01.models.RoleSinkInfo + :ivar custom_context_tag: A custom context tag typically used to correlate the trigger against its usage. For example, if a periodic timer trigger is intended for certain specific IoT modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str + :vartype custom_context_tag: str """ _validation = { @@ -1720,13 +2216,27 @@ class FileEventTrigger(Trigger): def __init__( self, + *, + source_info: "FileSourceInfo", + sink_info: "RoleSinkInfo", + custom_context_tag: Optional[str] = None, **kwargs ): + """ + :keyword source_info: Required. File event source details. + :paramtype source_info: ~azure.mgmt.databoxedge.v2021_02_01.models.FileSourceInfo + :keyword sink_info: Required. Role sink info. + :paramtype sink_info: ~azure.mgmt.databoxedge.v2021_02_01.models.RoleSinkInfo + :keyword custom_context_tag: A custom context tag typically used to correlate the trigger + against its usage. For example, if a periodic timer trigger is intended for certain specific + IoT modules in the device, the tag can be the name or the image URL of the module. + :paramtype custom_context_tag: str + """ super(FileEventTrigger, self).__init__(**kwargs) self.kind = 'FileEvent' # type: str - self.source_info = kwargs['source_info'] - self.sink_info = kwargs['sink_info'] - self.custom_context_tag = kwargs.get('custom_context_tag', None) + self.source_info = source_info + self.sink_info = sink_info + self.custom_context_tag = custom_context_tag class FileSourceInfo(msrest.serialization.Model): @@ -1734,8 +2244,8 @@ class FileSourceInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param share_id: Required. File share ID. - :type share_id: str + :ivar share_id: Required. File share ID. + :vartype share_id: str """ _validation = { @@ -1748,23 +2258,29 @@ class FileSourceInfo(msrest.serialization.Model): def __init__( self, + *, + share_id: str, **kwargs ): + """ + :keyword share_id: Required. File share ID. + :paramtype share_id: str + """ super(FileSourceInfo, self).__init__(**kwargs) - self.share_id = kwargs['share_id'] + self.share_id = share_id class GenerateCertResponse(msrest.serialization.Model): """Used in activation key generation flow. - :param public_key: Gets or sets base64 encoded certificate raw data, + :ivar public_key: Gets or sets base64 encoded certificate raw data, this is the public part needed to be uploaded to cert vault. - :type public_key: str - :param private_key: Gets or sets base64 encoded private part of the certificate, + :vartype public_key: str + :ivar private_key: Gets or sets base64 encoded private part of the certificate, needed to form the activation key. - :type private_key: str - :param expiry_time_in_utc: Gets or sets expiry time in UTC. - :type expiry_time_in_utc: str + :vartype private_key: str + :ivar expiry_time_in_utc: Gets or sets expiry time in UTC. + :vartype expiry_time_in_utc: str """ _attribute_map = { @@ -1775,12 +2291,26 @@ class GenerateCertResponse(msrest.serialization.Model): def __init__( self, + *, + public_key: Optional[str] = None, + private_key: Optional[str] = None, + expiry_time_in_utc: Optional[str] = None, **kwargs ): + """ + :keyword public_key: Gets or sets base64 encoded certificate raw data, + this is the public part needed to be uploaded to cert vault. + :paramtype public_key: str + :keyword private_key: Gets or sets base64 encoded private part of the certificate, + needed to form the activation key. + :paramtype private_key: str + :keyword expiry_time_in_utc: Gets or sets expiry time in UTC. + :paramtype expiry_time_in_utc: str + """ super(GenerateCertResponse, self).__init__(**kwargs) - self.public_key = kwargs.get('public_key', None) - self.private_key = kwargs.get('private_key', None) - self.expiry_time_in_utc = kwargs.get('expiry_time_in_utc', None) + self.public_key = public_key + self.private_key = private_key + self.expiry_time_in_utc = expiry_time_in_utc class ImageRepositoryCredential(msrest.serialization.Model): @@ -1788,12 +2318,12 @@ class ImageRepositoryCredential(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param image_repository_url: Required. Image repository url (e.g.: mcr.microsoft.com). - :type image_repository_url: str - :param user_name: Required. Repository user name. - :type user_name: str - :param password: Repository user password. - :type password: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AsymmetricEncryptedSecret + :ivar image_repository_url: Required. Image repository url (e.g.: mcr.microsoft.com). + :vartype image_repository_url: str + :ivar user_name: Required. Repository user name. + :vartype user_name: str + :ivar password: Repository user password. + :vartype password: ~azure.mgmt.databoxedge.v2021_02_01.models.AsymmetricEncryptedSecret """ _validation = { @@ -1809,12 +2339,24 @@ class ImageRepositoryCredential(msrest.serialization.Model): def __init__( self, + *, + image_repository_url: str, + user_name: str, + password: Optional["AsymmetricEncryptedSecret"] = None, **kwargs ): + """ + :keyword image_repository_url: Required. Image repository url (e.g.: mcr.microsoft.com). + :paramtype image_repository_url: str + :keyword user_name: Required. Repository user name. + :paramtype user_name: str + :keyword password: Repository user password. + :paramtype password: ~azure.mgmt.databoxedge.v2021_02_01.models.AsymmetricEncryptedSecret + """ super(ImageRepositoryCredential, self).__init__(**kwargs) - self.image_repository_url = kwargs['image_repository_url'] - self.user_name = kwargs['user_name'] - self.password = kwargs.get('password', None) + self.image_repository_url = image_repository_url + self.user_name = user_name + self.password = password class IoTAddon(Addon): @@ -1830,31 +2372,28 @@ class IoTAddon(Addon): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Addon type.Constant filled by server. Possible values include: - "IotEdge", "ArcForKubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AddonType + :ivar kind: Required. Addon type.Constant filled by server. Possible values include: "IotEdge", + "ArcForKubernetes". + :vartype kind: str or ~azure.mgmt.databoxedge.v2021_02_01.models.AddonType :ivar system_data: Addon type. - :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param io_t_device_details: Required. IoT device metadata to which appliance needs to be + :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01.models.SystemData + :ivar io_t_device_details: Required. IoT device metadata to which appliance needs to be connected. - :type io_t_device_details: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.IoTDeviceInfo - :param io_t_edge_device_details: Required. IoT edge device to which the IoT Addon needs to be + :vartype io_t_device_details: ~azure.mgmt.databoxedge.v2021_02_01.models.IoTDeviceInfo + :ivar io_t_edge_device_details: Required. IoT edge device to which the IoT Addon needs to be configured. - :type io_t_edge_device_details: - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.IoTDeviceInfo + :vartype io_t_edge_device_details: ~azure.mgmt.databoxedge.v2021_02_01.models.IoTDeviceInfo :ivar version: Version of IoT running on the appliance. :vartype version: str :ivar host_platform: Host OS supported by the IoT addon. Possible values include: "Windows", "Linux". - :vartype host_platform: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.PlatformType + :vartype host_platform: str or ~azure.mgmt.databoxedge.v2021_02_01.models.PlatformType :ivar host_platform_type: Platform where the runtime is hosted. Possible values include: "KubernetesCluster", "LinuxVM". - :vartype host_platform_type: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.HostPlatformType + :vartype host_platform_type: str or ~azure.mgmt.databoxedge.v2021_02_01.models.HostPlatformType :ivar provisioning_state: Addon Provisioning State. Possible values include: "Invalid", "Creating", "Created", "Updating", "Reconfiguring", "Failed", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AddonState + :vartype provisioning_state: str or ~azure.mgmt.databoxedge.v2021_02_01.models.AddonState """ _validation = { @@ -1887,12 +2426,23 @@ class IoTAddon(Addon): def __init__( self, + *, + io_t_device_details: "IoTDeviceInfo", + io_t_edge_device_details: "IoTDeviceInfo", **kwargs ): + """ + :keyword io_t_device_details: Required. IoT device metadata to which appliance needs to be + connected. + :paramtype io_t_device_details: ~azure.mgmt.databoxedge.v2021_02_01.models.IoTDeviceInfo + :keyword io_t_edge_device_details: Required. IoT edge device to which the IoT Addon needs to be + configured. + :paramtype io_t_edge_device_details: ~azure.mgmt.databoxedge.v2021_02_01.models.IoTDeviceInfo + """ super(IoTAddon, self).__init__(**kwargs) self.kind = 'IotEdge' # type: str - self.io_t_device_details = kwargs['io_t_device_details'] - self.io_t_edge_device_details = kwargs['io_t_edge_device_details'] + self.io_t_device_details = io_t_device_details + self.io_t_edge_device_details = io_t_edge_device_details self.version = None self.host_platform = None self.host_platform_type = None @@ -1904,14 +2454,14 @@ class IoTDeviceInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param device_id: Required. ID of the IoT device/edge device. - :type device_id: str - :param io_t_host_hub: Required. Host name for the IoT hub associated to the device. - :type io_t_host_hub: str - :param io_t_host_hub_id: Id for the IoT hub associated to the device. - :type io_t_host_hub_id: str - :param authentication: Encrypted IoT device/IoT edge device connection string. - :type authentication: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.Authentication + :ivar device_id: Required. ID of the IoT device/edge device. + :vartype device_id: str + :ivar io_t_host_hub: Required. Host name for the IoT hub associated to the device. + :vartype io_t_host_hub: str + :ivar io_t_host_hub_id: Id for the IoT hub associated to the device. + :vartype io_t_host_hub_id: str + :ivar authentication: Encrypted IoT device/IoT edge device connection string. + :vartype authentication: ~azure.mgmt.databoxedge.v2021_02_01.models.Authentication """ _validation = { @@ -1928,13 +2478,28 @@ class IoTDeviceInfo(msrest.serialization.Model): def __init__( self, + *, + device_id: str, + io_t_host_hub: str, + io_t_host_hub_id: Optional[str] = None, + authentication: Optional["Authentication"] = None, **kwargs ): + """ + :keyword device_id: Required. ID of the IoT device/edge device. + :paramtype device_id: str + :keyword io_t_host_hub: Required. Host name for the IoT hub associated to the device. + :paramtype io_t_host_hub: str + :keyword io_t_host_hub_id: Id for the IoT hub associated to the device. + :paramtype io_t_host_hub_id: str + :keyword authentication: Encrypted IoT device/IoT edge device connection string. + :paramtype authentication: ~azure.mgmt.databoxedge.v2021_02_01.models.Authentication + """ super(IoTDeviceInfo, self).__init__(**kwargs) - self.device_id = kwargs['device_id'] - self.io_t_host_hub = kwargs['io_t_host_hub'] - self.io_t_host_hub_id = kwargs.get('io_t_host_hub_id', None) - self.authentication = kwargs.get('authentication', None) + self.device_id = device_id + self.io_t_host_hub = io_t_host_hub + self.io_t_host_hub_id = io_t_host_hub_id + self.authentication = authentication class IoTEdgeAgentInfo(msrest.serialization.Model): @@ -1942,13 +2507,12 @@ class IoTEdgeAgentInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param image_name: Required. Name of the IoT edge agent image. - :type image_name: str - :param tag: Required. Image Tag. - :type tag: str - :param image_repository: Image repository details. - :type image_repository: - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ImageRepositoryCredential + :ivar image_name: Required. Name of the IoT edge agent image. + :vartype image_name: str + :ivar tag: Required. Image Tag. + :vartype tag: str + :ivar image_repository: Image repository details. + :vartype image_repository: ~azure.mgmt.databoxedge.v2021_02_01.models.ImageRepositoryCredential """ _validation = { @@ -1964,12 +2528,25 @@ class IoTEdgeAgentInfo(msrest.serialization.Model): def __init__( self, + *, + image_name: str, + tag: str, + image_repository: Optional["ImageRepositoryCredential"] = None, **kwargs ): + """ + :keyword image_name: Required. Name of the IoT edge agent image. + :paramtype image_name: str + :keyword tag: Required. Image Tag. + :paramtype tag: str + :keyword image_repository: Image repository details. + :paramtype image_repository: + ~azure.mgmt.databoxedge.v2021_02_01.models.ImageRepositoryCredential + """ super(IoTEdgeAgentInfo, self).__init__(**kwargs) - self.image_name = kwargs['image_name'] - self.tag = kwargs['tag'] - self.image_repository = kwargs.get('image_repository', None) + self.image_name = image_name + self.tag = tag + self.image_repository = image_repository class IoTRole(Role): @@ -1985,33 +2562,31 @@ class IoTRole(Role): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleTypes + :vartype kind: str or ~azure.mgmt.databoxedge.v2021_02_01.models.RoleTypes :ivar system_data: Role configured on ASE resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param host_platform: Host OS supported by the IoT role. Possible values include: "Windows", + :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01.models.SystemData + :ivar host_platform: Host OS supported by the IoT role. Possible values include: "Windows", "Linux". - :type host_platform: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.PlatformType - :param io_t_device_details: IoT device metadata to which data box edge device needs to be + :vartype host_platform: str or ~azure.mgmt.databoxedge.v2021_02_01.models.PlatformType + :ivar io_t_device_details: IoT device metadata to which data box edge device needs to be connected. - :type io_t_device_details: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.IoTDeviceInfo - :param io_t_edge_device_details: IoT edge device to which the IoT role needs to be configured. - :type io_t_edge_device_details: - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.IoTDeviceInfo - :param share_mappings: Mount points of shares in role(s). - :type share_mappings: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MountPointMap] - :param io_t_edge_agent_info: Iot edge agent details to download the agent and bootstrap iot + :vartype io_t_device_details: ~azure.mgmt.databoxedge.v2021_02_01.models.IoTDeviceInfo + :ivar io_t_edge_device_details: IoT edge device to which the IoT role needs to be configured. + :vartype io_t_edge_device_details: ~azure.mgmt.databoxedge.v2021_02_01.models.IoTDeviceInfo + :ivar share_mappings: Mount points of shares in role(s). + :vartype share_mappings: list[~azure.mgmt.databoxedge.v2021_02_01.models.MountPointMap] + :ivar io_t_edge_agent_info: Iot edge agent details to download the agent and bootstrap iot runtime. - :type io_t_edge_agent_info: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.IoTEdgeAgentInfo + :vartype io_t_edge_agent_info: ~azure.mgmt.databoxedge.v2021_02_01.models.IoTEdgeAgentInfo :ivar host_platform_type: Platform where the Iot runtime is hosted. Possible values include: "KubernetesCluster", "LinuxVM". - :vartype host_platform_type: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.HostPlatformType - :param compute_resource: Resource allocation. - :type compute_resource: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ComputeResource - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleStatus + :vartype host_platform_type: str or ~azure.mgmt.databoxedge.v2021_02_01.models.HostPlatformType + :ivar compute_resource: Resource allocation. + :vartype compute_resource: ~azure.mgmt.databoxedge.v2021_02_01.models.ComputeResource + :ivar role_status: Role status. Possible values include: "Enabled", "Disabled". + :vartype role_status: str or ~azure.mgmt.databoxedge.v2021_02_01.models.RoleStatus """ _validation = { @@ -2041,18 +2616,46 @@ class IoTRole(Role): def __init__( self, + *, + host_platform: Optional[Union[str, "PlatformType"]] = None, + io_t_device_details: Optional["IoTDeviceInfo"] = None, + io_t_edge_device_details: Optional["IoTDeviceInfo"] = None, + share_mappings: Optional[List["MountPointMap"]] = None, + io_t_edge_agent_info: Optional["IoTEdgeAgentInfo"] = None, + compute_resource: Optional["ComputeResource"] = None, + role_status: Optional[Union[str, "RoleStatus"]] = None, **kwargs ): + """ + :keyword host_platform: Host OS supported by the IoT role. Possible values include: "Windows", + "Linux". + :paramtype host_platform: str or ~azure.mgmt.databoxedge.v2021_02_01.models.PlatformType + :keyword io_t_device_details: IoT device metadata to which data box edge device needs to be + connected. + :paramtype io_t_device_details: ~azure.mgmt.databoxedge.v2021_02_01.models.IoTDeviceInfo + :keyword io_t_edge_device_details: IoT edge device to which the IoT role needs to be + configured. + :paramtype io_t_edge_device_details: ~azure.mgmt.databoxedge.v2021_02_01.models.IoTDeviceInfo + :keyword share_mappings: Mount points of shares in role(s). + :paramtype share_mappings: list[~azure.mgmt.databoxedge.v2021_02_01.models.MountPointMap] + :keyword io_t_edge_agent_info: Iot edge agent details to download the agent and bootstrap iot + runtime. + :paramtype io_t_edge_agent_info: ~azure.mgmt.databoxedge.v2021_02_01.models.IoTEdgeAgentInfo + :keyword compute_resource: Resource allocation. + :paramtype compute_resource: ~azure.mgmt.databoxedge.v2021_02_01.models.ComputeResource + :keyword role_status: Role status. Possible values include: "Enabled", "Disabled". + :paramtype role_status: str or ~azure.mgmt.databoxedge.v2021_02_01.models.RoleStatus + """ super(IoTRole, self).__init__(**kwargs) self.kind = 'IOT' # type: str - self.host_platform = kwargs.get('host_platform', None) - self.io_t_device_details = kwargs.get('io_t_device_details', None) - self.io_t_edge_device_details = kwargs.get('io_t_edge_device_details', None) - self.share_mappings = kwargs.get('share_mappings', None) - self.io_t_edge_agent_info = kwargs.get('io_t_edge_agent_info', None) + self.host_platform = host_platform + self.io_t_device_details = io_t_device_details + self.io_t_edge_device_details = io_t_edge_device_details + self.share_mappings = share_mappings + self.io_t_edge_agent_info = io_t_edge_agent_info self.host_platform_type = None - self.compute_resource = kwargs.get('compute_resource', None) - self.role_status = kwargs.get('role_status', None) + self.compute_resource = compute_resource + self.role_status = role_status class Ipv4Config(msrest.serialization.Model): @@ -2084,6 +2687,8 @@ def __init__( self, **kwargs ): + """ + """ super(Ipv4Config, self).__init__(**kwargs) self.ip_address = None self.subnet = None @@ -2119,6 +2724,8 @@ def __init__( self, **kwargs ): + """ + """ super(Ipv6Config, self).__init__(**kwargs) self.ip_address = None self.prefix_length = None @@ -2138,7 +2745,7 @@ class Job(msrest.serialization.Model): :vartype type: str :ivar status: The current status of the job. Possible values include: "Invalid", "Running", "Succeeded", "Failed", "Canceled", "Paused", "Scheduled". - :vartype status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.JobStatus + :vartype status: str or ~azure.mgmt.databoxedge.v2021_02_01.models.JobStatus :ivar start_time: The UTC date and time at which the job started. :vartype start_time: ~datetime.datetime :ivar end_time: The UTC date and time at which the job completed. @@ -2146,23 +2753,20 @@ class Job(msrest.serialization.Model): :ivar percent_complete: The percentage of the job that is complete. :vartype percent_complete: int :ivar error: The error details. - :vartype error: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.JobErrorDetails + :vartype error: ~azure.mgmt.databoxedge.v2021_02_01.models.JobErrorDetails :ivar job_type: The type of the job. Possible values include: "Invalid", "ScanForUpdates", "DownloadUpdates", "InstallUpdates", "RefreshShare", "RefreshContainer", "Backup", "Restore", "TriggerSupportPackage". - :vartype job_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.JobType + :vartype job_type: str or ~azure.mgmt.databoxedge.v2021_02_01.models.JobType :ivar current_stage: Current stage of the update operation. Possible values include: "Unknown", "Initial", "ScanStarted", "ScanComplete", "ScanFailed", "DownloadStarted", "DownloadComplete", "DownloadFailed", "InstallStarted", "InstallComplete", "InstallFailed", "RebootInitiated", "Success", "Failure", "RescanStarted", "RescanComplete", "RescanFailed". - :vartype current_stage: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.UpdateOperationStage + :vartype current_stage: str or ~azure.mgmt.databoxedge.v2021_02_01.models.UpdateOperationStage :ivar download_progress: The download progress. - :vartype download_progress: - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.UpdateDownloadProgress + :vartype download_progress: ~azure.mgmt.databoxedge.v2021_02_01.models.UpdateDownloadProgress :ivar install_progress: The install progress. - :vartype install_progress: - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.UpdateInstallProgress + :vartype install_progress: ~azure.mgmt.databoxedge.v2021_02_01.models.UpdateInstallProgress :ivar total_refresh_errors: Total number of errors encountered during the refresh process. :vartype total_refresh_errors: int :ivar error_manifest_file: Local share/remote container relative path to the error manifest @@ -2170,9 +2774,9 @@ class Job(msrest.serialization.Model): :vartype error_manifest_file: str :ivar refreshed_entity_id: ARM ID of the entity that was refreshed. :vartype refreshed_entity_id: str - :param folder: If only subfolders need to be refreshed, then the subfolder path inside the - share or container. (The path is empty if there are no subfolders.). - :type folder: str + :ivar folder: If only subfolders need to be refreshed, then the subfolder path inside the share + or container. (The path is empty if there are no subfolders.). + :vartype folder: str """ _validation = { @@ -2214,8 +2818,15 @@ class Job(msrest.serialization.Model): def __init__( self, + *, + folder: Optional[str] = None, **kwargs ): + """ + :keyword folder: If only subfolders need to be refreshed, then the subfolder path inside the + share or container. (The path is empty if there are no subfolders.). + :paramtype folder: str + """ super(Job, self).__init__(**kwargs) self.id = None self.name = None @@ -2232,7 +2843,7 @@ def __init__( self.total_refresh_errors = None self.error_manifest_file = None self.refreshed_entity_id = None - self.folder = kwargs.get('folder', None) + self.folder = folder class JobErrorDetails(msrest.serialization.Model): @@ -2241,7 +2852,7 @@ class JobErrorDetails(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar error_details: The error details. - :vartype error_details: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.JobErrorItem] + :vartype error_details: list[~azure.mgmt.databoxedge.v2021_02_01.models.JobErrorItem] :ivar code: The code intended for programmatic access. :vartype code: str :ivar message: The message that describes the error in detail. @@ -2264,6 +2875,8 @@ def __init__( self, **kwargs ): + """ + """ super(JobErrorDetails, self).__init__(**kwargs) self.error_details = None self.code = None @@ -2299,6 +2912,8 @@ def __init__( self, **kwargs ): + """ + """ super(JobErrorItem, self).__init__(**kwargs) self.recommendations = None self.code = None @@ -2313,11 +2928,11 @@ class KubernetesClusterInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar etcd_info: Etcd configuration. - :vartype etcd_info: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.EtcdInfo + :vartype etcd_info: ~azure.mgmt.databoxedge.v2021_02_01.models.EtcdInfo :ivar nodes: Kubernetes cluster nodes. - :vartype nodes: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.NodeInfo] - :param version: Required. Kubernetes cluster version. - :type version: str + :vartype nodes: list[~azure.mgmt.databoxedge.v2021_02_01.models.NodeInfo] + :ivar version: Required. Kubernetes cluster version. + :vartype version: str """ _validation = { @@ -2334,12 +2949,18 @@ class KubernetesClusterInfo(msrest.serialization.Model): def __init__( self, + *, + version: str, **kwargs ): + """ + :keyword version: Required. Kubernetes cluster version. + :paramtype version: str + """ super(KubernetesClusterInfo, self).__init__(**kwargs) self.etcd_info = None self.nodes = None - self.version = kwargs['version'] + self.version = version class KubernetesIPConfiguration(msrest.serialization.Model): @@ -2349,8 +2970,8 @@ class KubernetesIPConfiguration(msrest.serialization.Model): :ivar port: Port of the Kubernetes node. :vartype port: str - :param ip_address: IP address of the Kubernetes node. - :type ip_address: str + :ivar ip_address: IP address of the Kubernetes node. + :vartype ip_address: str """ _validation = { @@ -2364,15 +2985,30 @@ class KubernetesIPConfiguration(msrest.serialization.Model): def __init__( self, + *, + ip_address: Optional[str] = None, **kwargs ): + """ + :keyword ip_address: IP address of the Kubernetes node. + :paramtype ip_address: str + """ super(KubernetesIPConfiguration, self).__init__(**kwargs) self.port = None - self.ip_address = kwargs.get('ip_address', None) + self.ip_address = ip_address class KubernetesRole(Role): - """Kubernetes role. + """The limited preview of Kubernetes Cluster Management from the Azure supports: + + +#. Using a simple turn-key option in Azure Portal, deploy a Kubernetes cluster on your Azure Stack Edge device. +#. Configure Kubernetes cluster running on your device with Arc enabled Kubernetes with a click of a button in the Azure Portal. + Azure Arc enables organizations to view, manage, and govern their on-premises Kubernetes clusters using the Azure Portal, command line tools, and APIs. +#. Easily configure Persistent Volumes using SMB and NFS shares for storing container data. + For more information, refer to the document here: https://databoxupdatepackages.blob.core.windows.net/documentation/Microsoft-Azure-Stack-Edge-K8-Cloud-Management-20210323.pdf + Or Demo: https://databoxupdatepackages.blob.core.windows.net/documentation/Microsoft-Azure-Stack-Edge-K8S-Cloud-Management-20210323.mp4 + By using this feature, you agree to the preview legal terms. See the https://azure.microsoft.com/en-us/support/legal/preview-supplemental-terms/. Variables are only populated by the server, and will be ignored when sending a request. @@ -2384,30 +3020,28 @@ class KubernetesRole(Role): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleTypes + :vartype kind: str or ~azure.mgmt.databoxedge.v2021_02_01.models.RoleTypes :ivar system_data: Role configured on ASE resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param host_platform: Host OS supported by the Kubernetes role. Possible values include: + :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01.models.SystemData + :ivar host_platform: Host OS supported by the Kubernetes role. Possible values include: "Windows", "Linux". - :type host_platform: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.PlatformType + :vartype host_platform: str or ~azure.mgmt.databoxedge.v2021_02_01.models.PlatformType :ivar provisioning_state: State of Kubernetes deployment. Possible values include: "Invalid", "Creating", "Created", "Updating", "Reconfiguring", "Failed", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.KubernetesState + :vartype provisioning_state: str or ~azure.mgmt.databoxedge.v2021_02_01.models.KubernetesState :ivar host_platform_type: Platform where the runtime is hosted. Possible values include: "KubernetesCluster", "LinuxVM". - :vartype host_platform_type: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.HostPlatformType - :param kubernetes_cluster_info: Kubernetes cluster configuration. - :type kubernetes_cluster_info: - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.KubernetesClusterInfo - :param kubernetes_role_resources: Kubernetes role resources. - :type kubernetes_role_resources: - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.KubernetesRoleResources - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleStatus + :vartype host_platform_type: str or ~azure.mgmt.databoxedge.v2021_02_01.models.HostPlatformType + :ivar kubernetes_cluster_info: Kubernetes cluster configuration. + :vartype kubernetes_cluster_info: + ~azure.mgmt.databoxedge.v2021_02_01.models.KubernetesClusterInfo + :ivar kubernetes_role_resources: Kubernetes role resources. + :vartype kubernetes_role_resources: + ~azure.mgmt.databoxedge.v2021_02_01.models.KubernetesRoleResources + :ivar role_status: Role status. Possible values include: "Enabled", "Disabled". + :vartype role_status: str or ~azure.mgmt.databoxedge.v2021_02_01.models.RoleStatus """ _validation = { @@ -2436,16 +3070,34 @@ class KubernetesRole(Role): def __init__( self, + *, + host_platform: Optional[Union[str, "PlatformType"]] = None, + kubernetes_cluster_info: Optional["KubernetesClusterInfo"] = None, + kubernetes_role_resources: Optional["KubernetesRoleResources"] = None, + role_status: Optional[Union[str, "RoleStatus"]] = None, **kwargs ): + """ + :keyword host_platform: Host OS supported by the Kubernetes role. Possible values include: + "Windows", "Linux". + :paramtype host_platform: str or ~azure.mgmt.databoxedge.v2021_02_01.models.PlatformType + :keyword kubernetes_cluster_info: Kubernetes cluster configuration. + :paramtype kubernetes_cluster_info: + ~azure.mgmt.databoxedge.v2021_02_01.models.KubernetesClusterInfo + :keyword kubernetes_role_resources: Kubernetes role resources. + :paramtype kubernetes_role_resources: + ~azure.mgmt.databoxedge.v2021_02_01.models.KubernetesRoleResources + :keyword role_status: Role status. Possible values include: "Enabled", "Disabled". + :paramtype role_status: str or ~azure.mgmt.databoxedge.v2021_02_01.models.RoleStatus + """ super(KubernetesRole, self).__init__(**kwargs) self.kind = 'Kubernetes' # type: str - self.host_platform = kwargs.get('host_platform', None) + self.host_platform = host_platform self.provisioning_state = None self.host_platform_type = None - self.kubernetes_cluster_info = kwargs.get('kubernetes_cluster_info', None) - self.kubernetes_role_resources = kwargs.get('kubernetes_role_resources', None) - self.role_status = kwargs.get('role_status', None) + self.kubernetes_cluster_info = kubernetes_cluster_info + self.kubernetes_role_resources = kubernetes_role_resources + self.role_status = role_status class KubernetesRoleCompute(msrest.serialization.Model): @@ -2455,8 +3107,8 @@ class KubernetesRoleCompute(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param vm_profile: Required. VM profile. - :type vm_profile: str + :ivar vm_profile: Required. VM profile. + :vartype vm_profile: str :ivar memory_in_bytes: Memory in bytes. :vartype memory_in_bytes: long :ivar processor_count: Processor count. @@ -2477,10 +3129,16 @@ class KubernetesRoleCompute(msrest.serialization.Model): def __init__( self, + *, + vm_profile: str, **kwargs ): + """ + :keyword vm_profile: Required. VM profile. + :paramtype vm_profile: str + """ super(KubernetesRoleCompute, self).__init__(**kwargs) - self.vm_profile = kwargs['vm_profile'] + self.vm_profile = vm_profile self.memory_in_bytes = None self.processor_count = None @@ -2491,10 +3149,9 @@ class KubernetesRoleNetwork(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar cni_config: Cni configuration. - :vartype cni_config: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.CniConfig + :vartype cni_config: ~azure.mgmt.databoxedge.v2021_02_01.models.CniConfig :ivar load_balancer_config: Load balancer configuration. - :vartype load_balancer_config: - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.LoadBalancerConfig + :vartype load_balancer_config: ~azure.mgmt.databoxedge.v2021_02_01.models.LoadBalancerConfig """ _validation = { @@ -2511,6 +3168,8 @@ def __init__( self, **kwargs ): + """ + """ super(KubernetesRoleNetwork, self).__init__(**kwargs) self.cni_config = None self.load_balancer_config = None @@ -2523,12 +3182,12 @@ class KubernetesRoleResources(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param storage: Kubernetes role storage resource. - :type storage: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.KubernetesRoleStorage - :param compute: Required. Kubernetes role compute resource. - :type compute: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.KubernetesRoleCompute + :ivar storage: Kubernetes role storage resource. + :vartype storage: ~azure.mgmt.databoxedge.v2021_02_01.models.KubernetesRoleStorage + :ivar compute: Required. Kubernetes role compute resource. + :vartype compute: ~azure.mgmt.databoxedge.v2021_02_01.models.KubernetesRoleCompute :ivar network: Kubernetes role network resource. - :vartype network: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.KubernetesRoleNetwork + :vartype network: ~azure.mgmt.databoxedge.v2021_02_01.models.KubernetesRoleNetwork """ _validation = { @@ -2544,11 +3203,20 @@ class KubernetesRoleResources(msrest.serialization.Model): def __init__( self, + *, + compute: "KubernetesRoleCompute", + storage: Optional["KubernetesRoleStorage"] = None, **kwargs ): + """ + :keyword storage: Kubernetes role storage resource. + :paramtype storage: ~azure.mgmt.databoxedge.v2021_02_01.models.KubernetesRoleStorage + :keyword compute: Required. Kubernetes role compute resource. + :paramtype compute: ~azure.mgmt.databoxedge.v2021_02_01.models.KubernetesRoleCompute + """ super(KubernetesRoleResources, self).__init__(**kwargs) - self.storage = kwargs.get('storage', None) - self.compute = kwargs['compute'] + self.storage = storage + self.compute = compute self.network = None @@ -2559,9 +3227,9 @@ class KubernetesRoleStorage(msrest.serialization.Model): :ivar storage_classes: Kubernetes storage class info. :vartype storage_classes: - list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.KubernetesRoleStorageClassInfo] - :param endpoints: Mount points of shares in role(s). - :type endpoints: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MountPointMap] + list[~azure.mgmt.databoxedge.v2021_02_01.models.KubernetesRoleStorageClassInfo] + :ivar endpoints: Mount points of shares in role(s). + :vartype endpoints: list[~azure.mgmt.databoxedge.v2021_02_01.models.MountPointMap] """ _validation = { @@ -2575,11 +3243,17 @@ class KubernetesRoleStorage(msrest.serialization.Model): def __init__( self, + *, + endpoints: Optional[List["MountPointMap"]] = None, **kwargs ): + """ + :keyword endpoints: Mount points of shares in role(s). + :paramtype endpoints: list[~azure.mgmt.databoxedge.v2021_02_01.models.MountPointMap] + """ super(KubernetesRoleStorage, self).__init__(**kwargs) self.storage_classes = None - self.endpoints = kwargs.get('endpoints', None) + self.endpoints = endpoints class KubernetesRoleStorageClassInfo(msrest.serialization.Model): @@ -2594,7 +3268,7 @@ class KubernetesRoleStorageClassInfo(msrest.serialization.Model): :ivar posix_compliant: If provisioned storage is posix compliant. Possible values include: "Invalid", "Enabled", "Disabled". :vartype posix_compliant: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.PosixComplianceStatus + ~azure.mgmt.databoxedge.v2021_02_01.models.PosixComplianceStatus """ _validation = { @@ -2613,6 +3287,8 @@ def __init__( self, **kwargs ): + """ + """ super(KubernetesRoleStorageClassInfo, self).__init__(**kwargs) self.name = None self.type = None @@ -2644,6 +3320,8 @@ def __init__( self, **kwargs ): + """ + """ super(LoadBalancerConfig, self).__init__(**kwargs) self.type = None self.version = None @@ -2662,20 +3340,20 @@ class MECRole(Role): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleTypes + :vartype kind: str or ~azure.mgmt.databoxedge.v2021_02_01.models.RoleTypes :ivar system_data: Role configured on ASE resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param connection_string: Activation key of the MEC. - :type connection_string: - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AsymmetricEncryptedSecret - :param controller_endpoint: Controller Endpoint. - :type controller_endpoint: str - :param resource_unique_id: Unique Id of the Resource. - :type resource_unique_id: str - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleStatus + :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01.models.SystemData + :ivar connection_string: Activation key of the MEC. + :vartype connection_string: + ~azure.mgmt.databoxedge.v2021_02_01.models.AsymmetricEncryptedSecret + :ivar controller_endpoint: Controller Endpoint. + :vartype controller_endpoint: str + :ivar resource_unique_id: Unique Id of the Resource. + :vartype resource_unique_id: str + :ivar role_status: Role status. Possible values include: "Enabled", "Disabled". + :vartype role_status: str or ~azure.mgmt.databoxedge.v2021_02_01.models.RoleStatus """ _validation = { @@ -2700,14 +3378,30 @@ class MECRole(Role): def __init__( self, + *, + connection_string: Optional["AsymmetricEncryptedSecret"] = None, + controller_endpoint: Optional[str] = None, + resource_unique_id: Optional[str] = None, + role_status: Optional[Union[str, "RoleStatus"]] = None, **kwargs ): + """ + :keyword connection_string: Activation key of the MEC. + :paramtype connection_string: + ~azure.mgmt.databoxedge.v2021_02_01.models.AsymmetricEncryptedSecret + :keyword controller_endpoint: Controller Endpoint. + :paramtype controller_endpoint: str + :keyword resource_unique_id: Unique Id of the Resource. + :paramtype resource_unique_id: str + :keyword role_status: Role status. Possible values include: "Enabled", "Disabled". + :paramtype role_status: str or ~azure.mgmt.databoxedge.v2021_02_01.models.RoleStatus + """ super(MECRole, self).__init__(**kwargs) self.kind = 'MEC' # type: str - self.connection_string = kwargs.get('connection_string', None) - self.controller_endpoint = kwargs.get('controller_endpoint', None) - self.resource_unique_id = kwargs.get('resource_unique_id', None) - self.role_status = kwargs.get('role_status', None) + self.connection_string = connection_string + self.controller_endpoint = controller_endpoint + self.resource_unique_id = resource_unique_id + self.role_status = role_status class MetricConfiguration(msrest.serialization.Model): @@ -2715,15 +3409,15 @@ class MetricConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param resource_id: Required. The Resource ID on which the metrics should be pushed. - :type resource_id: str - :param mdm_account: The MDM account to which the counters should be pushed. - :type mdm_account: str - :param metric_name_space: The MDM namespace to which the counters should be pushed. This is + :ivar resource_id: Required. The Resource ID on which the metrics should be pushed. + :vartype resource_id: str + :ivar mdm_account: The MDM account to which the counters should be pushed. + :vartype mdm_account: str + :ivar metric_name_space: The MDM namespace to which the counters should be pushed. This is required if MDMAccount is specified. - :type metric_name_space: str - :param counter_sets: Required. Host name for the IoT hub associated to the device. - :type counter_sets: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricCounterSet] + :vartype metric_name_space: str + :ivar counter_sets: Required. Host name for the IoT hub associated to the device. + :vartype counter_sets: list[~azure.mgmt.databoxedge.v2021_02_01.models.MetricCounterSet] """ _validation = { @@ -2740,13 +3434,29 @@ class MetricConfiguration(msrest.serialization.Model): def __init__( self, + *, + resource_id: str, + counter_sets: List["MetricCounterSet"], + mdm_account: Optional[str] = None, + metric_name_space: Optional[str] = None, **kwargs ): + """ + :keyword resource_id: Required. The Resource ID on which the metrics should be pushed. + :paramtype resource_id: str + :keyword mdm_account: The MDM account to which the counters should be pushed. + :paramtype mdm_account: str + :keyword metric_name_space: The MDM namespace to which the counters should be pushed. This is + required if MDMAccount is specified. + :paramtype metric_name_space: str + :keyword counter_sets: Required. Host name for the IoT hub associated to the device. + :paramtype counter_sets: list[~azure.mgmt.databoxedge.v2021_02_01.models.MetricCounterSet] + """ super(MetricConfiguration, self).__init__(**kwargs) - self.resource_id = kwargs['resource_id'] - self.mdm_account = kwargs.get('mdm_account', None) - self.metric_name_space = kwargs.get('metric_name_space', None) - self.counter_sets = kwargs['counter_sets'] + self.resource_id = resource_id + self.mdm_account = mdm_account + self.metric_name_space = metric_name_space + self.counter_sets = counter_sets class MetricCounter(msrest.serialization.Model): @@ -2754,16 +3464,15 @@ class MetricCounter(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The counter name. - :type name: str - :param instance: The instance from which counter should be collected. - :type instance: str - :param dimension_filter: The dimension filter. - :type dimension_filter: - list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricDimension] - :param additional_dimensions: The additional dimensions to be added to metric. - :type additional_dimensions: - list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricDimension] + :ivar name: Required. The counter name. + :vartype name: str + :ivar instance: The instance from which counter should be collected. + :vartype instance: str + :ivar dimension_filter: The dimension filter. + :vartype dimension_filter: list[~azure.mgmt.databoxedge.v2021_02_01.models.MetricDimension] + :ivar additional_dimensions: The additional dimensions to be added to metric. + :vartype additional_dimensions: + list[~azure.mgmt.databoxedge.v2021_02_01.models.MetricDimension] """ _validation = { @@ -2779,13 +3488,29 @@ class MetricCounter(msrest.serialization.Model): def __init__( self, + *, + name: str, + instance: Optional[str] = None, + dimension_filter: Optional[List["MetricDimension"]] = None, + additional_dimensions: Optional[List["MetricDimension"]] = None, **kwargs ): + """ + :keyword name: Required. The counter name. + :paramtype name: str + :keyword instance: The instance from which counter should be collected. + :paramtype instance: str + :keyword dimension_filter: The dimension filter. + :paramtype dimension_filter: list[~azure.mgmt.databoxedge.v2021_02_01.models.MetricDimension] + :keyword additional_dimensions: The additional dimensions to be added to metric. + :paramtype additional_dimensions: + list[~azure.mgmt.databoxedge.v2021_02_01.models.MetricDimension] + """ super(MetricCounter, self).__init__(**kwargs) - self.name = kwargs['name'] - self.instance = kwargs.get('instance', None) - self.dimension_filter = kwargs.get('dimension_filter', None) - self.additional_dimensions = kwargs.get('additional_dimensions', None) + self.name = name + self.instance = instance + self.dimension_filter = dimension_filter + self.additional_dimensions = additional_dimensions class MetricCounterSet(msrest.serialization.Model): @@ -2793,8 +3518,8 @@ class MetricCounterSet(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param counters: Required. The counters that should be collected in this set. - :type counters: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricCounter] + :ivar counters: Required. The counters that should be collected in this set. + :vartype counters: list[~azure.mgmt.databoxedge.v2021_02_01.models.MetricCounter] """ _validation = { @@ -2807,10 +3532,16 @@ class MetricCounterSet(msrest.serialization.Model): def __init__( self, + *, + counters: List["MetricCounter"], **kwargs ): + """ + :keyword counters: Required. The counters that should be collected in this set. + :paramtype counters: list[~azure.mgmt.databoxedge.v2021_02_01.models.MetricCounter] + """ super(MetricCounterSet, self).__init__(**kwargs) - self.counters = kwargs['counters'] + self.counters = counters class MetricDimension(msrest.serialization.Model): @@ -2818,10 +3549,10 @@ class MetricDimension(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_type: Required. The dimension type. - :type source_type: str - :param source_name: Required. The dimension value. - :type source_name: str + :ivar source_type: Required. The dimension type. + :vartype source_type: str + :ivar source_name: Required. The dimension value. + :vartype source_name: str """ _validation = { @@ -2836,22 +3567,31 @@ class MetricDimension(msrest.serialization.Model): def __init__( self, + *, + source_type: str, + source_name: str, **kwargs ): + """ + :keyword source_type: Required. The dimension type. + :paramtype source_type: str + :keyword source_name: Required. The dimension value. + :paramtype source_name: str + """ super(MetricDimension, self).__init__(**kwargs) - self.source_type = kwargs['source_type'] - self.source_name = kwargs['source_name'] + self.source_type = source_type + self.source_name = source_name class MetricDimensionV1(msrest.serialization.Model): """Metric Dimension v1. - :param name: Name of the metrics dimension. - :type name: str - :param display_name: Display name of the metrics dimension. - :type display_name: str - :param to_be_exported_for_shoebox: To be exported to shoe box. - :type to_be_exported_for_shoebox: bool + :ivar name: Name of the metrics dimension. + :vartype name: str + :ivar display_name: Display name of the metrics dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: To be exported to shoe box. + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -2862,44 +3602,56 @@ class MetricDimensionV1(msrest.serialization.Model): def __init__( self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): + """ + :keyword name: Name of the metrics dimension. + :paramtype name: str + :keyword display_name: Display name of the metrics dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: To be exported to shoe box. + :paramtype to_be_exported_for_shoebox: bool + """ super(MetricDimensionV1, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) + self.name = name + self.display_name = display_name + self.to_be_exported_for_shoebox = to_be_exported_for_shoebox class MetricSpecificationV1(msrest.serialization.Model): """Metric specification version 1. - :param name: Name of the metric. - :type name: str - :param display_name: Display name of the metric. - :type display_name: str - :param display_description: Description of the metric to be displayed. - :type display_description: str - :param unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Display name of the metric. + :vartype display_name: str + :ivar display_description: Description of the metric to be displayed. + :vartype display_description: str + :ivar unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", "Seconds", "Milliseconds", "Bytes", "BytesPerSecond", "CountPerSecond". - :type unit: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricUnit - :param aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", + :vartype unit: str or ~azure.mgmt.databoxedge.v2021_02_01.models.MetricUnit + :ivar aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", "None", "Average", "Minimum", "Maximum", "Total", "Count". - :type aggregation_type: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricAggregationType - :param dimensions: Metric dimensions, other than default dimension which is resource. - :type dimensions: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricDimensionV1] - :param fill_gap_with_zero: Set true to fill the gaps with zero. - :type fill_gap_with_zero: bool - :param category: Metric category. Possible values include: "Capacity", "Transaction". - :type category: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricCategory - :param resource_id_dimension_name_override: Resource name override. - :type resource_id_dimension_name_override: str - :param supported_time_grain_types: Support granularity of metrics. - :type supported_time_grain_types: list[str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.TimeGrain] - :param supported_aggregation_types: Support metric aggregation type. - :type supported_aggregation_types: list[str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricAggregationType] + :vartype aggregation_type: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.MetricAggregationType + :ivar dimensions: Metric dimensions, other than default dimension which is resource. + :vartype dimensions: list[~azure.mgmt.databoxedge.v2021_02_01.models.MetricDimensionV1] + :ivar fill_gap_with_zero: Set true to fill the gaps with zero. + :vartype fill_gap_with_zero: bool + :ivar category: Metric category. Possible values include: "Capacity", "Transaction". + :vartype category: str or ~azure.mgmt.databoxedge.v2021_02_01.models.MetricCategory + :ivar resource_id_dimension_name_override: Resource name override. + :vartype resource_id_dimension_name_override: str + :ivar supported_time_grain_types: Support granularity of metrics. + :vartype supported_time_grain_types: list[str or + ~azure.mgmt.databoxedge.v2021_02_01.models.TimeGrain] + :ivar supported_aggregation_types: Support metric aggregation type. + :vartype supported_aggregation_types: list[str or + ~azure.mgmt.databoxedge.v2021_02_01.models.MetricAggregationType] """ _attribute_map = { @@ -2918,20 +3670,61 @@ class MetricSpecificationV1(msrest.serialization.Model): def __init__( self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + display_description: Optional[str] = None, + unit: Optional[Union[str, "MetricUnit"]] = None, + aggregation_type: Optional[Union[str, "MetricAggregationType"]] = None, + dimensions: Optional[List["MetricDimensionV1"]] = None, + fill_gap_with_zero: Optional[bool] = None, + category: Optional[Union[str, "MetricCategory"]] = None, + resource_id_dimension_name_override: Optional[str] = None, + supported_time_grain_types: Optional[List[Union[str, "TimeGrain"]]] = None, + supported_aggregation_types: Optional[List[Union[str, "MetricAggregationType"]]] = None, **kwargs ): + """ + :keyword name: Name of the metric. + :paramtype name: str + :keyword display_name: Display name of the metric. + :paramtype display_name: str + :keyword display_description: Description of the metric to be displayed. + :paramtype display_description: str + :keyword unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", + "Seconds", "Milliseconds", "Bytes", "BytesPerSecond", "CountPerSecond". + :paramtype unit: str or ~azure.mgmt.databoxedge.v2021_02_01.models.MetricUnit + :keyword aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", + "None", "Average", "Minimum", "Maximum", "Total", "Count". + :paramtype aggregation_type: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.MetricAggregationType + :keyword dimensions: Metric dimensions, other than default dimension which is resource. + :paramtype dimensions: list[~azure.mgmt.databoxedge.v2021_02_01.models.MetricDimensionV1] + :keyword fill_gap_with_zero: Set true to fill the gaps with zero. + :paramtype fill_gap_with_zero: bool + :keyword category: Metric category. Possible values include: "Capacity", "Transaction". + :paramtype category: str or ~azure.mgmt.databoxedge.v2021_02_01.models.MetricCategory + :keyword resource_id_dimension_name_override: Resource name override. + :paramtype resource_id_dimension_name_override: str + :keyword supported_time_grain_types: Support granularity of metrics. + :paramtype supported_time_grain_types: list[str or + ~azure.mgmt.databoxedge.v2021_02_01.models.TimeGrain] + :keyword supported_aggregation_types: Support metric aggregation type. + :paramtype supported_aggregation_types: list[str or + ~azure.mgmt.databoxedge.v2021_02_01.models.MetricAggregationType] + """ super(MetricSpecificationV1, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.dimensions = kwargs.get('dimensions', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.category = kwargs.get('category', None) - self.resource_id_dimension_name_override = kwargs.get('resource_id_dimension_name_override', None) - self.supported_time_grain_types = kwargs.get('supported_time_grain_types', None) - self.supported_aggregation_types = kwargs.get('supported_aggregation_types', None) + self.name = name + self.display_name = display_name + self.display_description = display_description + self.unit = unit + self.aggregation_type = aggregation_type + self.dimensions = dimensions + self.fill_gap_with_zero = fill_gap_with_zero + self.category = category + self.resource_id_dimension_name_override = resource_id_dimension_name_override + self.supported_time_grain_types = supported_time_grain_types + self.supported_aggregation_types = supported_aggregation_types class MonitoringMetricConfiguration(ARMBaseModel): @@ -2948,10 +3741,10 @@ class MonitoringMetricConfiguration(ARMBaseModel): :ivar type: The hierarchical type of the object. :vartype type: str :ivar system_data: MonitoringConfiguration on ASE device. - :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param metric_configurations: Required. The metrics configuration details. - :type metric_configurations: - list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricConfiguration] + :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01.models.SystemData + :ivar metric_configurations: Required. The metrics configuration details. + :vartype metric_configurations: + list[~azure.mgmt.databoxedge.v2021_02_01.models.MetricConfiguration] """ _validation = { @@ -2972,11 +3765,18 @@ class MonitoringMetricConfiguration(ARMBaseModel): def __init__( self, + *, + metric_configurations: List["MetricConfiguration"], **kwargs ): + """ + :keyword metric_configurations: Required. The metrics configuration details. + :paramtype metric_configurations: + list[~azure.mgmt.databoxedge.v2021_02_01.models.MetricConfiguration] + """ super(MonitoringMetricConfiguration, self).__init__(**kwargs) self.system_data = None - self.metric_configurations = kwargs['metric_configurations'] + self.metric_configurations = metric_configurations class MonitoringMetricConfigurationList(msrest.serialization.Model): @@ -2985,8 +3785,7 @@ class MonitoringMetricConfigurationList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: The list of metric configurations. - :vartype value: - list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MonitoringMetricConfiguration] + :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01.models.MonitoringMetricConfiguration] :ivar next_link: Link to the next set of results. :vartype next_link: str """ @@ -3005,6 +3804,8 @@ def __init__( self, **kwargs ): + """ + """ super(MonitoringMetricConfigurationList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3017,17 +3818,17 @@ class MountPointMap(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param share_id: Required. ID of the share mounted to the role VM. - :type share_id: str + :ivar share_id: Required. ID of the share mounted to the role VM. + :vartype share_id: str :ivar role_id: ID of the role to which share is mounted. :vartype role_id: str :ivar mount_point: Mount point for the share. :vartype mount_point: str :ivar mount_type: Mounting type. Possible values include: "Volume", "HostPath". - :vartype mount_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.MountType + :vartype mount_type: str or ~azure.mgmt.databoxedge.v2021_02_01.models.MountType :ivar role_type: Role type. Possible values include: "IOT", "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :vartype role_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleTypes + :vartype role_type: str or ~azure.mgmt.databoxedge.v2021_02_01.models.RoleTypes """ _validation = { @@ -3048,10 +3849,16 @@ class MountPointMap(msrest.serialization.Model): def __init__( self, + *, + share_id: str, **kwargs ): + """ + :keyword share_id: Required. ID of the share mounted to the role VM. + :paramtype share_id: str + """ super(MountPointMap, self).__init__(**kwargs) - self.share_id = kwargs['share_id'] + self.share_id = share_id self.role_id = None self.mount_point = None self.mount_type = None @@ -3066,8 +3873,7 @@ class NetworkAdapter(msrest.serialization.Model): :ivar adapter_id: Instance ID of network adapter. :vartype adapter_id: str :ivar adapter_position: Hardware position of network adapter. - :vartype adapter_position: - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.NetworkAdapterPosition + :vartype adapter_position: ~azure.mgmt.databoxedge.v2021_02_01.models.NetworkAdapterPosition :ivar index: Logical index of the adapter. :vartype index: int :ivar node_id: Node ID of the network adapter. @@ -3082,19 +3888,19 @@ class NetworkAdapter(msrest.serialization.Model): :vartype link_speed: long :ivar status: Value indicating whether this adapter is valid. Possible values include: "Inactive", "Active". - :vartype status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.NetworkAdapterStatus - :param rdma_status: Value indicating whether this adapter is RDMA capable. Possible values + :vartype status: str or ~azure.mgmt.databoxedge.v2021_02_01.models.NetworkAdapterStatus + :ivar rdma_status: Value indicating whether this adapter is RDMA capable. Possible values include: "Incapable", "Capable". - :type rdma_status: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.NetworkAdapterRDMAStatus - :param dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values + :vartype rdma_status: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.NetworkAdapterRDMAStatus + :ivar dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values include: "Disabled", "Enabled". - :type dhcp_status: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.NetworkAdapterDHCPStatus + :vartype dhcp_status: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.NetworkAdapterDHCPStatus :ivar ipv4_configuration: The IPv4 configuration of the network adapter. - :vartype ipv4_configuration: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.Ipv4Config + :vartype ipv4_configuration: ~azure.mgmt.databoxedge.v2021_02_01.models.Ipv4Config :ivar ipv6_configuration: The IPv6 configuration of the network adapter. - :vartype ipv6_configuration: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.Ipv6Config + :vartype ipv6_configuration: ~azure.mgmt.databoxedge.v2021_02_01.models.Ipv6Config :ivar ipv6_link_local_address: The IPv6 local address. :vartype ipv6_link_local_address: str :ivar dns_servers: The list of DNS Servers of the device. @@ -3137,8 +3943,21 @@ class NetworkAdapter(msrest.serialization.Model): def __init__( self, + *, + rdma_status: Optional[Union[str, "NetworkAdapterRDMAStatus"]] = None, + dhcp_status: Optional[Union[str, "NetworkAdapterDHCPStatus"]] = None, **kwargs ): + """ + :keyword rdma_status: Value indicating whether this adapter is RDMA capable. Possible values + include: "Incapable", "Capable". + :paramtype rdma_status: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.NetworkAdapterRDMAStatus + :keyword dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values + include: "Disabled", "Enabled". + :paramtype dhcp_status: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.NetworkAdapterDHCPStatus + """ super(NetworkAdapter, self).__init__(**kwargs) self.adapter_id = None self.adapter_position = None @@ -3149,8 +3968,8 @@ def __init__( self.mac_address = None self.link_speed = None self.status = None - self.rdma_status = kwargs.get('rdma_status', None) - self.dhcp_status = kwargs.get('dhcp_status', None) + self.rdma_status = rdma_status + self.dhcp_status = dhcp_status self.ipv4_configuration = None self.ipv6_configuration = None self.ipv6_link_local_address = None @@ -3163,7 +3982,7 @@ class NetworkAdapterPosition(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar network_group: The network group. Possible values include: "None", "NonRDMA", "RDMA". - :vartype network_group: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.NetworkGroup + :vartype network_group: str or ~azure.mgmt.databoxedge.v2021_02_01.models.NetworkGroup :ivar port: The port. :vartype port: int """ @@ -3182,6 +4001,8 @@ def __init__( self, **kwargs ): + """ + """ super(NetworkAdapterPosition, self).__init__(**kwargs) self.network_group = None self.port = None @@ -3199,10 +4020,9 @@ class NetworkSettings(ARMBaseModel): :ivar type: The hierarchical type of the object. :vartype type: str :ivar system_data: NetworkSettings on ASE device. - :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData + :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01.models.SystemData :ivar network_adapters: The network adapter list on the device. - :vartype network_adapters: - list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.NetworkAdapter] + :vartype network_adapters: list[~azure.mgmt.databoxedge.v2021_02_01.models.NetworkAdapter] """ _validation = { @@ -3225,6 +4045,8 @@ def __init__( self, **kwargs ): + """ + """ super(NetworkSettings, self).__init__(**kwargs) self.system_data = None self.network_adapters = None @@ -3245,7 +4067,7 @@ class Node(ARMBaseModel): :vartype type: str :ivar node_status: The current status of the individual node. Possible values include: "Unknown", "Up", "Down", "Rebooting", "ShuttingDown". - :vartype node_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.NodeStatus + :vartype node_status: str or ~azure.mgmt.databoxedge.v2021_02_01.models.NodeStatus :ivar node_chassis_serial_number: Serial number of the Chassis. :vartype node_chassis_serial_number: str :ivar node_serial_number: Serial number of the individual node. @@ -3291,6 +4113,8 @@ def __init__( self, **kwargs ): + """ + """ super(Node, self).__init__(**kwargs) self.node_status = None self.node_chassis_serial_number = None @@ -3309,10 +4133,10 @@ class NodeInfo(msrest.serialization.Model): :ivar name: Node name. :vartype name: str :ivar type: Node type - Master/Worker. Possible values include: "Invalid", "Master", "Worker". - :vartype type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.KubernetesNodeType - :param ip_configuration: IP Configuration of the Kubernetes node. - :type ip_configuration: - list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.KubernetesIPConfiguration] + :vartype type: str or ~azure.mgmt.databoxedge.v2021_02_01.models.KubernetesNodeType + :ivar ip_configuration: IP Configuration of the Kubernetes node. + :vartype ip_configuration: + list[~azure.mgmt.databoxedge.v2021_02_01.models.KubernetesIPConfiguration] """ _validation = { @@ -3328,12 +4152,19 @@ class NodeInfo(msrest.serialization.Model): def __init__( self, + *, + ip_configuration: Optional[List["KubernetesIPConfiguration"]] = None, **kwargs ): + """ + :keyword ip_configuration: IP Configuration of the Kubernetes node. + :paramtype ip_configuration: + list[~azure.mgmt.databoxedge.v2021_02_01.models.KubernetesIPConfiguration] + """ super(NodeInfo, self).__init__(**kwargs) self.name = None self.type = None - self.ip_configuration = kwargs.get('ip_configuration', None) + self.ip_configuration = ip_configuration class NodeList(msrest.serialization.Model): @@ -3342,13 +4173,14 @@ class NodeList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: The list of Nodes. - :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Node] - :param next_link: Link to the next set of results. - :type next_link: str + :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01.models.Node] + :ivar next_link: Link to the next set of results. + :vartype next_link: str """ _validation = { 'value': {'readonly': True}, + 'next_link': {'readonly': True}, } _attribute_map = { @@ -3360,58 +4192,78 @@ def __init__( self, **kwargs ): + """ + """ super(NodeList, self).__init__(**kwargs) self.value = None - self.next_link = kwargs.get('next_link', None) + self.next_link = None class Operation(msrest.serialization.Model): """Operations. - :param name: Name of the operation. - :type name: str - :param display: Properties displayed for the operation. - :type display: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.OperationDisplay - :param origin: Origin of the operation. - :type origin: str - :param is_data_action: Indicates whether the operation is a data action. - :type is_data_action: bool - :param service_specification: Service specification. - :type service_specification: - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ServiceSpecification + :ivar name: Name of the operation. + :vartype name: str + :ivar is_data_action: Is data action. + :vartype is_data_action: bool + :ivar display: Properties displayed for the operation. + :vartype display: ~azure.mgmt.databoxedge.v2021_02_01.models.OperationDisplay + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar service_specification: Service specification. + :vartype service_specification: ~azure.mgmt.databoxedge.v2021_02_01.models.ServiceSpecification """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, 'origin': {'key': 'origin', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, } def __init__( self, + *, + name: Optional[str] = None, + is_data_action: Optional[bool] = None, + display: Optional["OperationDisplay"] = None, + origin: Optional[str] = None, + service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword name: Name of the operation. + :paramtype name: str + :keyword is_data_action: Is data action. + :paramtype is_data_action: bool + :keyword display: Properties displayed for the operation. + :paramtype display: ~azure.mgmt.databoxedge.v2021_02_01.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword service_specification: Service specification. + :paramtype service_specification: + ~azure.mgmt.databoxedge.v2021_02_01.models.ServiceSpecification + """ super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.is_data_action = kwargs.get('is_data_action', None) - self.service_specification = kwargs.get('service_specification', None) + self.name = name + self.is_data_action = is_data_action + self.display = display + self.origin = origin + self.service_specification = service_specification class OperationDisplay(msrest.serialization.Model): """Operation display properties. - :param provider: Provider name. - :type provider: str - :param resource: The type of resource in which the operation is performed. - :type resource: str - :param operation: Operation to be performed on the resource. - :type operation: str - :param description: Description of the operation to be performed. - :type description: str + :ivar provider: Provider name. + :vartype provider: str + :ivar resource: The type of resource in which the operation is performed. + :vartype resource: str + :ivar operation: Operation to be performed on the resource. + :vartype operation: str + :ivar description: Description of the operation to be performed. + :vartype description: str """ _attribute_map = { @@ -3423,13 +4275,28 @@ class OperationDisplay(msrest.serialization.Model): def __init__( self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Provider name. + :paramtype provider: str + :keyword resource: The type of resource in which the operation is performed. + :paramtype resource: str + :keyword operation: Operation to be performed on the resource. + :paramtype operation: str + :keyword description: Description of the operation to be performed. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description class OperationsList(msrest.serialization.Model): @@ -3437,10 +4304,10 @@ class OperationsList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The value. - :type value: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Operation] - :param next_link: Link to the next set of results. - :type next_link: str + :ivar value: Required. The value. + :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01.models.Operation] + :ivar next_link: Link to the next set of results. + :vartype next_link: str """ _validation = { @@ -3454,11 +4321,20 @@ class OperationsList(msrest.serialization.Model): def __init__( self, + *, + value: List["Operation"], + next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The value. + :paramtype value: list[~azure.mgmt.databoxedge.v2021_02_01.models.Operation] + :keyword next_link: Link to the next set of results. + :paramtype next_link: str + """ super(OperationsList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) + self.value = value + self.next_link = next_link class Order(ARMBaseModel): @@ -3473,28 +4349,26 @@ class Order(ARMBaseModel): :ivar type: The hierarchical type of the object. :vartype type: str :ivar system_data: Order configured on ASE resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param contact_information: The contact details. - :type contact_information: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ContactDetails - :param shipping_address: The shipping address. - :type shipping_address: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.Address + :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01.models.SystemData + :ivar contact_information: The contact details. + :vartype contact_information: ~azure.mgmt.databoxedge.v2021_02_01.models.ContactDetails + :ivar shipping_address: The shipping address. + :vartype shipping_address: ~azure.mgmt.databoxedge.v2021_02_01.models.Address :ivar current_status: Current status of the order. - :vartype current_status: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.OrderStatus + :vartype current_status: ~azure.mgmt.databoxedge.v2021_02_01.models.OrderStatus :ivar order_history: List of status changes in the order. - :vartype order_history: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.OrderStatus] + :vartype order_history: list[~azure.mgmt.databoxedge.v2021_02_01.models.OrderStatus] :ivar serial_number: Serial number of the device. :vartype serial_number: str :ivar delivery_tracking_info: Tracking information for the package delivered to the customer whether it has an original or a replacement device. - :vartype delivery_tracking_info: - list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.TrackingInfo] + :vartype delivery_tracking_info: list[~azure.mgmt.databoxedge.v2021_02_01.models.TrackingInfo] :ivar return_tracking_info: Tracking information for the package returned from the customer whether it has an original or a replacement device. - :vartype return_tracking_info: - list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.TrackingInfo] - :param shipment_type: ShipmentType of the order. Possible values include: "NotApplicable", + :vartype return_tracking_info: list[~azure.mgmt.databoxedge.v2021_02_01.models.TrackingInfo] + :ivar shipment_type: ShipmentType of the order. Possible values include: "NotApplicable", "ShippedToCustomer", "SelfPickup". - :type shipment_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ShipmentType + :vartype shipment_type: str or ~azure.mgmt.databoxedge.v2021_02_01.models.ShipmentType """ _validation = { @@ -3526,18 +4400,31 @@ class Order(ARMBaseModel): def __init__( self, + *, + contact_information: Optional["ContactDetails"] = None, + shipping_address: Optional["Address"] = None, + shipment_type: Optional[Union[str, "ShipmentType"]] = None, **kwargs ): + """ + :keyword contact_information: The contact details. + :paramtype contact_information: ~azure.mgmt.databoxedge.v2021_02_01.models.ContactDetails + :keyword shipping_address: The shipping address. + :paramtype shipping_address: ~azure.mgmt.databoxedge.v2021_02_01.models.Address + :keyword shipment_type: ShipmentType of the order. Possible values include: "NotApplicable", + "ShippedToCustomer", "SelfPickup". + :paramtype shipment_type: str or ~azure.mgmt.databoxedge.v2021_02_01.models.ShipmentType + """ super(Order, self).__init__(**kwargs) self.system_data = None - self.contact_information = kwargs.get('contact_information', None) - self.shipping_address = kwargs.get('shipping_address', None) + self.contact_information = contact_information + self.shipping_address = shipping_address self.current_status = None self.order_history = None self.serial_number = None self.delivery_tracking_info = None self.return_tracking_info = None - self.shipment_type = kwargs.get('shipment_type', None) + self.shipment_type = shipment_type class OrderList(msrest.serialization.Model): @@ -3546,7 +4433,7 @@ class OrderList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: The list of orders. - :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Order] + :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01.models.Order] :ivar next_link: Link to the next set of results. :vartype next_link: str """ @@ -3565,6 +4452,8 @@ def __init__( self, **kwargs ): + """ + """ super(OrderList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3577,18 +4466,18 @@ class OrderStatus(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param status: Required. Status of the order as per the allowed status types. Possible values + :ivar status: Required. Status of the order as per the allowed status types. Possible values include: "Untracked", "AwaitingFulfillment", "AwaitingPreparation", "AwaitingShipment", "Shipped", "Arriving", "Delivered", "ReplacementRequested", "LostDevice", "Declined", "ReturnInitiated", "AwaitingReturnShipment", "ShippedBack", "CollectedAtMicrosoft", "AwaitingPickup", "PickupCompleted", "AwaitingDrop". - :type status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.OrderState + :vartype status: str or ~azure.mgmt.databoxedge.v2021_02_01.models.OrderState :ivar update_date_time: Time of status update. :vartype update_date_time: ~datetime.datetime - :param comments: Comments related to this status change. - :type comments: str + :ivar comments: Comments related to this status change. + :vartype comments: str :ivar tracking_information: Tracking information related to the state in the ordering flow. - :vartype tracking_information: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.TrackingInfo + :vartype tracking_information: ~azure.mgmt.databoxedge.v2021_02_01.models.TrackingInfo :ivar additional_order_details: Dictionary to hold generic information which is not stored by the already existing properties. :vartype additional_order_details: dict[str, str] @@ -3611,12 +4500,25 @@ class OrderStatus(msrest.serialization.Model): def __init__( self, + *, + status: Union[str, "OrderState"], + comments: Optional[str] = None, **kwargs ): + """ + :keyword status: Required. Status of the order as per the allowed status types. Possible values + include: "Untracked", "AwaitingFulfillment", "AwaitingPreparation", "AwaitingShipment", + "Shipped", "Arriving", "Delivered", "ReplacementRequested", "LostDevice", "Declined", + "ReturnInitiated", "AwaitingReturnShipment", "ShippedBack", "CollectedAtMicrosoft", + "AwaitingPickup", "PickupCompleted", "AwaitingDrop". + :paramtype status: str or ~azure.mgmt.databoxedge.v2021_02_01.models.OrderState + :keyword comments: Comments related to this status change. + :paramtype comments: str + """ super(OrderStatus, self).__init__(**kwargs) - self.status = kwargs['status'] + self.status = status self.update_date_time = None - self.comments = kwargs.get('comments', None) + self.comments = comments self.tracking_information = None self.additional_order_details = None @@ -3635,18 +4537,18 @@ class PeriodicTimerEventTrigger(Trigger): :ivar type: The hierarchical type of the object. :vartype type: str :ivar system_data: Trigger in DataBoxEdge Resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: + :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01.models.SystemData + :ivar kind: Required. Trigger Kind.Constant filled by server. Possible values include: "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.TriggerEventType - :param source_info: Required. Periodic timer details. - :type source_info: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.PeriodicTimerSourceInfo - :param sink_info: Required. Role Sink information. - :type sink_info: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against + :vartype kind: str or ~azure.mgmt.databoxedge.v2021_02_01.models.TriggerEventType + :ivar source_info: Required. Periodic timer details. + :vartype source_info: ~azure.mgmt.databoxedge.v2021_02_01.models.PeriodicTimerSourceInfo + :ivar sink_info: Required. Role Sink information. + :vartype sink_info: ~azure.mgmt.databoxedge.v2021_02_01.models.RoleSinkInfo + :ivar custom_context_tag: A custom context tag typically used to correlate the trigger against its usage. For example, if a periodic timer trigger is intended for certain specific IoT modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str + :vartype custom_context_tag: str """ _validation = { @@ -3673,13 +4575,27 @@ class PeriodicTimerEventTrigger(Trigger): def __init__( self, + *, + source_info: "PeriodicTimerSourceInfo", + sink_info: "RoleSinkInfo", + custom_context_tag: Optional[str] = None, **kwargs ): + """ + :keyword source_info: Required. Periodic timer details. + :paramtype source_info: ~azure.mgmt.databoxedge.v2021_02_01.models.PeriodicTimerSourceInfo + :keyword sink_info: Required. Role Sink information. + :paramtype sink_info: ~azure.mgmt.databoxedge.v2021_02_01.models.RoleSinkInfo + :keyword custom_context_tag: A custom context tag typically used to correlate the trigger + against its usage. For example, if a periodic timer trigger is intended for certain specific + IoT modules in the device, the tag can be the name or the image URL of the module. + :paramtype custom_context_tag: str + """ super(PeriodicTimerEventTrigger, self).__init__(**kwargs) self.kind = 'PeriodicTimerEvent' # type: str - self.source_info = kwargs['source_info'] - self.sink_info = kwargs['sink_info'] - self.custom_context_tag = kwargs.get('custom_context_tag', None) + self.source_info = source_info + self.sink_info = sink_info + self.custom_context_tag = custom_context_tag class PeriodicTimerSourceInfo(msrest.serialization.Model): @@ -3687,15 +4603,15 @@ class PeriodicTimerSourceInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param start_time: Required. The time of the day that results in a valid trigger. Schedule is + :ivar start_time: Required. The time of the day that results in a valid trigger. Schedule is computed with reference to the time specified upto seconds. If timezone is not specified the time will considered to be in device timezone. The value will always be returned as UTC time. - :type start_time: ~datetime.datetime - :param schedule: Required. Periodic frequency at which timer event needs to be raised. Supports + :vartype start_time: ~datetime.datetime + :ivar schedule: Required. Periodic frequency at which timer event needs to be raised. Supports daily, hourly, minutes, and seconds. - :type schedule: str - :param topic: Topic where periodic events are published to IoT device. - :type topic: str + :vartype schedule: str + :ivar topic: Topic where periodic events are published to IoT device. + :vartype topic: str """ _validation = { @@ -3711,32 +4627,47 @@ class PeriodicTimerSourceInfo(msrest.serialization.Model): def __init__( self, + *, + start_time: datetime.datetime, + schedule: str, + topic: Optional[str] = None, **kwargs ): + """ + :keyword start_time: Required. The time of the day that results in a valid trigger. Schedule is + computed with reference to the time specified upto seconds. If timezone is not specified the + time will considered to be in device timezone. The value will always be returned as UTC time. + :paramtype start_time: ~datetime.datetime + :keyword schedule: Required. Periodic frequency at which timer event needs to be raised. + Supports daily, hourly, minutes, and seconds. + :paramtype schedule: str + :keyword topic: Topic where periodic events are published to IoT device. + :paramtype topic: str + """ super(PeriodicTimerSourceInfo, self).__init__(**kwargs) - self.start_time = kwargs['start_time'] - self.schedule = kwargs['schedule'] - self.topic = kwargs.get('topic', None) + self.start_time = start_time + self.schedule = schedule + self.topic = topic class RefreshDetails(msrest.serialization.Model): """Fields for tracking refresh job on the share or container. - :param in_progress_refresh_job_id: If a refresh job is currently in progress on this share or + :ivar in_progress_refresh_job_id: If a refresh job is currently in progress on this share or container, this field indicates the ARM resource ID of that job. The field is empty if no job is in progress. - :type in_progress_refresh_job_id: str - :param last_completed_refresh_job_time_in_utc: Indicates the completed time for the last - refresh job on this particular share or container, if any.This could be a failed job or a - successful job. - :type last_completed_refresh_job_time_in_utc: ~datetime.datetime - :param error_manifest_file: Indicates the relative path of the error xml for the last refresh + :vartype in_progress_refresh_job_id: str + :ivar last_completed_refresh_job_time_in_utc: Indicates the completed time for the last refresh + job on this particular share or container, if any.This could be a failed job or a successful + job. + :vartype last_completed_refresh_job_time_in_utc: ~datetime.datetime + :ivar error_manifest_file: Indicates the relative path of the error xml for the last refresh job on this particular share or container, if any. This could be a failed job or a successful job. - :type error_manifest_file: str - :param last_job: Indicates the id of the last refresh job on this particular share or + :vartype error_manifest_file: str + :ivar last_job: Indicates the id of the last refresh job on this particular share or container,if any. This could be a failed job or a successful job. - :type last_job: str + :vartype last_job: str """ _attribute_map = { @@ -3748,13 +4679,80 @@ class RefreshDetails(msrest.serialization.Model): def __init__( self, + *, + in_progress_refresh_job_id: Optional[str] = None, + last_completed_refresh_job_time_in_utc: Optional[datetime.datetime] = None, + error_manifest_file: Optional[str] = None, + last_job: Optional[str] = None, **kwargs ): + """ + :keyword in_progress_refresh_job_id: If a refresh job is currently in progress on this share or + container, this field indicates the ARM resource ID of that job. The field is empty if no job + is in progress. + :paramtype in_progress_refresh_job_id: str + :keyword last_completed_refresh_job_time_in_utc: Indicates the completed time for the last + refresh job on this particular share or container, if any.This could be a failed job or a + successful job. + :paramtype last_completed_refresh_job_time_in_utc: ~datetime.datetime + :keyword error_manifest_file: Indicates the relative path of the error xml for the last refresh + job on this particular share or container, if any. This could be a failed job or a successful + job. + :paramtype error_manifest_file: str + :keyword last_job: Indicates the id of the last refresh job on this particular share or + container,if any. This could be a failed job or a successful job. + :paramtype last_job: str + """ super(RefreshDetails, self).__init__(**kwargs) - self.in_progress_refresh_job_id = kwargs.get('in_progress_refresh_job_id', None) - self.last_completed_refresh_job_time_in_utc = kwargs.get('last_completed_refresh_job_time_in_utc', None) - self.error_manifest_file = kwargs.get('error_manifest_file', None) - self.last_job = kwargs.get('last_job', None) + self.in_progress_refresh_job_id = in_progress_refresh_job_id + self.last_completed_refresh_job_time_in_utc = last_completed_refresh_job_time_in_utc + self.error_manifest_file = error_manifest_file + self.last_job = last_job + + +class RemoteSupportSettings(msrest.serialization.Model): + """RemoteApplicationType for which remote support settings is being modified. + + :ivar remote_application_type: Remote application type. Possible values include: "Powershell", + "WAC", "LocalUI", "AllApplications". + :vartype remote_application_type: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.RemoteApplicationType + :ivar access_level: Access level allowed for this remote application type. Possible values + include: "None", "ReadOnly", "ReadWrite", "FullAccess". + :vartype access_level: str or ~azure.mgmt.databoxedge.v2021_02_01.models.AccessLevel + :ivar expiration_time_stamp_in_utc: Expiration time stamp. + :vartype expiration_time_stamp_in_utc: ~datetime.datetime + """ + + _attribute_map = { + 'remote_application_type': {'key': 'remoteApplicationType', 'type': 'str'}, + 'access_level': {'key': 'accessLevel', 'type': 'str'}, + 'expiration_time_stamp_in_utc': {'key': 'expirationTimeStampInUTC', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + remote_application_type: Optional[Union[str, "RemoteApplicationType"]] = None, + access_level: Optional[Union[str, "AccessLevel"]] = None, + expiration_time_stamp_in_utc: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword remote_application_type: Remote application type. Possible values include: + "Powershell", "WAC", "LocalUI", "AllApplications". + :paramtype remote_application_type: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.RemoteApplicationType + :keyword access_level: Access level allowed for this remote application type. Possible values + include: "None", "ReadOnly", "ReadWrite", "FullAccess". + :paramtype access_level: str or ~azure.mgmt.databoxedge.v2021_02_01.models.AccessLevel + :keyword expiration_time_stamp_in_utc: Expiration time stamp. + :paramtype expiration_time_stamp_in_utc: ~datetime.datetime + """ + super(RemoteSupportSettings, self).__init__(**kwargs) + self.remote_application_type = remote_application_type + self.access_level = access_level + self.expiration_time_stamp_in_utc = expiration_time_stamp_in_utc class ResourceIdentity(msrest.serialization.Model): @@ -3762,8 +4760,8 @@ class ResourceIdentity(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param type: Identity type. Possible values include: "None", "SystemAssigned", "UserAssigned". - :type type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.MsiIdentityType + :ivar type: Identity type. Possible values include: "None", "SystemAssigned", "UserAssigned". + :vartype type: str or ~azure.mgmt.databoxedge.v2021_02_01.models.MsiIdentityType :ivar principal_id: Service Principal Id backing the Msi. :vartype principal_id: str :ivar tenant_id: Home Tenant Id. @@ -3783,10 +4781,17 @@ class ResourceIdentity(msrest.serialization.Model): def __init__( self, + *, + type: Optional[Union[str, "MsiIdentityType"]] = None, **kwargs ): + """ + :keyword type: Identity type. Possible values include: "None", "SystemAssigned", + "UserAssigned". + :paramtype type: str or ~azure.mgmt.databoxedge.v2021_02_01.models.MsiIdentityType + """ super(ResourceIdentity, self).__init__(**kwargs) - self.type = kwargs.get('type', None) + self.type = type self.principal_id = None self.tenant_id = None @@ -3794,13 +4799,13 @@ def __init__( class ResourceMoveDetails(msrest.serialization.Model): """Fields for tracking resource move. - :param operation_in_progress: Denotes whether move operation is in progress. Possible values + :ivar operation_in_progress: Denotes whether move operation is in progress. Possible values include: "None", "ResourceMoveInProgress", "ResourceMoveFailed". - :type operation_in_progress: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ResourceMoveStatus - :param operation_in_progress_lock_timeout_in_utc: Denotes the timeout of the operation to + :vartype operation_in_progress: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.ResourceMoveStatus + :ivar operation_in_progress_lock_timeout_in_utc: Denotes the timeout of the operation to finish. - :type operation_in_progress_lock_timeout_in_utc: ~datetime.datetime + :vartype operation_in_progress_lock_timeout_in_utc: ~datetime.datetime """ _attribute_map = { @@ -3810,11 +4815,23 @@ class ResourceMoveDetails(msrest.serialization.Model): def __init__( self, + *, + operation_in_progress: Optional[Union[str, "ResourceMoveStatus"]] = None, + operation_in_progress_lock_timeout_in_utc: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword operation_in_progress: Denotes whether move operation is in progress. Possible values + include: "None", "ResourceMoveInProgress", "ResourceMoveFailed". + :paramtype operation_in_progress: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.ResourceMoveStatus + :keyword operation_in_progress_lock_timeout_in_utc: Denotes the timeout of the operation to + finish. + :paramtype operation_in_progress_lock_timeout_in_utc: ~datetime.datetime + """ super(ResourceMoveDetails, self).__init__(**kwargs) - self.operation_in_progress = kwargs.get('operation_in_progress', None) - self.operation_in_progress_lock_timeout_in_utc = kwargs.get('operation_in_progress_lock_timeout_in_utc', None) + self.operation_in_progress = operation_in_progress + self.operation_in_progress_lock_timeout_in_utc = operation_in_progress_lock_timeout_in_utc class ResourceTypeSku(msrest.serialization.Model): @@ -3825,7 +4842,7 @@ class ResourceTypeSku(msrest.serialization.Model): :ivar resource_type: The resource type. :vartype resource_type: str :ivar skus: The skus. - :vartype skus: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.SkuInformation] + :vartype skus: list[~azure.mgmt.databoxedge.v2021_02_01.models.SkuInformation] """ _validation = { @@ -3842,6 +4859,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceTypeSku, self).__init__(**kwargs) self.resource_type = None self.skus = None @@ -3853,7 +4872,7 @@ class RoleList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: The Value. - :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Role] + :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01.models.Role] :ivar next_link: Link to the next set of results. :vartype next_link: str """ @@ -3872,6 +4891,8 @@ def __init__( self, **kwargs ): + """ + """ super(RoleList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3882,8 +4903,8 @@ class RoleSinkInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param role_id: Required. Compute role ID. - :type role_id: str + :ivar role_id: Required. Compute role ID. + :vartype role_id: str """ _validation = { @@ -3896,21 +4917,26 @@ class RoleSinkInfo(msrest.serialization.Model): def __init__( self, + *, + role_id: str, **kwargs ): + """ + :keyword role_id: Required. Compute role ID. + :paramtype role_id: str + """ super(RoleSinkInfo, self).__init__(**kwargs) - self.role_id = kwargs['role_id'] + self.role_id = role_id class Secret(msrest.serialization.Model): """Holds device secret either as a KeyVault reference or as an encrypted value. - :param encrypted_secret: Encrypted (using device public key) secret value. - :type encrypted_secret: - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AsymmetricEncryptedSecret - :param key_vault_id: Id of the Key-Vault where secret is stored (ex: + :ivar encrypted_secret: Encrypted (using device public key) secret value. + :vartype encrypted_secret: ~azure.mgmt.databoxedge.v2021_02_01.models.AsymmetricEncryptedSecret + :ivar key_vault_id: Id of the Key-Vault where secret is stored (ex: secrets/AuthClientSecret/82ef4346187a4033a10d629cde07d740). - :type key_vault_id: str + :vartype key_vault_id: str """ _attribute_map = { @@ -3920,11 +4946,22 @@ class Secret(msrest.serialization.Model): def __init__( self, + *, + encrypted_secret: Optional["AsymmetricEncryptedSecret"] = None, + key_vault_id: Optional[str] = None, **kwargs ): + """ + :keyword encrypted_secret: Encrypted (using device public key) secret value. + :paramtype encrypted_secret: + ~azure.mgmt.databoxedge.v2021_02_01.models.AsymmetricEncryptedSecret + :keyword key_vault_id: Id of the Key-Vault where secret is stored (ex: + secrets/AuthClientSecret/82ef4346187a4033a10d629cde07d740). + :paramtype key_vault_id: str + """ super(Secret, self).__init__(**kwargs) - self.encrypted_secret = kwargs.get('encrypted_secret', None) - self.key_vault_id = kwargs.get('key_vault_id', None) + self.encrypted_secret = encrypted_secret + self.key_vault_id = key_vault_id class SecuritySettings(ARMBaseModel): @@ -3940,12 +4977,12 @@ class SecuritySettings(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param device_admin_password: Required. Device administrator password as an encrypted string + :ivar device_admin_password: Required. Device administrator password as an encrypted string (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual password should have at least 8 characters that are a combination of uppercase, lowercase, numeric, and special characters. - :type device_admin_password: - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AsymmetricEncryptedSecret + :vartype device_admin_password: + ~azure.mgmt.databoxedge.v2021_02_01.models.AsymmetricEncryptedSecret """ _validation = { @@ -3964,18 +5001,28 @@ class SecuritySettings(ARMBaseModel): def __init__( self, + *, + device_admin_password: "AsymmetricEncryptedSecret", **kwargs ): + """ + :keyword device_admin_password: Required. Device administrator password as an encrypted string + (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual + password should have at least 8 characters that are a combination of uppercase, lowercase, + numeric, and special characters. + :paramtype device_admin_password: + ~azure.mgmt.databoxedge.v2021_02_01.models.AsymmetricEncryptedSecret + """ super(SecuritySettings, self).__init__(**kwargs) - self.device_admin_password = kwargs['device_admin_password'] + self.device_admin_password = device_admin_password class ServiceSpecification(msrest.serialization.Model): """Service specification. - :param metric_specifications: Metric specification as defined by shoebox. - :type metric_specifications: - list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricSpecificationV1] + :ivar metric_specifications: Metric specification as defined by shoebox. + :vartype metric_specifications: + list[~azure.mgmt.databoxedge.v2021_02_01.models.MetricSpecificationV1] """ _attribute_map = { @@ -3984,10 +5031,17 @@ class ServiceSpecification(msrest.serialization.Model): def __init__( self, + *, + metric_specifications: Optional[List["MetricSpecificationV1"]] = None, **kwargs ): + """ + :keyword metric_specifications: Metric specification as defined by shoebox. + :paramtype metric_specifications: + list[~azure.mgmt.databoxedge.v2021_02_01.models.MetricSpecificationV1] + """ super(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) + self.metric_specifications = metric_specifications class Share(ARMBaseModel): @@ -4004,37 +5058,33 @@ class Share(ARMBaseModel): :ivar type: The hierarchical type of the object. :vartype type: str :ivar system_data: Share on ASE device. - :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param description: Description for the share. - :type description: str - :param share_status: Required. Current status of the share. Possible values include: "Offline", + :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01.models.SystemData + :ivar description: Description for the share. + :vartype description: str + :ivar share_status: Required. Current status of the share. Possible values include: "Offline", "Unknown", "OK", "Updating", "NeedsAttention". - :type share_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ShareStatus - :param monitoring_status: Required. Current monitoring status of the share. Possible values + :vartype share_status: str or ~azure.mgmt.databoxedge.v2021_02_01.models.ShareStatus + :ivar monitoring_status: Required. Current monitoring status of the share. Possible values include: "Enabled", "Disabled". - :type monitoring_status: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.MonitoringStatus - :param azure_container_info: Azure container mapping for the share. - :type azure_container_info: - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AzureContainerInfo - :param access_protocol: Required. Access protocol to be used by the share. Possible values + :vartype monitoring_status: str or ~azure.mgmt.databoxedge.v2021_02_01.models.MonitoringStatus + :ivar azure_container_info: Azure container mapping for the share. + :vartype azure_container_info: ~azure.mgmt.databoxedge.v2021_02_01.models.AzureContainerInfo + :ivar access_protocol: Required. Access protocol to be used by the share. Possible values include: "SMB", "NFS". - :type access_protocol: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ShareAccessProtocol - :param user_access_rights: Mapping of users and corresponding access rights on the share + :vartype access_protocol: str or ~azure.mgmt.databoxedge.v2021_02_01.models.ShareAccessProtocol + :ivar user_access_rights: Mapping of users and corresponding access rights on the share (required for SMB protocol). - :type user_access_rights: - list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.UserAccessRight] - :param client_access_rights: List of IP addresses and corresponding access rights on the + :vartype user_access_rights: list[~azure.mgmt.databoxedge.v2021_02_01.models.UserAccessRight] + :ivar client_access_rights: List of IP addresses and corresponding access rights on the share(required for NFS protocol). - :type client_access_rights: - list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.ClientAccessRight] - :param refresh_details: Details of the refresh job on this share. - :type refresh_details: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RefreshDetails + :vartype client_access_rights: + list[~azure.mgmt.databoxedge.v2021_02_01.models.ClientAccessRight] + :ivar refresh_details: Details of the refresh job on this share. + :vartype refresh_details: ~azure.mgmt.databoxedge.v2021_02_01.models.RefreshDetails :ivar share_mappings: Share mount point to the role. - :vartype share_mappings: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MountPointMap] - :param data_policy: Data policy of the share. Possible values include: "Cloud", "Local". - :type data_policy: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataPolicy + :vartype share_mappings: list[~azure.mgmt.databoxedge.v2021_02_01.models.MountPointMap] + :ivar data_policy: Data policy of the share. Possible values include: "Cloud", "Local". + :vartype data_policy: str or ~azure.mgmt.databoxedge.v2021_02_01.models.DataPolicy """ _validation = { @@ -4067,20 +5117,58 @@ class Share(ARMBaseModel): def __init__( self, + *, + share_status: Union[str, "ShareStatus"], + monitoring_status: Union[str, "MonitoringStatus"], + access_protocol: Union[str, "ShareAccessProtocol"], + description: Optional[str] = None, + azure_container_info: Optional["AzureContainerInfo"] = None, + user_access_rights: Optional[List["UserAccessRight"]] = None, + client_access_rights: Optional[List["ClientAccessRight"]] = None, + refresh_details: Optional["RefreshDetails"] = None, + data_policy: Optional[Union[str, "DataPolicy"]] = None, **kwargs ): + """ + :keyword description: Description for the share. + :paramtype description: str + :keyword share_status: Required. Current status of the share. Possible values include: + "Offline", "Unknown", "OK", "Updating", "NeedsAttention". + :paramtype share_status: str or ~azure.mgmt.databoxedge.v2021_02_01.models.ShareStatus + :keyword monitoring_status: Required. Current monitoring status of the share. Possible values + include: "Enabled", "Disabled". + :paramtype monitoring_status: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.MonitoringStatus + :keyword azure_container_info: Azure container mapping for the share. + :paramtype azure_container_info: ~azure.mgmt.databoxedge.v2021_02_01.models.AzureContainerInfo + :keyword access_protocol: Required. Access protocol to be used by the share. Possible values + include: "SMB", "NFS". + :paramtype access_protocol: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.ShareAccessProtocol + :keyword user_access_rights: Mapping of users and corresponding access rights on the share + (required for SMB protocol). + :paramtype user_access_rights: list[~azure.mgmt.databoxedge.v2021_02_01.models.UserAccessRight] + :keyword client_access_rights: List of IP addresses and corresponding access rights on the + share(required for NFS protocol). + :paramtype client_access_rights: + list[~azure.mgmt.databoxedge.v2021_02_01.models.ClientAccessRight] + :keyword refresh_details: Details of the refresh job on this share. + :paramtype refresh_details: ~azure.mgmt.databoxedge.v2021_02_01.models.RefreshDetails + :keyword data_policy: Data policy of the share. Possible values include: "Cloud", "Local". + :paramtype data_policy: str or ~azure.mgmt.databoxedge.v2021_02_01.models.DataPolicy + """ super(Share, self).__init__(**kwargs) self.system_data = None - self.description = kwargs.get('description', None) - self.share_status = kwargs['share_status'] - self.monitoring_status = kwargs['monitoring_status'] - self.azure_container_info = kwargs.get('azure_container_info', None) - self.access_protocol = kwargs['access_protocol'] - self.user_access_rights = kwargs.get('user_access_rights', None) - self.client_access_rights = kwargs.get('client_access_rights', None) - self.refresh_details = kwargs.get('refresh_details', None) + self.description = description + self.share_status = share_status + self.monitoring_status = monitoring_status + self.azure_container_info = azure_container_info + self.access_protocol = access_protocol + self.user_access_rights = user_access_rights + self.client_access_rights = client_access_rights + self.refresh_details = refresh_details self.share_mappings = None - self.data_policy = kwargs.get('data_policy', None) + self.data_policy = data_policy class ShareAccessRight(msrest.serialization.Model): @@ -4088,11 +5176,11 @@ class ShareAccessRight(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param share_id: Required. The share ID. - :type share_id: str - :param access_type: Required. Type of access to be allowed on the share for this user. Possible + :ivar share_id: Required. The share ID. + :vartype share_id: str + :ivar access_type: Required. Type of access to be allowed on the share for this user. Possible values include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ShareAccessType + :vartype access_type: str or ~azure.mgmt.databoxedge.v2021_02_01.models.ShareAccessType """ _validation = { @@ -4107,11 +5195,21 @@ class ShareAccessRight(msrest.serialization.Model): def __init__( self, + *, + share_id: str, + access_type: Union[str, "ShareAccessType"], **kwargs ): + """ + :keyword share_id: Required. The share ID. + :paramtype share_id: str + :keyword access_type: Required. Type of access to be allowed on the share for this user. + Possible values include: "Change", "Read", "Custom". + :paramtype access_type: str or ~azure.mgmt.databoxedge.v2021_02_01.models.ShareAccessType + """ super(ShareAccessRight, self).__init__(**kwargs) - self.share_id = kwargs['share_id'] - self.access_type = kwargs['access_type'] + self.share_id = share_id + self.access_type = access_type class ShareList(msrest.serialization.Model): @@ -4120,7 +5218,7 @@ class ShareList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: The list of shares. - :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Share] + :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01.models.Share] :ivar next_link: Link to the next set of results. :vartype next_link: str """ @@ -4139,6 +5237,8 @@ def __init__( self, **kwargs ): + """ + """ super(ShareList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4147,14 +5247,14 @@ def __init__( class Sku(msrest.serialization.Model): """The SKU type. - :param name: SKU name. Possible values include: "Gateway", "Edge", "TEA_1Node", - "TEA_1Node_UPS", "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", - "TEA_4Node_UPS_Heater", "TMA", "TDC", "TCA_Small", "GPU", "TCA_Large", "EdgeP_Base", - "EdgeP_High", "EdgePR_Base", "EdgePR_Base_UPS", "EP2_64_1VPU_W", "EP2_128_1T4_Mx1_W", - "EP2_256_2T4_W", "EdgeMR_Mini", "RCA_Small", "RCA_Large", "RDC", "Management". - :type name: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SkuName - :param tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard". - :type tier: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SkuTier + :ivar name: SKU name. Possible values include: "Gateway", "Edge", "TEA_1Node", "TEA_1Node_UPS", + "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", "TEA_4Node_UPS_Heater", "TMA", + "TDC", "TCA_Small", "GPU", "TCA_Large", "EdgeP_Base", "EdgeP_High", "EdgePR_Base", + "EdgePR_Base_UPS", "EP2_64_1VPU_W", "EP2_128_1T4_Mx1_W", "EP2_256_2T4_W", "EdgeMR_Mini", + "RCA_Small", "RCA_Large", "RDC", "Management". + :vartype name: str or ~azure.mgmt.databoxedge.v2021_02_01.models.SkuName + :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard". + :vartype tier: str or ~azure.mgmt.databoxedge.v2021_02_01.models.SkuTier """ _attribute_map = { @@ -4164,11 +5264,57 @@ class Sku(msrest.serialization.Model): def __init__( self, + *, + name: Optional[Union[str, "SkuName"]] = None, + tier: Optional[Union[str, "SkuTier"]] = None, **kwargs ): + """ + :keyword name: SKU name. Possible values include: "Gateway", "Edge", "TEA_1Node", + "TEA_1Node_UPS", "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", + "TEA_4Node_UPS_Heater", "TMA", "TDC", "TCA_Small", "GPU", "TCA_Large", "EdgeP_Base", + "EdgeP_High", "EdgePR_Base", "EdgePR_Base_UPS", "EP2_64_1VPU_W", "EP2_128_1T4_Mx1_W", + "EP2_256_2T4_W", "EdgeMR_Mini", "RCA_Small", "RCA_Large", "RDC", "Management". + :paramtype name: str or ~azure.mgmt.databoxedge.v2021_02_01.models.SkuName + :keyword tier: The SKU tier. This is based on the SKU name. Possible values include: + "Standard". + :paramtype tier: str or ~azure.mgmt.databoxedge.v2021_02_01.models.SkuTier + """ super(Sku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = kwargs.get('tier', None) + self.name = name + self.tier = tier + + +class SkuCapability(msrest.serialization.Model): + """The metadata to describe the capability. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: An invariant to describe the feature. + :vartype name: str + :ivar value: An invariant if the feature is measured by quantity. + :vartype value: str + """ + + _validation = { + 'name': {'readonly': True}, + 'value': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(SkuCapability, self).__init__(**kwargs) + self.name = None + self.value = None class SkuCost(msrest.serialization.Model): @@ -4200,6 +5346,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuCost, self).__init__(**kwargs) self.meter_id = None self.quantity = None @@ -4220,12 +5368,11 @@ class SkuInformation(msrest.serialization.Model): :ivar family: The Sku family. :vartype family: str :ivar costs: The pricing info of the Sku. - :vartype costs: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.SkuCost] + :vartype costs: list[~azure.mgmt.databoxedge.v2021_02_01.models.SkuCost] :ivar locations: The locations where Sku is available. :vartype locations: list[str] :ivar location_info: The locations where Sku is available with zones and sites info. - :vartype location_info: - list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.SkuLocationInfo] + :vartype location_info: list[~azure.mgmt.databoxedge.v2021_02_01.models.SkuLocationInfo] :ivar required_quota_ids: The required quotaIds for the sku to be available. :vartype required_quota_ids: list[str] :ivar required_features: The required features for the sku to be available. @@ -4260,6 +5407,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuInformation, self).__init__(**kwargs) self.name = None self.tier = None @@ -4278,7 +5427,7 @@ class SkuInformationList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: List of ResourceTypeSku objects. - :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.ResourceTypeSku] + :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01.models.ResourceTypeSku] :ivar next_link: Links to the next set of results. :vartype next_link: str """ @@ -4297,6 +5446,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuInformationList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4331,6 +5482,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuLocationInfo, self).__init__(**kwargs) self.location = None self.zones = None @@ -4351,18 +5504,18 @@ class StorageAccount(ARMBaseModel): :ivar type: The hierarchical type of the object. :vartype type: str :ivar system_data: StorageAccount object on ASE device. - :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param description: Description for the storage Account. - :type description: str - :param storage_account_status: Current status of the storage account. Possible values include: + :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01.models.SystemData + :ivar description: Description for the storage Account. + :vartype description: str + :ivar storage_account_status: Current status of the storage account. Possible values include: "OK", "Offline", "Unknown", "Updating", "NeedsAttention". - :type storage_account_status: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.StorageAccountStatus - :param data_policy: Required. Data policy of the storage Account. Possible values include: + :vartype storage_account_status: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.StorageAccountStatus + :ivar data_policy: Required. Data policy of the storage Account. Possible values include: "Cloud", "Local". - :type data_policy: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataPolicy - :param storage_account_credential_id: Storage Account Credential Id. - :type storage_account_credential_id: str + :vartype data_policy: str or ~azure.mgmt.databoxedge.v2021_02_01.models.DataPolicy + :ivar storage_account_credential_id: Storage Account Credential Id. + :vartype storage_account_credential_id: str :ivar blob_endpoint: BlobEndpoint of Storage Account. :vartype blob_endpoint: str :ivar container_count: The Container Count. Present only for Storage Accounts with DataPolicy @@ -4395,14 +5548,32 @@ class StorageAccount(ARMBaseModel): def __init__( self, + *, + data_policy: Union[str, "DataPolicy"], + description: Optional[str] = None, + storage_account_status: Optional[Union[str, "StorageAccountStatus"]] = None, + storage_account_credential_id: Optional[str] = None, **kwargs ): + """ + :keyword description: Description for the storage Account. + :paramtype description: str + :keyword storage_account_status: Current status of the storage account. Possible values + include: "OK", "Offline", "Unknown", "Updating", "NeedsAttention". + :paramtype storage_account_status: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.StorageAccountStatus + :keyword data_policy: Required. Data policy of the storage Account. Possible values include: + "Cloud", "Local". + :paramtype data_policy: str or ~azure.mgmt.databoxedge.v2021_02_01.models.DataPolicy + :keyword storage_account_credential_id: Storage Account Credential Id. + :paramtype storage_account_credential_id: str + """ super(StorageAccount, self).__init__(**kwargs) self.system_data = None - self.description = kwargs.get('description', None) - self.storage_account_status = kwargs.get('storage_account_status', None) - self.data_policy = kwargs['data_policy'] - self.storage_account_credential_id = kwargs.get('storage_account_credential_id', None) + self.description = description + self.storage_account_status = storage_account_status + self.data_policy = data_policy + self.storage_account_credential_id = storage_account_credential_id self.blob_endpoint = None self.container_count = None @@ -4421,26 +5592,26 @@ class StorageAccountCredential(ARMBaseModel): :ivar type: The hierarchical type of the object. :vartype type: str :ivar system_data: StorageAccountCredential object. - :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param alias: Required. Alias for the storage account. - :type alias: str - :param user_name: Username for the storage account. - :type user_name: str - :param account_key: Encrypted storage key. - :type account_key: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AsymmetricEncryptedSecret - :param connection_string: Connection string for the storage account. Use this string if - username and account key are not specified. - :type connection_string: str - :param ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible values + :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01.models.SystemData + :ivar alias: Required. Alias for the storage account. + :vartype alias: str + :ivar user_name: Username for the storage account. + :vartype user_name: str + :ivar account_key: Encrypted storage key. + :vartype account_key: ~azure.mgmt.databoxedge.v2021_02_01.models.AsymmetricEncryptedSecret + :ivar connection_string: Connection string for the storage account. Use this string if username + and account key are not specified. + :vartype connection_string: str + :ivar ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible values include: "Enabled", "Disabled". - :type ssl_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SSLStatus - :param blob_domain_name: Blob end point for private clouds. - :type blob_domain_name: str - :param account_type: Required. Type of storage accessed on the storage account. Possible values + :vartype ssl_status: str or ~azure.mgmt.databoxedge.v2021_02_01.models.SSLStatus + :ivar blob_domain_name: Blob end point for private clouds. + :vartype blob_domain_name: str + :ivar account_type: Required. Type of storage accessed on the storage account. Possible values include: "GeneralPurposeStorage", "BlobStorage". - :type account_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AccountType - :param storage_account_id: Id of the storage account. - :type storage_account_id: str + :vartype account_type: str or ~azure.mgmt.databoxedge.v2021_02_01.models.AccountType + :ivar storage_account_id: Id of the storage account. + :vartype storage_account_id: str """ _validation = { @@ -4470,18 +5641,48 @@ class StorageAccountCredential(ARMBaseModel): def __init__( self, + *, + alias: str, + ssl_status: Union[str, "SSLStatus"], + account_type: Union[str, "AccountType"], + user_name: Optional[str] = None, + account_key: Optional["AsymmetricEncryptedSecret"] = None, + connection_string: Optional[str] = None, + blob_domain_name: Optional[str] = None, + storage_account_id: Optional[str] = None, **kwargs ): + """ + :keyword alias: Required. Alias for the storage account. + :paramtype alias: str + :keyword user_name: Username for the storage account. + :paramtype user_name: str + :keyword account_key: Encrypted storage key. + :paramtype account_key: ~azure.mgmt.databoxedge.v2021_02_01.models.AsymmetricEncryptedSecret + :keyword connection_string: Connection string for the storage account. Use this string if + username and account key are not specified. + :paramtype connection_string: str + :keyword ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible + values include: "Enabled", "Disabled". + :paramtype ssl_status: str or ~azure.mgmt.databoxedge.v2021_02_01.models.SSLStatus + :keyword blob_domain_name: Blob end point for private clouds. + :paramtype blob_domain_name: str + :keyword account_type: Required. Type of storage accessed on the storage account. Possible + values include: "GeneralPurposeStorage", "BlobStorage". + :paramtype account_type: str or ~azure.mgmt.databoxedge.v2021_02_01.models.AccountType + :keyword storage_account_id: Id of the storage account. + :paramtype storage_account_id: str + """ super(StorageAccountCredential, self).__init__(**kwargs) self.system_data = None - self.alias = kwargs['alias'] - self.user_name = kwargs.get('user_name', None) - self.account_key = kwargs.get('account_key', None) - self.connection_string = kwargs.get('connection_string', None) - self.ssl_status = kwargs['ssl_status'] - self.blob_domain_name = kwargs.get('blob_domain_name', None) - self.account_type = kwargs['account_type'] - self.storage_account_id = kwargs.get('storage_account_id', None) + self.alias = alias + self.user_name = user_name + self.account_key = account_key + self.connection_string = connection_string + self.ssl_status = ssl_status + self.blob_domain_name = blob_domain_name + self.account_type = account_type + self.storage_account_id = storage_account_id class StorageAccountCredentialList(msrest.serialization.Model): @@ -4490,8 +5691,7 @@ class StorageAccountCredentialList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: The value. - :vartype value: - list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.StorageAccountCredential] + :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01.models.StorageAccountCredential] :ivar next_link: Link to the next set of results. :vartype next_link: str """ @@ -4510,6 +5710,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountCredentialList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4521,7 +5723,7 @@ class StorageAccountList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: The list of storageAccounts. - :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.StorageAccount] + :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01.models.StorageAccount] :ivar next_link: Link to the next set of results. :vartype next_link: str """ @@ -4540,6 +5742,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4548,10 +5752,10 @@ def __init__( class SubscriptionRegisteredFeatures(msrest.serialization.Model): """SubscriptionRegisteredFeatures. - :param name: - :type name: str - :param state: - :type state: str + :ivar name: + :vartype name: str + :ivar state: + :vartype state: str """ _attribute_map = { @@ -4561,19 +5765,28 @@ class SubscriptionRegisteredFeatures(msrest.serialization.Model): def __init__( self, + *, + name: Optional[str] = None, + state: Optional[str] = None, **kwargs ): + """ + :keyword name: + :paramtype name: str + :keyword state: + :paramtype state: str + """ super(SubscriptionRegisteredFeatures, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.state = kwargs.get('state', None) + self.name = name + self.state = state class SymmetricKey(msrest.serialization.Model): """Symmetric key for authentication. - :param connection_string: Connection string based on the symmetric key. - :type connection_string: - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AsymmetricEncryptedSecret + :ivar connection_string: Connection string based on the symmetric key. + :vartype connection_string: + ~azure.mgmt.databoxedge.v2021_02_01.models.AsymmetricEncryptedSecret """ _attribute_map = { @@ -4582,30 +5795,36 @@ class SymmetricKey(msrest.serialization.Model): def __init__( self, + *, + connection_string: Optional["AsymmetricEncryptedSecret"] = None, **kwargs ): + """ + :keyword connection_string: Connection string based on the symmetric key. + :paramtype connection_string: + ~azure.mgmt.databoxedge.v2021_02_01.models.AsymmetricEncryptedSecret + """ super(SymmetricKey, self).__init__(**kwargs) - self.connection_string = kwargs.get('connection_string', None) + self.connection_string = connection_string class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.databoxedge.v2021_02_01.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.CreatedByType - :param last_modified_at: The type of identity that last modified the resource. - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~azure.mgmt.databoxedge.v2021_02_01.models.CreatedByType + :ivar last_modified_at: The type of identity that last modified the resource. + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -4619,28 +5838,52 @@ class SystemData(msrest.serialization.Model): def __init__( self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.databoxedge.v2021_02_01.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.CreatedByType + :keyword last_modified_at: The type of identity that last modified the resource. + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at class TrackingInfo(msrest.serialization.Model): """Tracking courier information. - :param serial_number: Serial number of the device being tracked. - :type serial_number: str - :param carrier_name: Name of the carrier used in the delivery. - :type carrier_name: str - :param tracking_id: Tracking ID of the shipment. - :type tracking_id: str - :param tracking_url: Tracking URL of the shipment. - :type tracking_url: str + :ivar serial_number: Serial number of the device being tracked. + :vartype serial_number: str + :ivar carrier_name: Name of the carrier used in the delivery. + :vartype carrier_name: str + :ivar tracking_id: Tracking ID of the shipment. + :vartype tracking_id: str + :ivar tracking_url: Tracking URL of the shipment. + :vartype tracking_url: str """ _attribute_map = { @@ -4652,13 +5895,28 @@ class TrackingInfo(msrest.serialization.Model): def __init__( self, + *, + serial_number: Optional[str] = None, + carrier_name: Optional[str] = None, + tracking_id: Optional[str] = None, + tracking_url: Optional[str] = None, **kwargs ): + """ + :keyword serial_number: Serial number of the device being tracked. + :paramtype serial_number: str + :keyword carrier_name: Name of the carrier used in the delivery. + :paramtype carrier_name: str + :keyword tracking_id: Tracking ID of the shipment. + :paramtype tracking_id: str + :keyword tracking_url: Tracking URL of the shipment. + :paramtype tracking_url: str + """ super(TrackingInfo, self).__init__(**kwargs) - self.serial_number = kwargs.get('serial_number', None) - self.carrier_name = kwargs.get('carrier_name', None) - self.tracking_id = kwargs.get('tracking_id', None) - self.tracking_url = kwargs.get('tracking_url', None) + self.serial_number = serial_number + self.carrier_name = carrier_name + self.tracking_id = tracking_id + self.tracking_url = tracking_url class TriggerList(msrest.serialization.Model): @@ -4667,7 +5925,7 @@ class TriggerList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: The list of triggers. - :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Trigger] + :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01.models.Trigger] :ivar next_link: Link to the next set of results. :vartype next_link: str """ @@ -4686,32 +5944,100 @@ def __init__( self, **kwargs ): + """ + """ super(TriggerList, self).__init__(**kwargs) self.value = None self.next_link = None +class TriggerSupportPackageRequest(ARMBaseModel): + """The request object for trigger support package. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The path ID that uniquely identifies the object. + :vartype id: str + :ivar name: The object name. + :vartype name: str + :ivar type: The hierarchical type of the object. + :vartype type: str + :ivar minimum_time_stamp: MinimumTimeStamp from where logs need to be collected. + :vartype minimum_time_stamp: ~datetime.datetime + :ivar maximum_time_stamp: MaximumTimeStamp until where logs need to be collected. + :vartype maximum_time_stamp: ~datetime.datetime + :ivar include: Type of files, which need to be included in the logs + This will contain the type of logs (Default/DefaultWithDumps/None/All/DefaultWithArchived) + or a comma separated list of log types that are required. + :vartype include: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'minimum_time_stamp': {'key': 'properties.minimumTimeStamp', 'type': 'iso-8601'}, + 'maximum_time_stamp': {'key': 'properties.maximumTimeStamp', 'type': 'iso-8601'}, + 'include': {'key': 'properties.include', 'type': 'str'}, + } + + def __init__( + self, + *, + minimum_time_stamp: Optional[datetime.datetime] = None, + maximum_time_stamp: Optional[datetime.datetime] = None, + include: Optional[str] = None, + **kwargs + ): + """ + :keyword minimum_time_stamp: MinimumTimeStamp from where logs need to be collected. + :paramtype minimum_time_stamp: ~datetime.datetime + :keyword maximum_time_stamp: MaximumTimeStamp until where logs need to be collected. + :paramtype maximum_time_stamp: ~datetime.datetime + :keyword include: Type of files, which need to be included in the logs + This will contain the type of logs (Default/DefaultWithDumps/None/All/DefaultWithArchived) + or a comma separated list of log types that are required. + :paramtype include: str + """ + super(TriggerSupportPackageRequest, self).__init__(**kwargs) + self.minimum_time_stamp = minimum_time_stamp + self.maximum_time_stamp = maximum_time_stamp + self.include = include + + class UpdateDetails(msrest.serialization.Model): """Update Specific attributes. - :param update_title: Title of the Update. - :type update_title: str - :param update_size: Size of the update(In Bytes). - :type update_size: float - :param update_type: Type of the Update. Possible values include: "Software", "Kubernetes", + :ivar update_title: Title of the Update. + :vartype update_title: str + :ivar update_size: Size of the update(In Bytes). + :vartype update_size: float + :ivar update_type: Type of the Update. Possible values include: "Software", "Kubernetes", "Firmware". - :type update_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.UpdateType - :param target_version: Target Version number. - :type target_version: str - :param estimated_install_time_in_mins: Estimated Install Time for the update. - :type estimated_install_time_in_mins: int - :param reboot_behavior: Indicates if updates are available and at least one of the updates - needs a reboot. Possible values include: "NeverReboots", "RequiresReboot", "RequestReboot". - :type reboot_behavior: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.InstallRebootBehavior - :param status: Status of the update. Possible values include: "DownloadPending", + :vartype update_type: str or ~azure.mgmt.databoxedge.v2021_02_01.models.UpdateType + :ivar target_version: Target Version number. + :vartype target_version: str + :ivar friendly_version_number: Friendly Version Number. + :vartype friendly_version_number: str + :ivar estimated_install_time_in_mins: Estimated Install Time for the update. + :vartype estimated_install_time_in_mins: int + :ivar reboot_behavior: Indicates if updates are available and at least one of the updates needs + a reboot. Possible values include: "NeverReboots", "RequiresReboot", "RequestReboot". + :vartype reboot_behavior: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.InstallRebootBehavior + :ivar installation_impact: Impact of Installing an updateType. Possible values include: "None", + "DeviceRebooted", "KubernetesWorkloadsDown". + :vartype installation_impact: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.InstallationImpact + :ivar status: Status of the update. Possible values include: "DownloadPending", "DownloadStarted", "DownloadCompleted", "InstallStarted", "InstallCompleted". - :type status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.UpdateStatus + :vartype status: str or ~azure.mgmt.databoxedge.v2021_02_01.models.UpdateStatus """ _attribute_map = { @@ -4719,23 +6045,63 @@ class UpdateDetails(msrest.serialization.Model): 'update_size': {'key': 'updateSize', 'type': 'float'}, 'update_type': {'key': 'updateType', 'type': 'str'}, 'target_version': {'key': 'targetVersion', 'type': 'str'}, + 'friendly_version_number': {'key': 'friendlyVersionNumber', 'type': 'str'}, 'estimated_install_time_in_mins': {'key': 'estimatedInstallTimeInMins', 'type': 'int'}, 'reboot_behavior': {'key': 'rebootBehavior', 'type': 'str'}, + 'installation_impact': {'key': 'installationImpact', 'type': 'str'}, 'status': {'key': 'status', 'type': 'str'}, } def __init__( self, + *, + update_title: Optional[str] = None, + update_size: Optional[float] = None, + update_type: Optional[Union[str, "UpdateType"]] = None, + target_version: Optional[str] = None, + friendly_version_number: Optional[str] = None, + estimated_install_time_in_mins: Optional[int] = None, + reboot_behavior: Optional[Union[str, "InstallRebootBehavior"]] = None, + installation_impact: Optional[Union[str, "InstallationImpact"]] = None, + status: Optional[Union[str, "UpdateStatus"]] = None, **kwargs ): + """ + :keyword update_title: Title of the Update. + :paramtype update_title: str + :keyword update_size: Size of the update(In Bytes). + :paramtype update_size: float + :keyword update_type: Type of the Update. Possible values include: "Software", "Kubernetes", + "Firmware". + :paramtype update_type: str or ~azure.mgmt.databoxedge.v2021_02_01.models.UpdateType + :keyword target_version: Target Version number. + :paramtype target_version: str + :keyword friendly_version_number: Friendly Version Number. + :paramtype friendly_version_number: str + :keyword estimated_install_time_in_mins: Estimated Install Time for the update. + :paramtype estimated_install_time_in_mins: int + :keyword reboot_behavior: Indicates if updates are available and at least one of the updates + needs a reboot. Possible values include: "NeverReboots", "RequiresReboot", "RequestReboot". + :paramtype reboot_behavior: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.InstallRebootBehavior + :keyword installation_impact: Impact of Installing an updateType. Possible values include: + "None", "DeviceRebooted", "KubernetesWorkloadsDown". + :paramtype installation_impact: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.InstallationImpact + :keyword status: Status of the update. Possible values include: "DownloadPending", + "DownloadStarted", "DownloadCompleted", "InstallStarted", "InstallCompleted". + :paramtype status: str or ~azure.mgmt.databoxedge.v2021_02_01.models.UpdateStatus + """ super(UpdateDetails, self).__init__(**kwargs) - self.update_title = kwargs.get('update_title', None) - self.update_size = kwargs.get('update_size', None) - self.update_type = kwargs.get('update_type', None) - self.target_version = kwargs.get('target_version', None) - self.estimated_install_time_in_mins = kwargs.get('estimated_install_time_in_mins', None) - self.reboot_behavior = kwargs.get('reboot_behavior', None) - self.status = kwargs.get('status', None) + self.update_title = update_title + self.update_size = update_size + self.update_type = update_type + self.target_version = target_version + self.friendly_version_number = friendly_version_number + self.estimated_install_time_in_mins = estimated_install_time_in_mins + self.reboot_behavior = reboot_behavior + self.installation_impact = installation_impact + self.status = status class UpdateDownloadProgress(msrest.serialization.Model): @@ -4745,8 +6111,7 @@ class UpdateDownloadProgress(msrest.serialization.Model): :ivar download_phase: The download phase. Possible values include: "Unknown", "Initializing", "Downloading", "Verifying". - :vartype download_phase: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.DownloadPhase + :vartype download_phase: str or ~azure.mgmt.databoxedge.v2021_02_01.models.DownloadPhase :ivar percent_complete: Percentage of completion. :vartype percent_complete: int :ivar total_bytes_to_download: Total bytes to download. @@ -4781,6 +6146,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateDownloadProgress, self).__init__(**kwargs) self.download_phase = None self.percent_complete = None @@ -4819,6 +6186,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateInstallProgress, self).__init__(**kwargs) self.percent_complete = None self.number_of_updates_to_install = None @@ -4837,16 +6206,18 @@ class UpdateSummary(ARMBaseModel): :ivar type: The hierarchical type of the object. :vartype type: str :ivar system_data: UpdateSummary Result. - :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param device_version_number: The current version of the device in format: 1.2.17312.13.",. - :type device_version_number: str - :param friendly_device_version_name: The current version of the device in text format. - :type friendly_device_version_name: str - :param device_last_scanned_date_time: The last time when a scan was done on the device. - :type device_last_scanned_date_time: ~datetime.datetime - :param last_completed_scan_job_date_time: The time when the last scan job was completed + :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01.models.SystemData + :ivar device_version_number: The current version of the device in format: 1.2.17312.13.",. + :vartype device_version_number: str + :ivar friendly_device_version_name: The current version of the device in text format. + :vartype friendly_device_version_name: str + :ivar device_last_scanned_date_time: The last time when a scan was done on the device. + :vartype device_last_scanned_date_time: ~datetime.datetime + :ivar last_completed_scan_job_date_time: The time when the last scan job was completed (success/cancelled/failed) on the appliance. - :type last_completed_scan_job_date_time: ~datetime.datetime + :vartype last_completed_scan_job_date_time: ~datetime.datetime + :ivar last_successful_scan_job_time: Time when the last scan job is successfully completed. + :vartype last_successful_scan_job_time: ~datetime.datetime :ivar last_completed_download_job_date_time: The time when the last Download job was completed (success/cancelled/failed) on the appliance. :vartype last_completed_download_job_date_time: ~datetime.datetime @@ -4855,8 +6226,10 @@ class UpdateSummary(ARMBaseModel): :vartype last_completed_download_job_id: str :ivar last_download_job_status: JobStatus of the last ran download job. Possible values include: "Invalid", "Running", "Succeeded", "Failed", "Canceled", "Paused", "Scheduled". - :vartype last_download_job_status: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.JobStatus + :vartype last_download_job_status: str or ~azure.mgmt.databoxedge.v2021_02_01.models.JobStatus + :ivar last_successful_install_job_date_time: The time when the Last Install job was completed + successfully on the appliance. + :vartype last_successful_install_job_date_time: ~datetime.datetime :ivar last_completed_install_job_date_time: The time when the last Install job was completed (success/cancelled/failed) on the appliance. :vartype last_completed_install_job_date_time: ~datetime.datetime @@ -4865,8 +6238,7 @@ class UpdateSummary(ARMBaseModel): :vartype last_completed_install_job_id: str :ivar last_install_job_status: JobStatus of the last ran install job. Possible values include: "Invalid", "Running", "Succeeded", "Failed", "Canceled", "Paused", "Scheduled". - :vartype last_install_job_status: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.JobStatus + :vartype last_install_job_status: str or ~azure.mgmt.databoxedge.v2021_02_01.models.JobStatus :ivar total_number_of_updates_available: The number of updates available for the current device version as per the last device scan. :vartype total_number_of_updates_available: int @@ -4877,11 +6249,11 @@ class UpdateSummary(ARMBaseModel): :ivar reboot_behavior: Indicates if updates are available and at least one of the updates needs a reboot. Possible values include: "NeverReboots", "RequiresReboot", "RequestReboot". :vartype reboot_behavior: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.InstallRebootBehavior + ~azure.mgmt.databoxedge.v2021_02_01.models.InstallRebootBehavior :ivar ongoing_update_operation: The current update operation. Possible values include: "None", "Scan", "Download", "Install". :vartype ongoing_update_operation: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.UpdateOperation + ~azure.mgmt.databoxedge.v2021_02_01.models.UpdateOperation :ivar in_progress_download_job_id: The job ID of the download job in progress. :vartype in_progress_download_job_id: str :ivar in_progress_install_job_id: The job ID of the install job in progress. @@ -4895,7 +6267,7 @@ class UpdateSummary(ARMBaseModel): :ivar update_titles: The list of updates available for install. :vartype update_titles: list[str] :ivar updates: The list of updates available for install. - :vartype updates: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.UpdateDetails] + :vartype updates: list[~azure.mgmt.databoxedge.v2021_02_01.models.UpdateDetails] :ivar total_update_size_in_bytes: The total size of updates available for download in bytes. :vartype total_update_size_in_bytes: float :ivar total_time_in_minutes: The total time in Minutes. @@ -4937,9 +6309,11 @@ class UpdateSummary(ARMBaseModel): 'friendly_device_version_name': {'key': 'properties.friendlyDeviceVersionName', 'type': 'str'}, 'device_last_scanned_date_time': {'key': 'properties.deviceLastScannedDateTime', 'type': 'iso-8601'}, 'last_completed_scan_job_date_time': {'key': 'properties.lastCompletedScanJobDateTime', 'type': 'iso-8601'}, + 'last_successful_scan_job_time': {'key': 'properties.lastSuccessfulScanJobTime', 'type': 'iso-8601'}, 'last_completed_download_job_date_time': {'key': 'properties.lastCompletedDownloadJobDateTime', 'type': 'iso-8601'}, 'last_completed_download_job_id': {'key': 'properties.lastCompletedDownloadJobId', 'type': 'str'}, 'last_download_job_status': {'key': 'properties.lastDownloadJobStatus', 'type': 'str'}, + 'last_successful_install_job_date_time': {'key': 'properties.lastSuccessfulInstallJobDateTime', 'type': 'iso-8601'}, 'last_completed_install_job_date_time': {'key': 'properties.lastCompletedInstallJobDateTime', 'type': 'iso-8601'}, 'last_completed_install_job_id': {'key': 'properties.lastCompletedInstallJobId', 'type': 'str'}, 'last_install_job_status': {'key': 'properties.lastInstallJobStatus', 'type': 'str'}, @@ -4960,17 +6334,42 @@ class UpdateSummary(ARMBaseModel): def __init__( self, + *, + device_version_number: Optional[str] = None, + friendly_device_version_name: Optional[str] = None, + device_last_scanned_date_time: Optional[datetime.datetime] = None, + last_completed_scan_job_date_time: Optional[datetime.datetime] = None, + last_successful_scan_job_time: Optional[datetime.datetime] = None, + last_successful_install_job_date_time: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword device_version_number: The current version of the device in format: 1.2.17312.13.",. + :paramtype device_version_number: str + :keyword friendly_device_version_name: The current version of the device in text format. + :paramtype friendly_device_version_name: str + :keyword device_last_scanned_date_time: The last time when a scan was done on the device. + :paramtype device_last_scanned_date_time: ~datetime.datetime + :keyword last_completed_scan_job_date_time: The time when the last scan job was completed + (success/cancelled/failed) on the appliance. + :paramtype last_completed_scan_job_date_time: ~datetime.datetime + :keyword last_successful_scan_job_time: Time when the last scan job is successfully completed. + :paramtype last_successful_scan_job_time: ~datetime.datetime + :keyword last_successful_install_job_date_time: The time when the Last Install job was + completed successfully on the appliance. + :paramtype last_successful_install_job_date_time: ~datetime.datetime + """ super(UpdateSummary, self).__init__(**kwargs) self.system_data = None - self.device_version_number = kwargs.get('device_version_number', None) - self.friendly_device_version_name = kwargs.get('friendly_device_version_name', None) - self.device_last_scanned_date_time = kwargs.get('device_last_scanned_date_time', None) - self.last_completed_scan_job_date_time = kwargs.get('last_completed_scan_job_date_time', None) + self.device_version_number = device_version_number + self.friendly_device_version_name = friendly_device_version_name + self.device_last_scanned_date_time = device_last_scanned_date_time + self.last_completed_scan_job_date_time = last_completed_scan_job_date_time + self.last_successful_scan_job_time = last_successful_scan_job_time self.last_completed_download_job_date_time = None self.last_completed_download_job_id = None self.last_download_job_status = None + self.last_successful_install_job_date_time = last_successful_install_job_date_time self.last_completed_install_job_date_time = None self.last_completed_install_job_id = None self.last_install_job_status = None @@ -4994,12 +6393,12 @@ class UploadCertificateRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param authentication_type: The authentication type. Possible values include: "Invalid", + :ivar authentication_type: The authentication type. Possible values include: "Invalid", "AzureActiveDirectory". - :type authentication_type: str or - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AuthenticationType - :param certificate: Required. The base64 encoded certificate raw data. - :type certificate: str + :vartype authentication_type: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.AuthenticationType + :ivar certificate: Required. The base64 encoded certificate raw data. + :vartype certificate: str """ _validation = { @@ -5013,11 +6412,22 @@ class UploadCertificateRequest(msrest.serialization.Model): def __init__( self, + *, + certificate: str, + authentication_type: Optional[Union[str, "AuthenticationType"]] = None, **kwargs ): + """ + :keyword authentication_type: The authentication type. Possible values include: "Invalid", + "AzureActiveDirectory". + :paramtype authentication_type: str or + ~azure.mgmt.databoxedge.v2021_02_01.models.AuthenticationType + :keyword certificate: Required. The base64 encoded certificate raw data. + :paramtype certificate: str + """ super(UploadCertificateRequest, self).__init__(**kwargs) - self.authentication_type = kwargs.get('authentication_type', None) - self.certificate = kwargs['certificate'] + self.authentication_type = authentication_type + self.certificate = certificate class UploadCertificateResponse(msrest.serialization.Model): @@ -5025,9 +6435,9 @@ class UploadCertificateResponse(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param auth_type: Specifies authentication type. Possible values include: "Invalid", + :ivar auth_type: Specifies authentication type. Possible values include: "Invalid", "AzureActiveDirectory". - :type auth_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AuthenticationType + :vartype auth_type: str or ~azure.mgmt.databoxedge.v2021_02_01.models.AuthenticationType :ivar resource_id: The resource ID of the Data Box Edge/Gateway device. :vartype resource_id: str :ivar aad_authority: Azure Active Directory tenant authority. @@ -5068,10 +6478,17 @@ class UploadCertificateResponse(msrest.serialization.Model): def __init__( self, + *, + auth_type: Optional[Union[str, "AuthenticationType"]] = None, **kwargs ): + """ + :keyword auth_type: Specifies authentication type. Possible values include: "Invalid", + "AzureActiveDirectory". + :paramtype auth_type: str or ~azure.mgmt.databoxedge.v2021_02_01.models.AuthenticationType + """ super(UploadCertificateResponse, self).__init__(**kwargs) - self.auth_type = kwargs.get('auth_type', None) + self.auth_type = auth_type self.resource_id = None self.aad_authority = None self.aad_tenant_id = None @@ -5086,6 +6503,8 @@ class User(ARMBaseModel): 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 path ID that uniquely identifies the object. :vartype id: str :ivar name: The object name. @@ -5093,16 +6512,16 @@ class User(ARMBaseModel): :ivar type: The hierarchical type of the object. :vartype type: str :ivar system_data: User in DataBoxEdge Resource. - :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param encrypted_password: The password details. - :type encrypted_password: - ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AsymmetricEncryptedSecret + :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01.models.SystemData + :ivar encrypted_password: The password details. + :vartype encrypted_password: + ~azure.mgmt.databoxedge.v2021_02_01.models.AsymmetricEncryptedSecret :ivar share_access_rights: List of shares that the user has rights on. This field should not be specified during user creation. - :vartype share_access_rights: - list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.ShareAccessRight] - :param user_type: Type of the user. Possible values include: "Share", "LocalManagement", "ARM". - :type user_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.UserType + :vartype share_access_rights: list[~azure.mgmt.databoxedge.v2021_02_01.models.ShareAccessRight] + :ivar user_type: Required. Type of the user. Possible values include: "Share", + "LocalManagement", "ARM". + :vartype user_type: str or ~azure.mgmt.databoxedge.v2021_02_01.models.UserType """ _validation = { @@ -5111,6 +6530,7 @@ class User(ARMBaseModel): 'type': {'readonly': True}, 'system_data': {'readonly': True}, 'share_access_rights': {'readonly': True}, + 'user_type': {'required': True}, } _attribute_map = { @@ -5125,13 +6545,24 @@ class User(ARMBaseModel): def __init__( self, + *, + user_type: Union[str, "UserType"], + encrypted_password: Optional["AsymmetricEncryptedSecret"] = None, **kwargs ): + """ + :keyword encrypted_password: The password details. + :paramtype encrypted_password: + ~azure.mgmt.databoxedge.v2021_02_01.models.AsymmetricEncryptedSecret + :keyword user_type: Required. Type of the user. Possible values include: "Share", + "LocalManagement", "ARM". + :paramtype user_type: str or ~azure.mgmt.databoxedge.v2021_02_01.models.UserType + """ super(User, self).__init__(**kwargs) self.system_data = None - self.encrypted_password = kwargs.get('encrypted_password', None) + self.encrypted_password = encrypted_password self.share_access_rights = None - self.user_type = kwargs.get('user_type', None) + self.user_type = user_type class UserAccessRight(msrest.serialization.Model): @@ -5139,11 +6570,11 @@ class UserAccessRight(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param user_id: Required. User ID (already existing in the device). - :type user_id: str - :param access_type: Required. Type of access to be allowed for the user. Possible values + :ivar user_id: Required. User ID (already existing in the device). + :vartype user_id: str + :ivar access_type: Required. Type of access to be allowed for the user. Possible values include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ShareAccessType + :vartype access_type: str or ~azure.mgmt.databoxedge.v2021_02_01.models.ShareAccessType """ _validation = { @@ -5158,11 +6589,21 @@ class UserAccessRight(msrest.serialization.Model): def __init__( self, + *, + user_id: str, + access_type: Union[str, "ShareAccessType"], **kwargs ): + """ + :keyword user_id: Required. User ID (already existing in the device). + :paramtype user_id: str + :keyword access_type: Required. Type of access to be allowed for the user. Possible values + include: "Change", "Read", "Custom". + :paramtype access_type: str or ~azure.mgmt.databoxedge.v2021_02_01.models.ShareAccessType + """ super(UserAccessRight, self).__init__(**kwargs) - self.user_id = kwargs['user_id'] - self.access_type = kwargs['access_type'] + self.user_id = user_id + self.access_type = access_type class UserList(msrest.serialization.Model): @@ -5171,7 +6612,7 @@ class UserList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: The list of users. - :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.User] + :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01.models.User] :ivar next_link: Link to the next set of results. :vartype next_link: str """ @@ -5190,6 +6631,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserList, self).__init__(**kwargs) self.value = None self.next_link = None diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/__init__.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/__init__.py new file mode 100644 index 000000000000..fc7347b19d14 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/__init__.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._available_skus_operations import AvailableSkusOperations +from ._devices_operations import DevicesOperations +from ._alerts_operations import AlertsOperations +from ._bandwidth_schedules_operations import BandwidthSchedulesOperations +from ._diagnostic_settings_operations import DiagnosticSettingsOperations +from ._jobs_operations import JobsOperations +from ._nodes_operations import NodesOperations +from ._operations_status_operations import OperationsStatusOperations +from ._orders_operations import OrdersOperations +from ._roles_operations import RolesOperations +from ._addons_operations import AddonsOperations +from ._monitoring_config_operations import MonitoringConfigOperations +from ._shares_operations import SharesOperations +from ._storage_account_credentials_operations import StorageAccountCredentialsOperations +from ._storage_accounts_operations import StorageAccountsOperations +from ._containers_operations import ContainersOperations +from ._triggers_operations import TriggersOperations +from ._support_packages_operations import SupportPackagesOperations +from ._users_operations import UsersOperations + +__all__ = [ + 'Operations', + 'AvailableSkusOperations', + 'DevicesOperations', + 'AlertsOperations', + 'BandwidthSchedulesOperations', + 'DiagnosticSettingsOperations', + 'JobsOperations', + 'NodesOperations', + 'OperationsStatusOperations', + 'OrdersOperations', + 'RolesOperations', + 'AddonsOperations', + 'MonitoringConfigOperations', + 'SharesOperations', + 'StorageAccountCredentialsOperations', + 'StorageAccountsOperations', + 'ContainersOperations', + 'TriggersOperations', + 'SupportPackagesOperations', + 'UsersOperations', +] diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_addons_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_addons_operations.py new file mode 100644 index 000000000000..a4031ef47dc0 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_addons_operations.py @@ -0,0 +1,588 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_role_request( + device_name: str, + role_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + role_name: str, + addon_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "addonName": _SERIALIZER.url("addon_name", addon_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + role_name: str, + addon_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "addonName": _SERIALIZER.url("addon_name", addon_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + role_name: str, + addon_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "addonName": _SERIALIZER.url("addon_name", addon_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class AddonsOperations(object): + """AddonsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_role( + self, + device_name: str, + role_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.AddonList"]: + """Lists all the addons configured in the role. + + :param device_name: The device name. + :type device_name: str + :param role_name: The role name. + :type role_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AddonList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.AddonList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AddonList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_role_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_role.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_role_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AddonList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_role.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons'} # type: ignore + + @distributed_trace + def get( + self, + device_name: str, + role_name: str, + addon_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Addon": + """Gets a specific addon by name. + + :param device_name: The device name. + :type device_name: str + :param role_name: The role name. + :type role_name: str + :param addon_name: The addon name. + :type addon_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Addon, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.Addon + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Addon"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Addon', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + + + def _create_or_update_initial( + self, + device_name: str, + role_name: str, + addon_name: str, + resource_group_name: str, + addon: "_models.Addon", + **kwargs: Any + ) -> Optional["_models.Addon"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Addon"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(addon, 'Addon') + + request = build_create_or_update_request_initial( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Addon', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + device_name: str, + role_name: str, + addon_name: str, + resource_group_name: str, + addon: "_models.Addon", + **kwargs: Any + ) -> LROPoller["_models.Addon"]: + """Create or update a addon. + + :param device_name: The device name. + :type device_name: str + :param role_name: The role name. + :type role_name: str + :param addon_name: The addon name. + :type addon_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param addon: The addon properties. + :type addon: ~azure.mgmt.databoxedge.v2021_02_01.models.Addon + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Addon or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2021_02_01.models.Addon] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Addon"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + resource_group_name=resource_group_name, + addon=addon, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Addon', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + + def _delete_initial( + self, + device_name: str, + role_name: str, + addon_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + device_name: str, + role_name: str, + addon_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the addon on the device. + + :param device_name: The device name. + :type device_name: str + :param role_name: The role name. + :type role_name: str + :param addon_name: The addon name. + :type addon_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_alerts_operations.py new file mode 100644 index 000000000000..d58c3c1e53cd --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_alerts_operations.py @@ -0,0 +1,250 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class AlertsOperations(object): + """AlertsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_data_box_edge_device( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.AlertList"]: + """Gets all the alerts for a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AlertList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.AlertList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AlertList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts'} # type: ignore + + @distributed_trace + def get( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Alert": + """Gets an alert by name. + + Gets an alert by name. + + :param device_name: The device name. + :type device_name: str + :param name: The alert name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Alert, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.Alert + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Alert"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Alert', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_available_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_available_skus_operations.py new file mode 100644 index 000000000000..87a0e8b5aad1 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_available_skus_operations.py @@ -0,0 +1,145 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/availableSkus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class AvailableSkusOperations(object): + """AvailableSkusOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable["_models.DataBoxEdgeSkuList"]: + """List all the available Skus and information related to them. + + List all the available Skus and information related to them. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataBoxEdgeSkuList or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.DataBoxEdgeSkuList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeSkuList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DataBoxEdgeSkuList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/availableSkus'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_bandwidth_schedules_operations.py new file mode 100644 index 000000000000..3b5d2a8bffc7 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_bandwidth_schedules_operations.py @@ -0,0 +1,563 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class BandwidthSchedulesOperations(object): + """BandwidthSchedulesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_data_box_edge_device( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.BandwidthSchedulesList"]: + """Gets all the bandwidth schedules for a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BandwidthSchedulesList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.BandwidthSchedulesList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedulesList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BandwidthSchedulesList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules'} # type: ignore + + @distributed_trace + def get( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.BandwidthSchedule": + """Gets the properties of the specified bandwidth schedule. + + :param device_name: The device name. + :type device_name: str + :param name: The bandwidth schedule name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BandwidthSchedule, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.BandwidthSchedule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BandwidthSchedule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + + def _create_or_update_initial( + self, + device_name: str, + name: str, + resource_group_name: str, + parameters: "_models.BandwidthSchedule", + **kwargs: Any + ) -> Optional["_models.BandwidthSchedule"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BandwidthSchedule"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BandwidthSchedule') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('BandwidthSchedule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + device_name: str, + name: str, + resource_group_name: str, + parameters: "_models.BandwidthSchedule", + **kwargs: Any + ) -> LROPoller["_models.BandwidthSchedule"]: + """Creates or updates a bandwidth schedule. + + :param device_name: The device name. + :type device_name: str + :param name: The bandwidth schedule name which needs to be added/updated. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param parameters: The bandwidth schedule to be added or updated. + :type parameters: ~azure.mgmt.databoxedge.v2021_02_01.models.BandwidthSchedule + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BandwidthSchedule or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2021_02_01.models.BandwidthSchedule] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedule"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + device_name=device_name, + name=name, + resource_group_name=resource_group_name, + parameters=parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('BandwidthSchedule', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + def _delete_initial( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified bandwidth schedule. + + :param device_name: The device name. + :type device_name: str + :param name: The bandwidth schedule name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + device_name=device_name, + name=name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_containers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_containers_operations.py new file mode 100644 index 000000000000..f94b699f454a --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_containers_operations.py @@ -0,0 +1,743 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_storage_account_request( + device_name: str, + storage_account_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + storage_account_name: str, + container_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + storage_account_name: str, + container_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + storage_account_name: str, + container_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_refresh_request_initial( + device_name: str, + storage_account_name: str, + container_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class ContainersOperations(object): + """ContainersOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_storage_account( + self, + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ContainerList"]: + """Lists all the containers of a storage Account in a Data Box Edge/Data Box Gateway device. + + Lists all the containers of a storage Account in a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param storage_account_name: The storage Account name. + :type storage_account_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ContainerList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.ContainerList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_storage_account_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_storage_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_storage_account_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ContainerList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_storage_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers'} # type: ignore + + @distributed_trace + def get( + self, + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Container": + """Gets a container by name. + + Gets a container by name. + + :param device_name: The device name. + :type device_name: str + :param storage_account_name: The Storage Account Name. + :type storage_account_name: str + :param container_name: The container Name. + :type container_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Container, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.Container + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Container"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Container', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + + def _create_or_update_initial( + self, + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + container: "_models.Container", + **kwargs: Any + ) -> Optional["_models.Container"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Container"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(container, 'Container') + + request = build_create_or_update_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Container', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + container: "_models.Container", + **kwargs: Any + ) -> LROPoller["_models.Container"]: + """Creates a new container or updates an existing container on the device. + + Creates a new container or updates an existing container on the device. + + :param device_name: The device name. + :type device_name: str + :param storage_account_name: The Storage Account Name. + :type storage_account_name: str + :param container_name: The container name. + :type container_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param container: The container properties. + :type container: ~azure.mgmt.databoxedge.v2021_02_01.models.Container + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Container or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2021_02_01.models.Container] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Container"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + resource_group_name=resource_group_name, + container=container, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Container', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + def _delete_initial( + self, + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the container on the Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param storage_account_name: The Storage Account Name. + :type storage_account_name: str + :param container_name: The container name. + :type container_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + def _refresh_initial( + self, + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_refresh_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh'} # type: ignore + + + @distributed_trace + def begin_refresh( + self, + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Refreshes the container metadata with the data from the cloud. + + Refreshes the container metadata with the data from the cloud. + + :param device_name: The device name. + :type device_name: str + :param storage_account_name: The Storage Account Name. + :type storage_account_name: str + :param container_name: The container name. + :type container_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._refresh_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_devices_operations.py new file mode 100644 index 000000000000..a49ee9a4286a --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_devices_operations.py @@ -0,0 +1,1798 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_subscription_request( + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_download_updates_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_generate_certificate_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/generateCertificate') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_extended_information_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_install_updates_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_network_settings_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/networkSettings/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_scan_for_updates_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_security_settings_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_extended_information_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateExtendedInformation') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_update_summary_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_upload_certificate_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/uploadCertificate') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + +class DevicesOperations(object): + """DevicesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_subscription( + self, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.DataBoxEdgeDeviceList"]: + """Gets all the Data Box Edge/Data Box Gateway devices in a subscription. + + :param expand: Specify $expand=details to populate additional fields related to the resource or + Specify $skipToken=:code:`` to populate the next page in the list. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.DataBoxEdgeDeviceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.DataBoxEdgeDeviceList"]: + """Gets all the Data Box Edge/Data Box Gateway devices in a resource group. + + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param expand: Specify $expand=details to populate additional fields related to the resource or + Specify $skipToken=:code:`` to populate the next page in the list. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.DataBoxEdgeDeviceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + + @distributed_trace + def get( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DataBoxEdgeDevice": + """Gets the properties of the Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataBoxEdgeDevice, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.DataBoxEdgeDevice + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataBoxEdgeDevice', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + + @distributed_trace + def create_or_update( + self, + device_name: str, + resource_group_name: str, + data_box_edge_device: "_models.DataBoxEdgeDevice", + **kwargs: Any + ) -> "_models.DataBoxEdgeDevice": + """Creates or updates a Data Box Edge/Data Box Gateway resource. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param data_box_edge_device: The resource object. + :type data_box_edge_device: ~azure.mgmt.databoxedge.v2021_02_01.models.DataBoxEdgeDevice + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataBoxEdgeDevice, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.DataBoxEdgeDevice + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') + + request = build_create_or_update_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataBoxEdgeDevice', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + + def _delete_initial( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + device_name=device_name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace + def update( + self, + device_name: str, + resource_group_name: str, + parameters: "_models.DataBoxEdgeDevicePatch", + **kwargs: Any + ) -> "_models.DataBoxEdgeDevice": + """Modifies a Data Box Edge/Data Box Gateway resource. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param parameters: The resource parameters. + :type parameters: ~azure.mgmt.databoxedge.v2021_02_01.models.DataBoxEdgeDevicePatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataBoxEdgeDevice, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.DataBoxEdgeDevice + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') + + request = build_update_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataBoxEdgeDevice', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + + def _download_updates_initial( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_download_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._download_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _download_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + + + @distributed_trace + def begin_download_updates( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Downloads the updates on a Data Box Edge/Data Box Gateway device. + + Downloads the updates on a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._download_updates_initial( + device_name=device_name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_download_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + + @distributed_trace + def generate_certificate( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.GenerateCertResponse": + """Generates certificate for activation key. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GenerateCertResponse, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.GenerateCertResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenerateCertResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_generate_certificate_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.generate_certificate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GenerateCertResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + generate_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/generateCertificate'} # type: ignore + + + @distributed_trace + def get_extended_information( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DataBoxEdgeDeviceExtendedInfo": + """Gets additional information for the specified Azure Stack Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataBoxEdgeDeviceExtendedInfo, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.DataBoxEdgeDeviceExtendedInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceExtendedInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_extended_information_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_extended_information.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataBoxEdgeDeviceExtendedInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_extended_information.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation'} # type: ignore + + + def _install_updates_initial( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_install_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._install_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _install_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + + + @distributed_trace + def begin_install_updates( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Installs the updates on the Data Box Edge/Data Box Gateway device. + + Installs the updates on the Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._install_updates_initial( + device_name=device_name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_install_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + + @distributed_trace + def get_network_settings( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.NetworkSettings": + """Gets the network settings of the specified Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkSettings, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.NetworkSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkSettings"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_network_settings_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_network_settings.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_network_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/networkSettings/default'} # type: ignore + + + def _scan_for_updates_initial( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_scan_for_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._scan_for_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _scan_for_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore + + + @distributed_trace + def begin_scan_for_updates( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Scans for updates on a Data Box Edge/Data Box Gateway device. + + Scans for updates on a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._scan_for_updates_initial( + device_name=device_name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_scan_for_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore + + def _create_or_update_security_settings_initial( + self, + device_name: str, + resource_group_name: str, + security_settings: "_models.SecuritySettings", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(security_settings, 'SecuritySettings') + + request = build_create_or_update_security_settings_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_security_settings_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _create_or_update_security_settings_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + + + @distributed_trace + def begin_create_or_update_security_settings( + self, + device_name: str, + resource_group_name: str, + security_settings: "_models.SecuritySettings", + **kwargs: Any + ) -> LROPoller[None]: + """Updates the security settings on a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param security_settings: The security settings. + :type security_settings: ~azure.mgmt.databoxedge.v2021_02_01.models.SecuritySettings + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_security_settings_initial( + device_name=device_name, + resource_group_name=resource_group_name, + security_settings=security_settings, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update_security_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + + @distributed_trace + def update_extended_information( + self, + device_name: str, + resource_group_name: str, + parameters: "_models.DataBoxEdgeDeviceExtendedInfoPatch", + **kwargs: Any + ) -> "_models.DataBoxEdgeDeviceExtendedInfo": + """Gets additional information for the specified Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param parameters: The patch object. + :type parameters: ~azure.mgmt.databoxedge.v2021_02_01.models.DataBoxEdgeDeviceExtendedInfoPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataBoxEdgeDeviceExtendedInfo, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.DataBoxEdgeDeviceExtendedInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceExtendedInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DataBoxEdgeDeviceExtendedInfoPatch') + + request = build_update_extended_information_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.update_extended_information.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataBoxEdgeDeviceExtendedInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_extended_information.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateExtendedInformation'} # type: ignore + + + @distributed_trace + def get_update_summary( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.UpdateSummary": + """Gets information about the availability of updates based on the last scan of the device. It + also gets information about any ongoing download or install jobs on the device. + + Gets information about the availability of updates based on the last scan of the device. It + also gets information about any ongoing download or install jobs on the device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UpdateSummary, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.UpdateSummary + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UpdateSummary"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_update_summary_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_update_summary.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('UpdateSummary', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_update_summary.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default'} # type: ignore + + + @distributed_trace + def upload_certificate( + self, + device_name: str, + resource_group_name: str, + parameters: "_models.UploadCertificateRequest", + **kwargs: Any + ) -> "_models.UploadCertificateResponse": + """Uploads registration certificate for the device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param parameters: The upload certificate request. + :type parameters: ~azure.mgmt.databoxedge.v2021_02_01.models.UploadCertificateRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UploadCertificateResponse, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.UploadCertificateResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UploadCertificateResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'UploadCertificateRequest') + + request = build_upload_certificate_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.upload_certificate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('UploadCertificateResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + upload_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/uploadCertificate'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_diagnostic_settings_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_diagnostic_settings_operations.py new file mode 100644 index 000000000000..a2bfbe330700 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_diagnostic_settings_operations.py @@ -0,0 +1,530 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_diagnostic_proactive_log_collection_settings_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/diagnosticProactiveLogCollectionSettings/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_diagnostic_proactive_log_collection_settings_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/diagnosticProactiveLogCollectionSettings/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_diagnostic_remote_support_settings_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/diagnosticRemoteSupportSettings/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_diagnostic_remote_support_settings_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/diagnosticRemoteSupportSettings/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + +class DiagnosticSettingsOperations(object): + """DiagnosticSettingsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get_diagnostic_proactive_log_collection_settings( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DiagnosticProactiveLogCollectionSettings": + """Gets the proactive log collection settings of the specified Data Box Edge/Data Box Gateway + device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticProactiveLogCollectionSettings, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.DiagnosticProactiveLogCollectionSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticProactiveLogCollectionSettings"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_diagnostic_proactive_log_collection_settings_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_diagnostic_proactive_log_collection_settings.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticProactiveLogCollectionSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_diagnostic_proactive_log_collection_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/diagnosticProactiveLogCollectionSettings/default'} # type: ignore + + + def _update_diagnostic_proactive_log_collection_settings_initial( + self, + device_name: str, + resource_group_name: str, + proactive_log_collection_settings: "_models.DiagnosticProactiveLogCollectionSettings", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(proactive_log_collection_settings, 'DiagnosticProactiveLogCollectionSettings') + + request = build_update_diagnostic_proactive_log_collection_settings_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._update_diagnostic_proactive_log_collection_settings_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _update_diagnostic_proactive_log_collection_settings_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/diagnosticProactiveLogCollectionSettings/default'} # type: ignore + + + @distributed_trace + def begin_update_diagnostic_proactive_log_collection_settings( + self, + device_name: str, + resource_group_name: str, + proactive_log_collection_settings: "_models.DiagnosticProactiveLogCollectionSettings", + **kwargs: Any + ) -> LROPoller[None]: + """Updates the proactive log collection settings on a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param proactive_log_collection_settings: The proactive log collection settings. + :type proactive_log_collection_settings: + ~azure.mgmt.databoxedge.v2021_02_01.models.DiagnosticProactiveLogCollectionSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_diagnostic_proactive_log_collection_settings_initial( + device_name=device_name, + resource_group_name=resource_group_name, + proactive_log_collection_settings=proactive_log_collection_settings, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_diagnostic_proactive_log_collection_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/diagnosticProactiveLogCollectionSettings/default'} # type: ignore + + @distributed_trace + def get_diagnostic_remote_support_settings( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DiagnosticRemoteSupportSettings": + """Gets the diagnostic remote support settings of the specified Data Box Edge/Data Box Gateway + device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticRemoteSupportSettings, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.DiagnosticRemoteSupportSettings + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticRemoteSupportSettings"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_diagnostic_remote_support_settings_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_diagnostic_remote_support_settings.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticRemoteSupportSettings', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_diagnostic_remote_support_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/diagnosticRemoteSupportSettings/default'} # type: ignore + + + def _update_diagnostic_remote_support_settings_initial( + self, + device_name: str, + resource_group_name: str, + diagnostic_remote_support_settings: "_models.DiagnosticRemoteSupportSettings", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_remote_support_settings, 'DiagnosticRemoteSupportSettings') + + request = build_update_diagnostic_remote_support_settings_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._update_diagnostic_remote_support_settings_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _update_diagnostic_remote_support_settings_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/diagnosticRemoteSupportSettings/default'} # type: ignore + + + @distributed_trace + def begin_update_diagnostic_remote_support_settings( + self, + device_name: str, + resource_group_name: str, + diagnostic_remote_support_settings: "_models.DiagnosticRemoteSupportSettings", + **kwargs: Any + ) -> LROPoller[None]: + """Updates the diagnostic remote support settings on a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param diagnostic_remote_support_settings: The diagnostic remote support settings. + :type diagnostic_remote_support_settings: + ~azure.mgmt.databoxedge.v2021_02_01.models.DiagnosticRemoteSupportSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_diagnostic_remote_support_settings_initial( + device_name=device_name, + resource_group_name=resource_group_name, + diagnostic_remote_support_settings=diagnostic_remote_support_settings, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_diagnostic_remote_support_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/diagnosticRemoteSupportSettings/default'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_jobs_operations.py new file mode 100644 index 000000000000..bd1606069c77 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_jobs_operations.py @@ -0,0 +1,141 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class JobsOperations(object): + """JobsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Job": + """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. + + Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param name: The job name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Job, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.Job + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Job"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Job', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_monitoring_config_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_monitoring_config_operations.py new file mode 100644 index 000000000000..ec0ca911bc9a --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_monitoring_config_operations.py @@ -0,0 +1,579 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + device_name: str, + role_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + role_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + role_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + role_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class MonitoringConfigOperations(object): + """MonitoringConfigOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + device_name: str, + role_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.MonitoringMetricConfigurationList"]: + """Lists metric configurations in a role. + + Lists metric configurations in a role. + + :param device_name: The device name. + :type device_name: str + :param role_name: The role name. + :type role_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MonitoringMetricConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.MonitoringMetricConfigurationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringMetricConfigurationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("MonitoringMetricConfigurationList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig'} # type: ignore + + @distributed_trace + def get( + self, + device_name: str, + role_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.MonitoringMetricConfiguration": + """Gets a metric configuration of a role. + + Gets a metric configuration of a role. + + :param device_name: The device name. + :type device_name: str + :param role_name: The role name. + :type role_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MonitoringMetricConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.MonitoringMetricConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringMetricConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MonitoringMetricConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + + + def _create_or_update_initial( + self, + device_name: str, + role_name: str, + resource_group_name: str, + monitoring_metric_configuration: "_models.MonitoringMetricConfiguration", + **kwargs: Any + ) -> Optional["_models.MonitoringMetricConfiguration"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MonitoringMetricConfiguration"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_metric_configuration, 'MonitoringMetricConfiguration') + + request = build_create_or_update_request_initial( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MonitoringMetricConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + device_name: str, + role_name: str, + resource_group_name: str, + monitoring_metric_configuration: "_models.MonitoringMetricConfiguration", + **kwargs: Any + ) -> LROPoller["_models.MonitoringMetricConfiguration"]: + """Creates a new metric configuration or updates an existing one for a role. + + Creates a new metric configuration or updates an existing one for a role. + + :param device_name: The device name. + :type device_name: str + :param role_name: The role name. + :type role_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param monitoring_metric_configuration: The metric configuration. + :type monitoring_metric_configuration: + ~azure.mgmt.databoxedge.v2021_02_01.models.MonitoringMetricConfiguration + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringMetricConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2021_02_01.models.MonitoringMetricConfiguration] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringMetricConfiguration"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + device_name=device_name, + role_name=role_name, + resource_group_name=resource_group_name, + monitoring_metric_configuration=monitoring_metric_configuration, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('MonitoringMetricConfiguration', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + + def _delete_initial( + self, + device_name: str, + role_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + device_name: str, + role_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """deletes a new metric configuration for a role. + + deletes a new metric configuration for a role. + + :param device_name: The device name. + :type device_name: str + :param role_name: The role name. + :type role_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + device_name=device_name, + role_name=role_name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_nodes_operations.py new file mode 100644 index 000000000000..78fa19655768 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_nodes_operations.py @@ -0,0 +1,156 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/nodes') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class NodesOperations(object): + """NodesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_data_box_edge_device( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.NodeList"]: + """Gets all the nodes currently configured under this Data Box Edge device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NodeList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.NodeList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NodeList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/nodes'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_operations.py new file mode 100644 index 000000000000..51789ca18120 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_operations.py @@ -0,0 +1,136 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.DataBoxEdge/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable["_models.OperationsList"]: + """List all the supported operations. + + List all the supported operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationsList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.OperationsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationsList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.DataBoxEdge/operations'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_operations_status_operations.py new file mode 100644 index 000000000000..d710cd369ee6 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_operations_status_operations.py @@ -0,0 +1,141 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/operationsStatus/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class OperationsStatusOperations(object): + """OperationsStatusOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Job": + """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. + + Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param name: The job name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Job, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.Job + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Job"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Job', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/operationsStatus/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_orders_operations.py new file mode 100644 index 000000000000..5b09115e0925 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_orders_operations.py @@ -0,0 +1,633 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_dc_access_code_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default/listDCAccessCode') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class OrdersOperations(object): + """OrdersOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_data_box_edge_device( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.OrderList"]: + """Lists all the orders related to a Data Box Edge/Data Box Gateway device. + + Lists all the orders related to a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OrderList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.OrderList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OrderList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OrderList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders'} # type: ignore + + @distributed_trace + def get( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Order": + """Gets a specific order by name. + + Gets a specific order by name. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Order, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.Order + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Order"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Order', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + + def _create_or_update_initial( + self, + device_name: str, + resource_group_name: str, + order: "_models.Order", + **kwargs: Any + ) -> Optional["_models.Order"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Order"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(order, 'Order') + + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Order', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + device_name: str, + resource_group_name: str, + order: "_models.Order", + **kwargs: Any + ) -> LROPoller["_models.Order"]: + """Creates or updates an order. + + Creates or updates an order. + + :param device_name: The order details of a device. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param order: The order to be created or updated. + :type order: ~azure.mgmt.databoxedge.v2021_02_01.models.Order + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Order or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2021_02_01.models.Order] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Order"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + device_name=device_name, + resource_group_name=resource_group_name, + order=order, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Order', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + def _delete_initial( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the order related to the device. + + Deletes the order related to the device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + device_name=device_name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace + def list_dc_access_code( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DCAccessCode": + """Gets the DCAccess Code. + + Gets the DCAccess Code. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DCAccessCode, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.DCAccessCode + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DCAccessCode"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_dc_access_code_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_dc_access_code.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DCAccessCode', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_dc_access_code.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default/listDCAccessCode'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_roles_operations.py new file mode 100644 index 000000000000..e52b482847a3 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_roles_operations.py @@ -0,0 +1,559 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class RolesOperations(object): + """RolesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_data_box_edge_device( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.RoleList"]: + """Lists all the roles configured in a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RoleList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.RoleList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("RoleList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles'} # type: ignore + + @distributed_trace + def get( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Role": + """Gets a specific role by name. + + :param device_name: The device name. + :type device_name: str + :param name: The role name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Role, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.Role + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Role"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Role', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + + def _create_or_update_initial( + self, + device_name: str, + name: str, + resource_group_name: str, + role: "_models.Role", + **kwargs: Any + ) -> Optional["_models.Role"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Role"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(role, 'Role') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Role', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + device_name: str, + name: str, + resource_group_name: str, + role: "_models.Role", + **kwargs: Any + ) -> LROPoller["_models.Role"]: + """Create or update a role. + + :param device_name: The device name. + :type device_name: str + :param name: The role name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param role: The role properties. + :type role: ~azure.mgmt.databoxedge.v2021_02_01.models.Role + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Role or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2021_02_01.models.Role] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Role"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + device_name=device_name, + name=name, + resource_group_name=resource_group_name, + role=role, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Role', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + def _delete_initial( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the role on the device. + + :param device_name: The device name. + :type device_name: str + :param name: The role name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + device_name=device_name, + name=name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_shares_operations.py new file mode 100644 index 000000000000..db746c1048bb --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_shares_operations.py @@ -0,0 +1,706 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_refresh_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class SharesOperations(object): + """SharesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_data_box_edge_device( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ShareList"]: + """Lists all the shares in a Data Box Edge/Data Box Gateway device. + + Lists all the shares in a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ShareList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.ShareList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ShareList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ShareList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares'} # type: ignore + + @distributed_trace + def get( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Share": + """Gets a share by name. + + Gets a share by name. + + :param device_name: The device name. + :type device_name: str + :param name: The share name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Share, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.Share + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Share"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Share', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + + def _create_or_update_initial( + self, + device_name: str, + name: str, + resource_group_name: str, + share: "_models.Share", + **kwargs: Any + ) -> Optional["_models.Share"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Share"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(share, 'Share') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Share', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + device_name: str, + name: str, + resource_group_name: str, + share: "_models.Share", + **kwargs: Any + ) -> LROPoller["_models.Share"]: + """Creates a new share or updates an existing share on the device. + + Creates a new share or updates an existing share on the device. + + :param device_name: The device name. + :type device_name: str + :param name: The share name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param share: The share properties. + :type share: ~azure.mgmt.databoxedge.v2021_02_01.models.Share + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Share or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2021_02_01.models.Share] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Share"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + device_name=device_name, + name=name, + resource_group_name=resource_group_name, + share=share, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Share', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + def _delete_initial( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the share on the Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param name: The share name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + device_name=device_name, + name=name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + def _refresh_initial( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_refresh_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore + + + @distributed_trace + def begin_refresh( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Refreshes the share metadata with the data from the cloud. + + Refreshes the share metadata with the data from the cloud. + + :param device_name: The device name. + :type device_name: str + :param name: The share name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._refresh_initial( + device_name=device_name, + name=name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_storage_account_credentials_operations.py new file mode 100644 index 000000000000..72e7bc0d0bc8 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_storage_account_credentials_operations.py @@ -0,0 +1,566 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class StorageAccountCredentialsOperations(object): + """StorageAccountCredentialsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_data_box_edge_device( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountCredentialList"]: + """Gets all the storage account credentials in a Data Box Edge/Data Box Gateway device. + + Gets all the storage account credentials in a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StorageAccountCredentialList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.StorageAccountCredentialList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredentialList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("StorageAccountCredentialList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials'} # type: ignore + + @distributed_trace + def get( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.StorageAccountCredential": + """Gets the properties of the specified storage account credential. + + :param device_name: The device name. + :type device_name: str + :param name: The storage account credential name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageAccountCredential, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.StorageAccountCredential + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredential"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StorageAccountCredential', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + + def _create_or_update_initial( + self, + device_name: str, + name: str, + resource_group_name: str, + storage_account_credential: "_models.StorageAccountCredential", + **kwargs: Any + ) -> Optional["_models.StorageAccountCredential"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccountCredential"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(storage_account_credential, 'StorageAccountCredential') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('StorageAccountCredential', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + device_name: str, + name: str, + resource_group_name: str, + storage_account_credential: "_models.StorageAccountCredential", + **kwargs: Any + ) -> LROPoller["_models.StorageAccountCredential"]: + """Creates or updates the storage account credential. + + :param device_name: The device name. + :type device_name: str + :param name: The storage account credential name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param storage_account_credential: The storage account credential. + :type storage_account_credential: + ~azure.mgmt.databoxedge.v2021_02_01.models.StorageAccountCredential + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either StorageAccountCredential or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2021_02_01.models.StorageAccountCredential] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredential"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + device_name=device_name, + name=name, + resource_group_name=resource_group_name, + storage_account_credential=storage_account_credential, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('StorageAccountCredential', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + def _delete_initial( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the storage account credential. + + :param device_name: The device name. + :type device_name: str + :param name: The storage account credential name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + device_name=device_name, + name=name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_storage_accounts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_storage_accounts_operations.py new file mode 100644 index 000000000000..a25bbf38fe6b --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_storage_accounts_operations.py @@ -0,0 +1,568 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + storage_account_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + storage_account_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + storage_account_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class StorageAccountsOperations(object): + """StorageAccountsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_data_box_edge_device( + self, + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountList"]: + """Lists all the StorageAccounts in a Data Box Edge/Data Box Gateway device. + + Lists all the StorageAccounts in a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StorageAccountList or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.StorageAccountList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("StorageAccountList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts'} # type: ignore + + @distributed_trace + def get( + self, + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.StorageAccount": + """Gets a StorageAccount by name. + + Gets a StorageAccount by name. + + :param device_name: The device name. + :type device_name: str + :param storage_account_name: The storage account name. + :type storage_account_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageAccount, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.StorageAccount + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccount"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StorageAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + + def _create_or_update_initial( + self, + device_name: str, + storage_account_name: str, + resource_group_name: str, + storage_account: "_models.StorageAccount", + **kwargs: Any + ) -> Optional["_models.StorageAccount"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(storage_account, 'StorageAccount') + + request = build_create_or_update_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('StorageAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + device_name: str, + storage_account_name: str, + resource_group_name: str, + storage_account: "_models.StorageAccount", + **kwargs: Any + ) -> LROPoller["_models.StorageAccount"]: + """Creates a new StorageAccount or updates an existing StorageAccount on the device. + + Creates a new StorageAccount or updates an existing StorageAccount on the device. + + :param device_name: The device name. + :type device_name: str + :param storage_account_name: The StorageAccount name. + :type storage_account_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param storage_account: The StorageAccount properties. + :type storage_account: ~azure.mgmt.databoxedge.v2021_02_01.models.StorageAccount + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2021_02_01.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccount"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + device_name=device_name, + storage_account_name=storage_account_name, + resource_group_name=resource_group_name, + storage_account=storage_account, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('StorageAccount', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + def _delete_initial( + self, + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the StorageAccount on the Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param storage_account_name: The StorageAccount name. + :type storage_account_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + device_name=device_name, + storage_account_name=storage_account_name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_support_packages_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_support_packages_operations.py new file mode 100644 index 000000000000..a99b7ddbf601 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_support_packages_operations.py @@ -0,0 +1,205 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_trigger_support_package_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggerSupportPackage') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + +class SupportPackagesOperations(object): + """SupportPackagesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _trigger_support_package_initial( + self, + device_name: str, + resource_group_name: str, + trigger_support_package_request: "_models.TriggerSupportPackageRequest", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(trigger_support_package_request, 'TriggerSupportPackageRequest') + + request = build_trigger_support_package_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._trigger_support_package_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _trigger_support_package_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggerSupportPackage'} # type: ignore + + + @distributed_trace + def begin_trigger_support_package( + self, + device_name: str, + resource_group_name: str, + trigger_support_package_request: "_models.TriggerSupportPackageRequest", + **kwargs: Any + ) -> LROPoller[None]: + """Triggers support package on the device. + + Triggers support package on the device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param trigger_support_package_request: The trigger support package request object. + :type trigger_support_package_request: + ~azure.mgmt.databoxedge.v2021_02_01.models.TriggerSupportPackageRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._trigger_support_package_initial( + device_name=device_name, + resource_group_name=resource_group_name, + trigger_support_package_request=trigger_support_package_request, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_trigger_support_package.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggerSupportPackage'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_triggers_operations.py new file mode 100644 index 000000000000..114b3966ddf0 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_triggers_operations.py @@ -0,0 +1,569 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class TriggersOperations(object): + """TriggersOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_data_box_edge_device( + self, + device_name: str, + resource_group_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.TriggerList"]: + """Lists all the triggers configured in the device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param filter: Specify $filter='CustomContextTag eq :code:``' to filter on custom context + tag property. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TriggerList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.TriggerList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TriggerList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("TriggerList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers'} # type: ignore + + @distributed_trace + def get( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Trigger": + """Get a specific trigger by name. + + :param device_name: The device name. + :type device_name: str + :param name: The trigger name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Trigger, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.Trigger + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Trigger"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Trigger', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + + def _create_or_update_initial( + self, + device_name: str, + name: str, + resource_group_name: str, + trigger: "_models.Trigger", + **kwargs: Any + ) -> Optional["_models.Trigger"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Trigger"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(trigger, 'Trigger') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Trigger', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + device_name: str, + name: str, + resource_group_name: str, + trigger: "_models.Trigger", + **kwargs: Any + ) -> LROPoller["_models.Trigger"]: + """Creates or updates a trigger. + + :param device_name: Creates or updates a trigger. + :type device_name: str + :param name: The trigger name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param trigger: The trigger. + :type trigger: ~azure.mgmt.databoxedge.v2021_02_01.models.Trigger + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Trigger or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2021_02_01.models.Trigger] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Trigger"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + device_name=device_name, + name=name, + resource_group_name=resource_group_name, + trigger=trigger, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Trigger', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + def _delete_initial( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the trigger on the gateway device. + + :param device_name: The device name. + :type device_name: str + :param name: The trigger name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + device_name=device_name, + name=name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_users_operations.py new file mode 100644 index 000000000000..f1f1b43b522c --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_users_operations.py @@ -0,0 +1,569 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class UsersOperations(object): + """UsersOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.databoxedge.v2021_02_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_data_box_edge_device( + self, + device_name: str, + resource_group_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.UserList"]: + """Gets all the users registered on a Data Box Edge/Data Box Gateway device. + + :param device_name: The device name. + :type device_name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param filter: Specify $filter='Type eq :code:``' to filter on user type property. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UserList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01.models.UserList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("UserList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users'} # type: ignore + + @distributed_trace + def get( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.User": + """Gets the properties of the specified user. + + :param device_name: The device name. + :type device_name: str + :param name: The user name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: User, or the result of cls(response) + :rtype: ~azure.mgmt.databoxedge.v2021_02_01.models.User + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.User"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + + def _create_or_update_initial( + self, + device_name: str, + name: str, + resource_group_name: str, + user: "_models.User", + **kwargs: Any + ) -> Optional["_models.User"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.User"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(user, 'User') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + device_name: str, + name: str, + resource_group_name: str, + user: "_models.User", + **kwargs: Any + ) -> LROPoller["_models.User"]: + """Creates a new user or updates an existing user's information on a Data Box Edge/Data Box + Gateway device. + + :param device_name: The device name. + :type device_name: str + :param name: The user name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param user: The user details. + :type user: ~azure.mgmt.databoxedge.v2021_02_01.models.User + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either User or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2021_02_01.models.User] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.User"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + device_name=device_name, + name=name, + resource_group_name=resource_group_name, + user=user, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('User', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + def _delete_initial( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the user on a databox edge/gateway device. + + :param device_name: The device name. + :type device_name: str + :param name: The user name. + :type name: str + :param resource_group_name: The resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + device_name=device_name, + name=name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/py.typed b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/__init__.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/__init__.py index e63196b6b98f..577ebf317c02 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/__init__.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/__init__.py @@ -7,10 +7,12 @@ # -------------------------------------------------------------------------- from ._data_box_edge_management_client import DataBoxEdgeManagementClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['DataBoxEdgeManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_configuration.py index 0e27cd60be90..480de8cc07dc 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_configuration.py @@ -6,19 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential -VERSION = "unknown" class DataBoxEdgeManagementClientConfiguration(Configuration): """Configuration for DataBoxEdgeManagementClient. @@ -34,16 +33,15 @@ class DataBoxEdgeManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -67,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_data_box_edge_management_client.py index 16f27eeeaf02..9c6a294acc3c 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_data_box_edge_management_client.py @@ -6,59 +6,43 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import DataBoxEdgeManagementClientConfiguration +from .operations import AddonsOperations, AlertsOperations, AvailableSkusOperations, BandwidthSchedulesOperations, ContainersOperations, DevicesOperations, JobsOperations, MonitoringConfigOperations, NodesOperations, Operations, OperationsStatusOperations, OrdersOperations, RolesOperations, SharesOperations, StorageAccountCredentialsOperations, StorageAccountsOperations, TriggersOperations, UsersOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import DataBoxEdgeManagementClientConfiguration -from .operations import Operations -from .operations import AvailableSkusOperations -from .operations import DevicesOperations -from .operations import AlertsOperations -from .operations import BandwidthSchedulesOperations -from .operations import JobsOperations -from .operations import NodesOperations -from .operations import OperationsStatusOperations -from .operations import OrdersOperations -from .operations import RolesOperations -from .operations import AddonsOperations -from .operations import MonitoringConfigOperations -from .operations import SharesOperations -from .operations import StorageAccountCredentialsOperations -from .operations import StorageAccountsOperations -from .operations import ContainersOperations -from .operations import TriggersOperations -from .operations import UsersOperations -from . import models - -class DataBoxEdgeManagementClient(object): +class DataBoxEdgeManagementClient: """The DataBoxEdge Client. :ivar operations: Operations operations :vartype operations: azure.mgmt.databoxedge.v2021_02_01_preview.operations.Operations :ivar available_skus: AvailableSkusOperations operations - :vartype available_skus: azure.mgmt.databoxedge.v2021_02_01_preview.operations.AvailableSkusOperations + :vartype available_skus: + azure.mgmt.databoxedge.v2021_02_01_preview.operations.AvailableSkusOperations :ivar devices: DevicesOperations operations :vartype devices: azure.mgmt.databoxedge.v2021_02_01_preview.operations.DevicesOperations :ivar alerts: AlertsOperations operations :vartype alerts: azure.mgmt.databoxedge.v2021_02_01_preview.operations.AlertsOperations :ivar bandwidth_schedules: BandwidthSchedulesOperations operations - :vartype bandwidth_schedules: azure.mgmt.databoxedge.v2021_02_01_preview.operations.BandwidthSchedulesOperations + :vartype bandwidth_schedules: + azure.mgmt.databoxedge.v2021_02_01_preview.operations.BandwidthSchedulesOperations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.databoxedge.v2021_02_01_preview.operations.JobsOperations :ivar nodes: NodesOperations operations :vartype nodes: azure.mgmt.databoxedge.v2021_02_01_preview.operations.NodesOperations :ivar operations_status: OperationsStatusOperations operations - :vartype operations_status: azure.mgmt.databoxedge.v2021_02_01_preview.operations.OperationsStatusOperations + :vartype operations_status: + azure.mgmt.databoxedge.v2021_02_01_preview.operations.OperationsStatusOperations :ivar orders: OrdersOperations operations :vartype orders: azure.mgmt.databoxedge.v2021_02_01_preview.operations.OrdersOperations :ivar roles: RolesOperations operations @@ -66,13 +50,16 @@ class DataBoxEdgeManagementClient(object): :ivar addons: AddonsOperations operations :vartype addons: azure.mgmt.databoxedge.v2021_02_01_preview.operations.AddonsOperations :ivar monitoring_config: MonitoringConfigOperations operations - :vartype monitoring_config: azure.mgmt.databoxedge.v2021_02_01_preview.operations.MonitoringConfigOperations + :vartype monitoring_config: + azure.mgmt.databoxedge.v2021_02_01_preview.operations.MonitoringConfigOperations :ivar shares: SharesOperations operations :vartype shares: azure.mgmt.databoxedge.v2021_02_01_preview.operations.SharesOperations :ivar storage_account_credentials: StorageAccountCredentialsOperations operations - :vartype storage_account_credentials: azure.mgmt.databoxedge.v2021_02_01_preview.operations.StorageAccountCredentialsOperations + :vartype storage_account_credentials: + azure.mgmt.databoxedge.v2021_02_01_preview.operations.StorageAccountCredentialsOperations :ivar storage_accounts: StorageAccountsOperations operations - :vartype storage_accounts: azure.mgmt.databoxedge.v2021_02_01_preview.operations.StorageAccountsOperations + :vartype storage_accounts: + azure.mgmt.databoxedge.v2021_02_01_preview.operations.StorageAccountsOperations :ivar containers: ContainersOperations operations :vartype containers: azure.mgmt.databoxedge.v2021_02_01_preview.operations.ContainersOperations :ivar triggers: TriggersOperations operations @@ -83,82 +70,71 @@ class DataBoxEdgeManagementClient(object): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = DataBoxEdgeManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = DataBoxEdgeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.available_skus = AvailableSkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.orders = OrdersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.addons = AddonsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.monitoring_config = MonitoringConfigOperations( - self._client, self._config, self._serialize, self._deserialize) - self.shares = SharesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.containers = ContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.available_skus = AvailableSkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bandwidth_schedules = BandwidthSchedulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations_status = OperationsStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) + self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize) + self.monitoring_config = MonitoringConfigOperations(self._client, self._config, self._serialize, self._deserialize) + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_account_credentials = StorageAccountCredentialsOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_metadata.json b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_metadata.json index c4a292c62cd0..a50eb540b45f 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_metadata.json +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_metadata.json @@ -5,13 +5,13 @@ "name": "DataBoxEdgeManagementClient", "filename": "_data_box_edge_management_client", "description": "The DataBoxEdge Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataBoxEdgeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "operations": "Operations", diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_patch.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_vendor.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_version.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/__init__.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/__init__.py index c33d46ee91d8..f33cac1fd9b0 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/__init__.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._data_box_edge_management_client import DataBoxEdgeManagementClient __all__ = ['DataBoxEdgeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/_configuration.py index f2b772a27070..e5e231ae3e97 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/_configuration.py @@ -10,13 +10,14 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class DataBoxEdgeManagementClientConfiguration(Configuration): """Configuration for DataBoxEdgeManagementClient. @@ -36,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -63,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/_data_box_edge_management_client.py index 7967f62c7ed8..cccdc2aec92f 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/_data_box_edge_management_client.py @@ -6,57 +6,43 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import DataBoxEdgeManagementClientConfiguration +from .operations import AddonsOperations, AlertsOperations, AvailableSkusOperations, BandwidthSchedulesOperations, ContainersOperations, DevicesOperations, JobsOperations, MonitoringConfigOperations, NodesOperations, Operations, OperationsStatusOperations, OrdersOperations, RolesOperations, SharesOperations, StorageAccountCredentialsOperations, StorageAccountsOperations, TriggersOperations, UsersOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import DataBoxEdgeManagementClientConfiguration -from .operations import Operations -from .operations import AvailableSkusOperations -from .operations import DevicesOperations -from .operations import AlertsOperations -from .operations import BandwidthSchedulesOperations -from .operations import JobsOperations -from .operations import NodesOperations -from .operations import OperationsStatusOperations -from .operations import OrdersOperations -from .operations import RolesOperations -from .operations import AddonsOperations -from .operations import MonitoringConfigOperations -from .operations import SharesOperations -from .operations import StorageAccountCredentialsOperations -from .operations import StorageAccountsOperations -from .operations import ContainersOperations -from .operations import TriggersOperations -from .operations import UsersOperations -from .. import models - - -class DataBoxEdgeManagementClient(object): +class DataBoxEdgeManagementClient: """The DataBoxEdge Client. :ivar operations: Operations operations :vartype operations: azure.mgmt.databoxedge.v2021_02_01_preview.aio.operations.Operations :ivar available_skus: AvailableSkusOperations operations - :vartype available_skus: azure.mgmt.databoxedge.v2021_02_01_preview.aio.operations.AvailableSkusOperations + :vartype available_skus: + azure.mgmt.databoxedge.v2021_02_01_preview.aio.operations.AvailableSkusOperations :ivar devices: DevicesOperations operations :vartype devices: azure.mgmt.databoxedge.v2021_02_01_preview.aio.operations.DevicesOperations :ivar alerts: AlertsOperations operations :vartype alerts: azure.mgmt.databoxedge.v2021_02_01_preview.aio.operations.AlertsOperations :ivar bandwidth_schedules: BandwidthSchedulesOperations operations - :vartype bandwidth_schedules: azure.mgmt.databoxedge.v2021_02_01_preview.aio.operations.BandwidthSchedulesOperations + :vartype bandwidth_schedules: + azure.mgmt.databoxedge.v2021_02_01_preview.aio.operations.BandwidthSchedulesOperations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.databoxedge.v2021_02_01_preview.aio.operations.JobsOperations :ivar nodes: NodesOperations operations :vartype nodes: azure.mgmt.databoxedge.v2021_02_01_preview.aio.operations.NodesOperations :ivar operations_status: OperationsStatusOperations operations - :vartype operations_status: azure.mgmt.databoxedge.v2021_02_01_preview.aio.operations.OperationsStatusOperations + :vartype operations_status: + azure.mgmt.databoxedge.v2021_02_01_preview.aio.operations.OperationsStatusOperations :ivar orders: OrdersOperations operations :vartype orders: azure.mgmt.databoxedge.v2021_02_01_preview.aio.operations.OrdersOperations :ivar roles: RolesOperations operations @@ -64,15 +50,19 @@ class DataBoxEdgeManagementClient(object): :ivar addons: AddonsOperations operations :vartype addons: azure.mgmt.databoxedge.v2021_02_01_preview.aio.operations.AddonsOperations :ivar monitoring_config: MonitoringConfigOperations operations - :vartype monitoring_config: azure.mgmt.databoxedge.v2021_02_01_preview.aio.operations.MonitoringConfigOperations + :vartype monitoring_config: + azure.mgmt.databoxedge.v2021_02_01_preview.aio.operations.MonitoringConfigOperations :ivar shares: SharesOperations operations :vartype shares: azure.mgmt.databoxedge.v2021_02_01_preview.aio.operations.SharesOperations :ivar storage_account_credentials: StorageAccountCredentialsOperations operations - :vartype storage_account_credentials: azure.mgmt.databoxedge.v2021_02_01_preview.aio.operations.StorageAccountCredentialsOperations + :vartype storage_account_credentials: + azure.mgmt.databoxedge.v2021_02_01_preview.aio.operations.StorageAccountCredentialsOperations :ivar storage_accounts: StorageAccountsOperations operations - :vartype storage_accounts: azure.mgmt.databoxedge.v2021_02_01_preview.aio.operations.StorageAccountsOperations + :vartype storage_accounts: + azure.mgmt.databoxedge.v2021_02_01_preview.aio.operations.StorageAccountsOperations :ivar containers: ContainersOperations operations - :vartype containers: azure.mgmt.databoxedge.v2021_02_01_preview.aio.operations.ContainersOperations + :vartype containers: + azure.mgmt.databoxedge.v2021_02_01_preview.aio.operations.ContainersOperations :ivar triggers: TriggersOperations operations :vartype triggers: azure.mgmt.databoxedge.v2021_02_01_preview.aio.operations.TriggersOperations :ivar users: UsersOperations operations @@ -81,80 +71,71 @@ class DataBoxEdgeManagementClient(object): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = DataBoxEdgeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = DataBoxEdgeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.available_skus = AvailableSkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bandwidth_schedules = BandwidthSchedulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations_status = OperationsStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) + self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize) + self.monitoring_config = MonitoringConfigOperations(self._client, self._config, self._serialize, self._deserialize) + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_account_credentials = StorageAccountCredentialsOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) + - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.available_skus = AvailableSkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.orders = OrdersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.addons = AddonsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.monitoring_config = MonitoringConfigOperations( - self._client, self._config, self._serialize, self._deserialize) - self.shares = SharesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.containers = ContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/_patch.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_addons_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_addons_operations.py index 86afe57c3d9a..1cd365db2cd1 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_addons_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_addons_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._addons_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_role_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_role( self, device_name: str, role_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.AddonList"]: """Lists all the addons configured in the role. @@ -60,7 +66,8 @@ def list_by_role( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AddonList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.AddonList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.AddonList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AddonList"] @@ -68,37 +75,35 @@ def list_by_role( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_role.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_role_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_role.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_role_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AddonList', pipeline_response) + deserialized = self._deserialize("AddonList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -116,18 +121,20 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_role.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, role_name: str, addon_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Addon": """Gets a specific addon by name. @@ -149,29 +156,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,8 +182,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, @@ -194,41 +193,31 @@ async def _create_or_update_initial( addon_name: str, resource_group_name: str, addon: "_models.Addon", - **kwargs + **kwargs: Any ) -> Optional["_models.Addon"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Addon"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(addon, 'Addon') + + request = build_create_or_update_request_initial( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(addon, 'Addon') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -244,8 +233,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, @@ -253,7 +245,7 @@ async def begin_create_or_update( addon_name: str, resource_group_name: str, addon: "_models.Addon", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Addon"]: """Create or update a addon. @@ -269,15 +261,19 @@ async def begin_create_or_update( :type addon: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.Addon :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Addon or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Addon] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Addon] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Addon"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,29 +287,21 @@ async def begin_create_or_update( addon_name=addon_name, resource_group_name=resource_group_name, addon=addon, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Addon', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -325,6 +313,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore async def _delete_initial( @@ -333,36 +322,26 @@ async def _delete_initial( role_name: str, addon_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -375,13 +354,15 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, role_name: str, addon_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the addon on the device. @@ -395,15 +376,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -419,23 +402,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -447,4 +421,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_alerts_operations.py index bf5ecb55d5f5..cfebc98da4f4 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_alerts_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._alerts_operations import build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,11 +46,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.AlertList"]: """Gets all the alerts for a Data Box Edge/Data Box Gateway device. @@ -55,7 +61,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AlertList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.AlertList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.AlertList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertList"] @@ -63,36 +70,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AlertList', pipeline_response) + deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,17 +114,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Alert": """Gets an alert by name. @@ -142,28 +148,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,4 +173,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_available_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_available_skus_operations.py index 020b0d430244..06579642f91c 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_available_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_available_skus_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._available_skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,9 +46,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.DataBoxEdgeSkuList"]: """List all the available Skus and information related to them. @@ -51,7 +57,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DataBoxEdgeSkuList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeSkuList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeSkuList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeSkuList"] @@ -59,34 +66,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeSkuList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeSkuList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -104,6 +106,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_bandwidth_schedules_operations.py index d03f2c936a6c..b69e568f7168 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_bandwidth_schedules_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._bandwidth_schedules_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.BandwidthSchedulesList"]: """Gets all the bandwidth schedules for a Data Box Edge/Data Box Gateway device. @@ -56,8 +62,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BandwidthSchedulesList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.BandwidthSchedulesList] + :return: An iterator like instance of either BandwidthSchedulesList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.BandwidthSchedulesList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedulesList"] @@ -65,36 +73,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BandwidthSchedulesList', pipeline_response) + deserialized = self._deserialize("BandwidthSchedulesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,17 +117,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.BandwidthSchedule": """Gets the properties of the specified bandwidth schedule. @@ -142,28 +149,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,48 +174,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, parameters: "_models.BandwidthSchedule", - **kwargs + **kwargs: Any ) -> Optional["_models.BandwidthSchedule"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BandwidthSchedule"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BandwidthSchedule') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BandwidthSchedule') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -234,15 +223,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, parameters: "_models.BandwidthSchedule", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.BandwidthSchedule"]: """Creates or updates a bandwidth schedule. @@ -256,15 +248,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.BandwidthSchedule :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BandwidthSchedule or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.BandwidthSchedule] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BandwidthSchedule or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.BandwidthSchedule] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedule"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,28 +274,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BandwidthSchedule', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -310,6 +300,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore async def _delete_initial( @@ -317,35 +308,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -358,12 +339,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the specified bandwidth schedule. @@ -375,15 +358,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -398,22 +383,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -425,4 +402,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_containers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_containers_operations.py index db42d8f6017f..1275efd3fff6 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_containers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_containers_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._containers_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_storage_account_request, build_refresh_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_storage_account( self, device_name: str, storage_account_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ContainerList"]: """Lists all the containers of a storage Account in a Data Box Edge/Data Box Gateway device. @@ -62,7 +68,8 @@ def list_by_storage_account( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ContainerList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.ContainerList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.ContainerList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerList"] @@ -70,37 +77,35 @@ def list_by_storage_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_storage_account.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_account_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_storage_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_account_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ContainerList', pipeline_response) + deserialized = self._deserialize("ContainerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,18 +123,20 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_storage_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, storage_account_name: str, container_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Container": """Gets a container by name. @@ -153,29 +160,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -189,8 +186,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, @@ -198,41 +197,31 @@ async def _create_or_update_initial( container_name: str, resource_group_name: str, container: "_models.Container", - **kwargs + **kwargs: Any ) -> Optional["_models.Container"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Container"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(container, 'Container') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(container, 'Container') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -248,8 +237,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, @@ -257,7 +249,7 @@ async def begin_create_or_update( container_name: str, resource_group_name: str, container: "_models.Container", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Container"]: """Creates a new container or updates an existing container on the device. @@ -275,15 +267,20 @@ async def begin_create_or_update( :type container: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.Container :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Container or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Container] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Container or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Container] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Container"] lro_delay = kwargs.pop( 'polling_interval', @@ -297,29 +294,21 @@ async def begin_create_or_update( container_name=container_name, resource_group_name=resource_group_name, container=container, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Container', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -331,6 +320,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore async def _delete_initial( @@ -339,36 +329,26 @@ async def _delete_initial( storage_account_name: str, container_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -381,13 +361,15 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, storage_account_name: str, container_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the container on the Data Box Edge/Data Box Gateway device. @@ -401,15 +383,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -425,23 +409,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -453,6 +428,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore async def _refresh_initial( @@ -461,36 +437,26 @@ async def _refresh_initial( storage_account_name: str, container_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -503,13 +469,15 @@ async def _refresh_initial( _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh'} # type: ignore + + @distributed_trace_async async def begin_refresh( self, device_name: str, storage_account_name: str, container_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Refreshes the container metadata with the data from the cloud. @@ -525,15 +493,17 @@ async def begin_refresh( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -549,23 +519,14 @@ async def begin_refresh( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -577,4 +538,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_devices_operations.py index f7ed6510a9d8..b43ac2316f80 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_devices_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._devices_operations import build_create_or_update_request_initial, build_create_or_update_security_settings_request_initial, build_delete_request_initial, build_download_updates_request_initial, build_generate_certificate_request, build_get_extended_information_request, build_get_network_settings_request, build_get_request, build_get_update_summary_request, build_install_updates_request_initial, build_list_by_resource_group_request, build_list_by_subscription_request, build_scan_for_updates_request_initial, build_update_extended_information_request, build_update_request, build_upload_certificate_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,10 +48,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, expand: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.DataBoxEdgeDeviceList"]: """Gets all the Data Box Edge/Data Box Gateway devices in a subscription. @@ -54,8 +60,10 @@ def list_by_subscription( Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -63,36 +71,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,16 +113,18 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, expand: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.DataBoxEdgeDeviceList"]: """Gets all the Data Box Edge/Data Box Gateway devices in a resource group. @@ -129,8 +134,10 @@ def list_by_resource_group( Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -138,37 +145,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -186,16 +189,18 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDevice": """Gets the properties of the Data Box Edge/Data Box Gateway device. @@ -213,27 +218,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,46 +242,38 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, resource_group_name: str, data_box_edge_device: "_models.DataBoxEdgeDevice", - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDevice": cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') + + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -300,14 +287,17 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, resource_group_name: str, data_box_edge_device: "_models.DataBoxEdgeDevice", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.DataBoxEdgeDevice"]: """Creates or updates a Data Box Edge/Data Box Gateway resource. @@ -316,18 +306,24 @@ async def begin_create_or_update( :param resource_group_name: The resource group name. :type resource_group_name: str :param data_box_edge_device: The resource object. - :type data_box_edge_device: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeDevice + :type data_box_edge_device: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeDevice :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DataBoxEdgeDevice or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeDevice] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DataBoxEdgeDevice or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeDevice] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] lro_delay = kwargs.pop( 'polling_interval', @@ -339,27 +335,21 @@ async def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, data_box_edge_device=data_box_edge_device, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DataBoxEdgeDevice', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -371,40 +361,31 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore async def _delete_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -417,11 +398,13 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the Data Box Edge/Data Box Gateway device. @@ -431,15 +414,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -453,21 +438,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -479,14 +457,16 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + @distributed_trace_async async def update( self, device_name: str, resource_group_name: str, parameters: "_models.DataBoxEdgeDevicePatch", - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDevice": """Modifies a Data Box Edge/Data Box Gateway resource. @@ -506,32 +486,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -545,40 +515,32 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + async def _download_updates_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._download_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_download_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._download_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -591,11 +553,13 @@ async def _download_updates_initial( _download_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + + @distributed_trace_async async def begin_download_updates( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Downloads the updates on a Data Box Edge/Data Box Gateway device. @@ -607,15 +571,17 @@ async def begin_download_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -629,21 +595,14 @@ async def begin_download_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -655,13 +614,15 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_download_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + @distributed_trace_async async def generate_certificate( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.GenerateCertResponse": """Generates certificate for activation key. @@ -679,27 +640,17 @@ async def generate_certificate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.generate_certificate.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_generate_certificate_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.generate_certificate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -713,13 +664,16 @@ async def generate_certificate( return cls(pipeline_response, deserialized, {}) return deserialized + generate_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/generateCertificate'} # type: ignore + + @distributed_trace_async async def get_extended_information( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDeviceExtendedInfo": """Gets additional information for the specified Azure Stack Edge/Data Box Gateway device. @@ -737,27 +691,17 @@ async def get_extended_information( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_extended_information.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_extended_information_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_extended_information.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -771,40 +715,32 @@ async def get_extended_information( return cls(pipeline_response, deserialized, {}) return deserialized + get_extended_information.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation'} # type: ignore + async def _install_updates_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._install_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_install_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._install_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -817,11 +753,13 @@ async def _install_updates_initial( _install_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + + @distributed_trace_async async def begin_install_updates( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Installs the updates on the Data Box Edge/Data Box Gateway device. @@ -833,15 +771,17 @@ async def begin_install_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -855,21 +795,14 @@ async def begin_install_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -881,13 +814,15 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_install_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + @distributed_trace_async async def get_network_settings( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.NetworkSettings": """Gets the network settings of the specified Data Box Edge/Data Box Gateway device. @@ -905,27 +840,17 @@ async def get_network_settings( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_network_settings.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_network_settings_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_network_settings.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -939,40 +864,32 @@ async def get_network_settings( return cls(pipeline_response, deserialized, {}) return deserialized + get_network_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/networkSettings/default'} # type: ignore + async def _scan_for_updates_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._scan_for_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_scan_for_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._scan_for_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -985,11 +902,13 @@ async def _scan_for_updates_initial( _scan_for_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore + + @distributed_trace_async async def begin_scan_for_updates( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Scans for updates on a Data Box Edge/Data Box Gateway device. @@ -1001,15 +920,17 @@ async def begin_scan_for_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1023,21 +944,14 @@ async def begin_scan_for_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1049,6 +963,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_scan_for_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore async def _create_or_update_security_settings_initial( @@ -1056,39 +971,29 @@ async def _create_or_update_security_settings_initial( device_name: str, resource_group_name: str, security_settings: "_models.SecuritySettings", - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_security_settings_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(security_settings, 'SecuritySettings') + + request = build_create_or_update_security_settings_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_security_settings_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(security_settings, 'SecuritySettings') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1101,12 +1006,14 @@ async def _create_or_update_security_settings_initial( _create_or_update_security_settings_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + + @distributed_trace_async async def begin_create_or_update_security_settings( self, device_name: str, resource_group_name: str, security_settings: "_models.SecuritySettings", - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Updates the security settings on a Data Box Edge/Data Box Gateway device. @@ -1118,15 +1025,18 @@ async def begin_create_or_update_security_settings( :type security_settings: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SecuritySettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1138,24 +1048,18 @@ async def begin_create_or_update_security_settings( device_name=device_name, resource_group_name=resource_group_name, security_settings=security_settings, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1167,14 +1071,16 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_security_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + @distributed_trace_async async def update_extended_information( self, device_name: str, resource_group_name: str, parameters: "_models.DataBoxEdgeDeviceExtendedInfoPatch", - **kwargs + **kwargs: Any ) -> "_models.DataBoxEdgeDeviceExtendedInfo": """Gets additional information for the specified Data Box Edge/Data Box Gateway device. @@ -1183,7 +1089,8 @@ async def update_extended_information( :param resource_group_name: The resource group name. :type resource_group_name: str :param parameters: The patch object. - :type parameters: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeDeviceExtendedInfoPatch + :type parameters: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeDeviceExtendedInfoPatch :keyword callable cls: A custom type or function that will be passed the direct response :return: DataBoxEdgeDeviceExtendedInfo, or the result of cls(response) :rtype: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeDeviceExtendedInfo @@ -1194,32 +1101,22 @@ async def update_extended_information( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update_extended_information.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'DataBoxEdgeDeviceExtendedInfoPatch') + + request = build_update_extended_information_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.update_extended_information.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataBoxEdgeDeviceExtendedInfoPatch') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1233,15 +1130,19 @@ async def update_extended_information( return cls(pipeline_response, deserialized, {}) return deserialized + update_extended_information.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateExtendedInformation'} # type: ignore + + @distributed_trace_async async def get_update_summary( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.UpdateSummary": - """Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. + """Gets information about the availability of updates based on the last scan of the device. It + also gets information about any ongoing download or install jobs on the device. Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. @@ -1260,27 +1161,17 @@ async def get_update_summary( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_update_summary.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_update_summary_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_update_summary.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1294,14 +1185,17 @@ async def get_update_summary( return cls(pipeline_response, deserialized, {}) return deserialized + get_update_summary.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default'} # type: ignore + + @distributed_trace_async async def upload_certificate( self, device_name: str, resource_group_name: str, parameters: "_models.UploadCertificateRequest", - **kwargs + **kwargs: Any ) -> "_models.UploadCertificateResponse": """Uploads registration certificate for the device. @@ -1321,32 +1215,22 @@ async def upload_certificate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.upload_certificate.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'UploadCertificateRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_upload_certificate_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.upload_certificate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'UploadCertificateRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1360,4 +1244,6 @@ async def upload_certificate( return cls(pipeline_response, deserialized, {}) return deserialized + upload_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/uploadCertificate'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_jobs_operations.py index 5ceed56b4b62..afea8c4dfdc9 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_jobs_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._jobs_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,12 +44,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Job": """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. @@ -67,28 +72,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -102,4 +97,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_monitoring_config_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_monitoring_config_operations.py index dfc0baf622f3..ca470c4b40a6 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_monitoring_config_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_monitoring_config_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._monitoring_config_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, device_name: str, role_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.MonitoringMetricConfigurationList"]: """Lists metric configurations in a role. @@ -61,8 +67,10 @@ def list( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MonitoringMetricConfigurationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MonitoringMetricConfigurationList] + :return: An iterator like instance of either MonitoringMetricConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MonitoringMetricConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringMetricConfigurationList"] @@ -70,37 +78,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('MonitoringMetricConfigurationList', pipeline_response) + deserialized = self._deserialize("MonitoringMetricConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,17 +124,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, role_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.MonitoringMetricConfiguration": """Gets a metric configuration of a role. @@ -150,28 +158,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,48 +183,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + async def _create_or_update_initial( self, device_name: str, role_name: str, resource_group_name: str, monitoring_metric_configuration: "_models.MonitoringMetricConfiguration", - **kwargs + **kwargs: Any ) -> Optional["_models.MonitoringMetricConfiguration"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MonitoringMetricConfiguration"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(monitoring_metric_configuration, 'MonitoringMetricConfiguration') + + request = build_create_or_update_request_initial( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(monitoring_metric_configuration, 'MonitoringMetricConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -242,15 +232,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, role_name: str, resource_group_name: str, monitoring_metric_configuration: "_models.MonitoringMetricConfiguration", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.MonitoringMetricConfiguration"]: """Creates a new metric configuration or updates an existing one for a role. @@ -263,18 +256,24 @@ async def begin_create_or_update( :param resource_group_name: The resource group name. :type resource_group_name: str :param monitoring_metric_configuration: The metric configuration. - :type monitoring_metric_configuration: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.MonitoringMetricConfiguration + :type monitoring_metric_configuration: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.MonitoringMetricConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MonitoringMetricConfiguration or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MonitoringMetricConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringMetricConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MonitoringMetricConfiguration] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringMetricConfiguration"] lro_delay = kwargs.pop( 'polling_interval', @@ -287,28 +286,21 @@ async def begin_create_or_update( role_name=role_name, resource_group_name=resource_group_name, monitoring_metric_configuration=monitoring_metric_configuration, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MonitoringMetricConfiguration', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -320,6 +312,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore async def _delete_initial( @@ -327,35 +320,25 @@ async def _delete_initial( device_name: str, role_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -368,12 +351,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, role_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """deletes a new metric configuration for a role. @@ -387,15 +372,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -410,22 +397,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -437,4 +416,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_nodes_operations.py index 58223a6302d1..d3b6de790e91 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_nodes_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._nodes_operations import build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,11 +46,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.NodeList"]: """Gets all the nodes currently configured under this Data Box Edge device. @@ -55,7 +61,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either NodeList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.NodeList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.NodeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeList"] @@ -63,36 +70,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('NodeList', pipeline_response) + deserialized = self._deserialize("NodeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,6 +114,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_operations.py index 16b0a070e9e5..9f37254d02d6 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,9 +46,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OperationsList"]: """List all the supported operations. @@ -51,7 +57,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.OperationsList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.OperationsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationsList"] @@ -59,30 +66,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationsList', pipeline_response) + deserialized = self._deserialize("OperationsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -100,6 +104,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_operations_status_operations.py index 56aa4ff163fc..31b7e18e7482 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_operations_status_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations_status_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,12 +44,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Job": """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. @@ -67,28 +72,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -102,4 +97,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/operationsStatus/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_orders_operations.py index 6a0ff451ec52..db1d9fac3504 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_orders_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._orders_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request, build_list_dc_access_code_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OrderList"]: """Lists all the orders related to a Data Box Edge/Data Box Gateway device. @@ -59,7 +65,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OrderList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.OrderList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.OrderList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OrderList"] @@ -67,36 +74,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OrderList', pipeline_response) + deserialized = self._deserialize("OrderList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,16 +118,18 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Order": """Gets a specific order by name. @@ -143,27 +149,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,46 +173,38 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + async def _create_or_update_initial( self, device_name: str, resource_group_name: str, order: "_models.Order", - **kwargs + **kwargs: Any ) -> Optional["_models.Order"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Order"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(order, 'Order') + + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(order, 'Order') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -232,14 +220,17 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, resource_group_name: str, order: "_models.Order", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Order"]: """Creates or updates an order. @@ -253,15 +244,19 @@ async def begin_create_or_update( :type order: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.Order :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Order or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Order] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Order] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Order"] lro_delay = kwargs.pop( 'polling_interval', @@ -273,27 +268,21 @@ async def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, order=order, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Order', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -305,40 +294,31 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore async def _delete_initial( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -351,11 +331,13 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the order related to the device. @@ -367,15 +349,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -389,21 +373,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -415,13 +392,15 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + @distributed_trace_async async def list_dc_access_code( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.DCAccessCode": """Gets the DCAccess Code. @@ -441,27 +420,17 @@ async def list_dc_access_code( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_dc_access_code.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_dc_access_code_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_dc_access_code.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -475,4 +444,6 @@ async def list_dc_access_code( return cls(pipeline_response, deserialized, {}) return deserialized + list_dc_access_code.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default/listDCAccessCode'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_roles_operations.py index 48018de5770a..3d2f7fdeec2d 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_roles_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._roles_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.RoleList"]: """Lists all the roles configured in a Data Box Edge/Data Box Gateway device. @@ -57,7 +63,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RoleList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleList"] @@ -65,36 +72,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RoleList', pipeline_response) + deserialized = self._deserialize("RoleList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,17 +116,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Role": """Gets a specific role by name. @@ -142,28 +148,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,48 +173,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, role: "_models.Role", - **kwargs + **kwargs: Any ) -> Optional["_models.Role"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Role"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(role, 'Role') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(role, 'Role') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -234,15 +222,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, role: "_models.Role", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Role"]: """Create or update a role. @@ -256,15 +247,19 @@ async def begin_create_or_update( :type role: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.Role :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Role or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Role] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Role] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Role"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,28 +272,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, role=role, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Role', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -310,6 +298,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore async def _delete_initial( @@ -317,35 +306,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -358,12 +337,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the role on the device. @@ -375,15 +356,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -398,22 +381,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -425,4 +400,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_shares_operations.py index f8b3bcb3f44a..2526b7eaf961 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_shares_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._shares_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request, build_refresh_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ShareList"]: """Lists all the shares in a Data Box Edge/Data Box Gateway device. @@ -59,7 +65,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ShareList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.ShareList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.ShareList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ShareList"] @@ -67,36 +74,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ShareList', pipeline_response) + deserialized = self._deserialize("ShareList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,17 +118,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Share": """Gets a share by name. @@ -146,28 +152,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -181,48 +177,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, share: "_models.Share", - **kwargs + **kwargs: Any ) -> Optional["_models.Share"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Share"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(share, 'Share') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(share, 'Share') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -238,15 +226,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, share: "_models.Share", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Share"]: """Creates a new share or updates an existing share on the device. @@ -262,15 +253,19 @@ async def begin_create_or_update( :type share: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.Share :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Share or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Share] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Share] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Share"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,28 +278,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, share=share, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Share', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -316,6 +304,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore async def _delete_initial( @@ -323,35 +312,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,12 +343,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the share on the Data Box Edge/Data Box Gateway device. @@ -381,15 +362,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -404,22 +387,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -431,6 +406,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore async def _refresh_initial( @@ -438,35 +414,25 @@ async def _refresh_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -479,12 +445,14 @@ async def _refresh_initial( _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore + + @distributed_trace_async async def begin_refresh( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Refreshes the share metadata with the data from the cloud. @@ -498,15 +466,17 @@ async def begin_refresh( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -521,22 +491,14 @@ async def begin_refresh( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -548,4 +510,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_storage_account_credentials_operations.py index 23af9ec14777..9533c52b9eb0 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_storage_account_credentials_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._storage_account_credentials_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.StorageAccountCredentialList"]: """Gets all the storage account credentials in a Data Box Edge/Data Box Gateway device. @@ -58,8 +64,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountCredentialList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.StorageAccountCredentialList] + :return: An iterator like instance of either StorageAccountCredentialList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.StorageAccountCredentialList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredentialList"] @@ -67,36 +75,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('StorageAccountCredentialList', pipeline_response) + deserialized = self._deserialize("StorageAccountCredentialList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,17 +119,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.StorageAccountCredential": """Gets the properties of the specified storage account credential. @@ -144,28 +151,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -179,48 +176,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, storage_account_credential: "_models.StorageAccountCredential", - **kwargs + **kwargs: Any ) -> Optional["_models.StorageAccountCredential"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccountCredential"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(storage_account_credential, 'StorageAccountCredential') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_account_credential, 'StorageAccountCredential') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -236,15 +225,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, storage_account_credential: "_models.StorageAccountCredential", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.StorageAccountCredential"]: """Creates or updates the storage account credential. @@ -255,18 +247,24 @@ async def begin_create_or_update( :param resource_group_name: The resource group name. :type resource_group_name: str :param storage_account_credential: The storage account credential. - :type storage_account_credential: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.StorageAccountCredential + :type storage_account_credential: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.StorageAccountCredential :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either StorageAccountCredential or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.StorageAccountCredential] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageAccountCredential or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.StorageAccountCredential] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredential"] lro_delay = kwargs.pop( 'polling_interval', @@ -279,28 +277,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, storage_account_credential=storage_account_credential, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccountCredential', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -312,6 +303,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore async def _delete_initial( @@ -319,35 +311,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -360,12 +342,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the storage account credential. @@ -377,15 +361,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -400,22 +386,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -427,4 +405,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_storage_accounts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_storage_accounts_operations.py index f3e0964591b0..a07eae0ea31e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_storage_accounts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_storage_accounts_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._storage_accounts_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.StorageAccountList"]: """Lists all the StorageAccounts in a Data Box Edge/Data Box Gateway device. @@ -59,7 +65,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either StorageAccountList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.StorageAccountList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.StorageAccountList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountList"] @@ -67,36 +74,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('StorageAccountList', pipeline_response) + deserialized = self._deserialize("StorageAccountList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,17 +118,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, storage_account_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.StorageAccount": """Gets a StorageAccount by name. @@ -146,28 +152,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -181,48 +177,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, storage_account_name: str, resource_group_name: str, storage_account: "_models.StorageAccount", - **kwargs + **kwargs: Any ) -> Optional["_models.StorageAccount"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(storage_account, 'StorageAccount') + + request = build_create_or_update_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_account, 'StorageAccount') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -238,15 +226,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, storage_account_name: str, resource_group_name: str, storage_account: "_models.StorageAccount", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.StorageAccount"]: """Creates a new StorageAccount or updates an existing StorageAccount on the device. @@ -262,15 +253,20 @@ async def begin_create_or_update( :type storage_account: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.StorageAccount :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either StorageAccount or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,28 +279,21 @@ async def begin_create_or_update( storage_account_name=storage_account_name, resource_group_name=resource_group_name, storage_account=storage_account, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -316,6 +305,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore async def _delete_initial( @@ -323,35 +313,25 @@ async def _delete_initial( device_name: str, storage_account_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,12 +344,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, storage_account_name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the StorageAccount on the Data Box Edge/Data Box Gateway device. @@ -381,15 +363,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -404,22 +388,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -431,4 +407,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_triggers_operations.py index 6f3140528c6f..3e679c91bc89 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_triggers_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._triggers_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, filter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.TriggerList"]: """Lists all the triggers configured in the device. @@ -61,7 +67,8 @@ def list_by_data_box_edge_device( :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TriggerList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.TriggerList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.TriggerList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TriggerList"] @@ -69,38 +76,35 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TriggerList', pipeline_response) + deserialized = self._deserialize("TriggerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,17 +122,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.Trigger": """Get a specific trigger by name. @@ -148,28 +154,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,48 +179,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, trigger: "_models.Trigger", - **kwargs + **kwargs: Any ) -> Optional["_models.Trigger"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Trigger"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(trigger, 'Trigger') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(trigger, 'Trigger') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,15 +228,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, trigger: "_models.Trigger", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Trigger"]: """Creates or updates a trigger. @@ -262,15 +253,20 @@ async def begin_create_or_update( :type trigger: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.Trigger :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Trigger or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Trigger] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Trigger or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Trigger] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Trigger"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,28 +279,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, trigger=trigger, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Trigger', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -316,6 +305,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore async def _delete_initial( @@ -323,35 +313,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,12 +344,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the trigger on the gateway device. @@ -381,15 +363,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -404,22 +388,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -431,4 +407,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_users_operations.py index ae5d2249538f..0d3a9491f020 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_users_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._users_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_data_box_edge_device_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, device_name: str, resource_group_name: str, expand: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.UserList"]: """Gets all the users registered on a Data Box Edge/Data Box Gateway device. @@ -61,7 +67,8 @@ def list_by_data_box_edge_device( :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.UserList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.UserList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UserList"] @@ -69,38 +76,35 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('UserList', pipeline_response) + deserialized = self._deserialize("UserList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,17 +122,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users'} # type: ignore + @distributed_trace_async async def get( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.User": """Gets the properties of the specified user. @@ -148,28 +154,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,48 +179,40 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + async def _create_or_update_initial( self, device_name: str, name: str, resource_group_name: str, user: "_models.User", - **kwargs + **kwargs: Any ) -> Optional["_models.User"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.User"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(user, 'User') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(user, 'User') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,15 +228,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, device_name: str, name: str, resource_group_name: str, user: "_models.User", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.User"]: """Creates a new user or updates an existing user's information on a Data Box Edge/Data Box Gateway device. @@ -263,15 +254,19 @@ async def begin_create_or_update( :type user: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.User :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either User or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.User] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.User] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.User"] lro_delay = kwargs.pop( 'polling_interval', @@ -284,28 +279,21 @@ async def begin_create_or_update( name=name, resource_group_name=resource_group_name, user=user, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('User', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -317,6 +305,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore async def _delete_initial( @@ -324,35 +313,25 @@ async def _delete_initial( device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -365,12 +344,14 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, device_name: str, name: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the user on a databox edge/gateway device. @@ -382,15 +363,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -405,22 +388,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -432,4 +407,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/models/__init__.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/models/__init__.py index 427bbdbc0d20..35d68780384d 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/models/__init__.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/models/__init__.py @@ -6,244 +6,126 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ARMBaseModel - from ._models_py3 import Addon - from ._models_py3 import AddonList - from ._models_py3 import Address - from ._models_py3 import Alert - from ._models_py3 import AlertErrorDetails - from ._models_py3 import AlertList - from ._models_py3 import ArcAddon - from ._models_py3 import AsymmetricEncryptedSecret - from ._models_py3 import Authentication - from ._models_py3 import AzureContainerInfo - from ._models_py3 import BandwidthSchedule - from ._models_py3 import BandwidthSchedulesList - from ._models_py3 import ClientAccessRight - from ._models_py3 import CloudEdgeManagementRole - from ._models_py3 import CloudErrorBody - from ._models_py3 import CniConfig - from ._models_py3 import ComputeResource - from ._models_py3 import ContactDetails - from ._models_py3 import Container - from ._models_py3 import ContainerList - from ._models_py3 import DCAccessCode - from ._models_py3 import DataBoxEdgeDevice - from ._models_py3 import DataBoxEdgeDeviceExtendedInfo - from ._models_py3 import DataBoxEdgeDeviceExtendedInfoPatch - from ._models_py3 import DataBoxEdgeDeviceList - from ._models_py3 import DataBoxEdgeDevicePatch - from ._models_py3 import DataBoxEdgeMoveRequest - from ._models_py3 import DataBoxEdgeSku - from ._models_py3 import DataBoxEdgeSkuList - from ._models_py3 import EdgeProfile - from ._models_py3 import EdgeProfilePatch - from ._models_py3 import EdgeProfileSubscription - from ._models_py3 import EdgeProfileSubscriptionPatch - from ._models_py3 import EtcdInfo - from ._models_py3 import FileEventTrigger - from ._models_py3 import FileSourceInfo - from ._models_py3 import GenerateCertResponse - from ._models_py3 import ImageRepositoryCredential - from ._models_py3 import IoTAddon - from ._models_py3 import IoTDeviceInfo - from ._models_py3 import IoTEdgeAgentInfo - from ._models_py3 import IoTRole - from ._models_py3 import Ipv4Config - from ._models_py3 import Ipv6Config - from ._models_py3 import Job - from ._models_py3 import JobErrorDetails - from ._models_py3 import JobErrorItem - from ._models_py3 import KubernetesClusterInfo - from ._models_py3 import KubernetesIPConfiguration - from ._models_py3 import KubernetesRole - from ._models_py3 import KubernetesRoleCompute - from ._models_py3 import KubernetesRoleNetwork - from ._models_py3 import KubernetesRoleResources - from ._models_py3 import KubernetesRoleStorage - from ._models_py3 import KubernetesRoleStorageClassInfo - from ._models_py3 import LoadBalancerConfig - from ._models_py3 import MECRole - from ._models_py3 import MetricConfiguration - from ._models_py3 import MetricCounter - from ._models_py3 import MetricCounterSet - from ._models_py3 import MetricDimension - from ._models_py3 import MetricDimensionV1 - from ._models_py3 import MetricSpecificationV1 - from ._models_py3 import MonitoringMetricConfiguration - from ._models_py3 import MonitoringMetricConfigurationList - from ._models_py3 import MountPointMap - from ._models_py3 import NetworkAdapter - from ._models_py3 import NetworkAdapterPosition - from ._models_py3 import NetworkSettings - from ._models_py3 import Node - from ._models_py3 import NodeInfo - from ._models_py3 import NodeList - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationsList - from ._models_py3 import Order - from ._models_py3 import OrderList - from ._models_py3 import OrderStatus - from ._models_py3 import PeriodicTimerEventTrigger - from ._models_py3 import PeriodicTimerSourceInfo - from ._models_py3 import RefreshDetails - from ._models_py3 import ResourceIdentity - from ._models_py3 import ResourceMoveDetails - from ._models_py3 import ResourceTypeSku - from ._models_py3 import Role - from ._models_py3 import RoleList - from ._models_py3 import RoleSinkInfo - from ._models_py3 import Secret - from ._models_py3 import SecuritySettings - from ._models_py3 import ServiceSpecification - from ._models_py3 import Share - from ._models_py3 import ShareAccessRight - from ._models_py3 import ShareList - from ._models_py3 import Sku - from ._models_py3 import SkuCost - from ._models_py3 import SkuInformation - from ._models_py3 import SkuInformationList - from ._models_py3 import SkuLocationInfo - from ._models_py3 import StorageAccount - from ._models_py3 import StorageAccountCredential - from ._models_py3 import StorageAccountCredentialList - from ._models_py3 import StorageAccountList - from ._models_py3 import SubscriptionRegisteredFeatures - from ._models_py3 import SymmetricKey - from ._models_py3 import SystemData - from ._models_py3 import TrackingInfo - from ._models_py3 import Trigger - from ._models_py3 import TriggerList - from ._models_py3 import UpdateDetails - from ._models_py3 import UpdateDownloadProgress - from ._models_py3 import UpdateInstallProgress - from ._models_py3 import UpdateSummary - from ._models_py3 import UploadCertificateRequest - from ._models_py3 import UploadCertificateResponse - from ._models_py3 import User - from ._models_py3 import UserAccessRight - from ._models_py3 import UserList -except (SyntaxError, ImportError): - from ._models import ARMBaseModel # type: ignore - from ._models import Addon # type: ignore - from ._models import AddonList # type: ignore - from ._models import Address # type: ignore - from ._models import Alert # type: ignore - from ._models import AlertErrorDetails # type: ignore - from ._models import AlertList # type: ignore - from ._models import ArcAddon # type: ignore - from ._models import AsymmetricEncryptedSecret # type: ignore - from ._models import Authentication # type: ignore - from ._models import AzureContainerInfo # type: ignore - from ._models import BandwidthSchedule # type: ignore - from ._models import BandwidthSchedulesList # type: ignore - from ._models import ClientAccessRight # type: ignore - from ._models import CloudEdgeManagementRole # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import CniConfig # type: ignore - from ._models import ComputeResource # type: ignore - from ._models import ContactDetails # type: ignore - from ._models import Container # type: ignore - from ._models import ContainerList # type: ignore - from ._models import DCAccessCode # type: ignore - from ._models import DataBoxEdgeDevice # type: ignore - from ._models import DataBoxEdgeDeviceExtendedInfo # type: ignore - from ._models import DataBoxEdgeDeviceExtendedInfoPatch # type: ignore - from ._models import DataBoxEdgeDeviceList # type: ignore - from ._models import DataBoxEdgeDevicePatch # type: ignore - from ._models import DataBoxEdgeMoveRequest # type: ignore - from ._models import DataBoxEdgeSku # type: ignore - from ._models import DataBoxEdgeSkuList # type: ignore - from ._models import EdgeProfile # type: ignore - from ._models import EdgeProfilePatch # type: ignore - from ._models import EdgeProfileSubscription # type: ignore - from ._models import EdgeProfileSubscriptionPatch # type: ignore - from ._models import EtcdInfo # type: ignore - from ._models import FileEventTrigger # type: ignore - from ._models import FileSourceInfo # type: ignore - from ._models import GenerateCertResponse # type: ignore - from ._models import ImageRepositoryCredential # type: ignore - from ._models import IoTAddon # type: ignore - from ._models import IoTDeviceInfo # type: ignore - from ._models import IoTEdgeAgentInfo # type: ignore - from ._models import IoTRole # type: ignore - from ._models import Ipv4Config # type: ignore - from ._models import Ipv6Config # type: ignore - from ._models import Job # type: ignore - from ._models import JobErrorDetails # type: ignore - from ._models import JobErrorItem # type: ignore - from ._models import KubernetesClusterInfo # type: ignore - from ._models import KubernetesIPConfiguration # type: ignore - from ._models import KubernetesRole # type: ignore - from ._models import KubernetesRoleCompute # type: ignore - from ._models import KubernetesRoleNetwork # type: ignore - from ._models import KubernetesRoleResources # type: ignore - from ._models import KubernetesRoleStorage # type: ignore - from ._models import KubernetesRoleStorageClassInfo # type: ignore - from ._models import LoadBalancerConfig # type: ignore - from ._models import MECRole # type: ignore - from ._models import MetricConfiguration # type: ignore - from ._models import MetricCounter # type: ignore - from ._models import MetricCounterSet # type: ignore - from ._models import MetricDimension # type: ignore - from ._models import MetricDimensionV1 # type: ignore - from ._models import MetricSpecificationV1 # type: ignore - from ._models import MonitoringMetricConfiguration # type: ignore - from ._models import MonitoringMetricConfigurationList # type: ignore - from ._models import MountPointMap # type: ignore - from ._models import NetworkAdapter # type: ignore - from ._models import NetworkAdapterPosition # type: ignore - from ._models import NetworkSettings # type: ignore - from ._models import Node # type: ignore - from ._models import NodeInfo # type: ignore - from ._models import NodeList # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationsList # type: ignore - from ._models import Order # type: ignore - from ._models import OrderList # type: ignore - from ._models import OrderStatus # type: ignore - from ._models import PeriodicTimerEventTrigger # type: ignore - from ._models import PeriodicTimerSourceInfo # type: ignore - from ._models import RefreshDetails # type: ignore - from ._models import ResourceIdentity # type: ignore - from ._models import ResourceMoveDetails # type: ignore - from ._models import ResourceTypeSku # type: ignore - from ._models import Role # type: ignore - from ._models import RoleList # type: ignore - from ._models import RoleSinkInfo # type: ignore - from ._models import Secret # type: ignore - from ._models import SecuritySettings # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Share # type: ignore - from ._models import ShareAccessRight # type: ignore - from ._models import ShareList # type: ignore - from ._models import Sku # type: ignore - from ._models import SkuCost # type: ignore - from ._models import SkuInformation # type: ignore - from ._models import SkuInformationList # type: ignore - from ._models import SkuLocationInfo # type: ignore - from ._models import StorageAccount # type: ignore - from ._models import StorageAccountCredential # type: ignore - from ._models import StorageAccountCredentialList # type: ignore - from ._models import StorageAccountList # type: ignore - from ._models import SubscriptionRegisteredFeatures # type: ignore - from ._models import SymmetricKey # type: ignore - from ._models import SystemData # type: ignore - from ._models import TrackingInfo # type: ignore - from ._models import Trigger # type: ignore - from ._models import TriggerList # type: ignore - from ._models import UpdateDetails # type: ignore - from ._models import UpdateDownloadProgress # type: ignore - from ._models import UpdateInstallProgress # type: ignore - from ._models import UpdateSummary # type: ignore - from ._models import UploadCertificateRequest # type: ignore - from ._models import UploadCertificateResponse # type: ignore - from ._models import User # type: ignore - from ._models import UserAccessRight # type: ignore - from ._models import UserList # type: ignore +from ._models_py3 import ARMBaseModel +from ._models_py3 import Addon +from ._models_py3 import AddonList +from ._models_py3 import Address +from ._models_py3 import Alert +from ._models_py3 import AlertErrorDetails +from ._models_py3 import AlertList +from ._models_py3 import ArcAddon +from ._models_py3 import AsymmetricEncryptedSecret +from ._models_py3 import Authentication +from ._models_py3 import AzureContainerInfo +from ._models_py3 import BandwidthSchedule +from ._models_py3 import BandwidthSchedulesList +from ._models_py3 import ClientAccessRight +from ._models_py3 import CloudEdgeManagementRole +from ._models_py3 import CloudErrorBody +from ._models_py3 import CniConfig +from ._models_py3 import ComputeResource +from ._models_py3 import ContactDetails +from ._models_py3 import Container +from ._models_py3 import ContainerList +from ._models_py3 import DCAccessCode +from ._models_py3 import DataBoxEdgeDevice +from ._models_py3 import DataBoxEdgeDeviceExtendedInfo +from ._models_py3 import DataBoxEdgeDeviceExtendedInfoPatch +from ._models_py3 import DataBoxEdgeDeviceList +from ._models_py3 import DataBoxEdgeDevicePatch +from ._models_py3 import DataBoxEdgeMoveRequest +from ._models_py3 import DataBoxEdgeSku +from ._models_py3 import DataBoxEdgeSkuList +from ._models_py3 import EdgeProfile +from ._models_py3 import EdgeProfilePatch +from ._models_py3 import EdgeProfileSubscription +from ._models_py3 import EdgeProfileSubscriptionPatch +from ._models_py3 import EtcdInfo +from ._models_py3 import FileEventTrigger +from ._models_py3 import FileSourceInfo +from ._models_py3 import GenerateCertResponse +from ._models_py3 import ImageRepositoryCredential +from ._models_py3 import IoTAddon +from ._models_py3 import IoTDeviceInfo +from ._models_py3 import IoTEdgeAgentInfo +from ._models_py3 import IoTRole +from ._models_py3 import Ipv4Config +from ._models_py3 import Ipv6Config +from ._models_py3 import Job +from ._models_py3 import JobErrorDetails +from ._models_py3 import JobErrorItem +from ._models_py3 import KubernetesClusterInfo +from ._models_py3 import KubernetesIPConfiguration +from ._models_py3 import KubernetesRole +from ._models_py3 import KubernetesRoleCompute +from ._models_py3 import KubernetesRoleNetwork +from ._models_py3 import KubernetesRoleResources +from ._models_py3 import KubernetesRoleStorage +from ._models_py3 import KubernetesRoleStorageClassInfo +from ._models_py3 import LoadBalancerConfig +from ._models_py3 import MECRole +from ._models_py3 import MetricConfiguration +from ._models_py3 import MetricCounter +from ._models_py3 import MetricCounterSet +from ._models_py3 import MetricDimension +from ._models_py3 import MetricDimensionV1 +from ._models_py3 import MetricSpecificationV1 +from ._models_py3 import MonitoringMetricConfiguration +from ._models_py3 import MonitoringMetricConfigurationList +from ._models_py3 import MountPointMap +from ._models_py3 import NetworkAdapter +from ._models_py3 import NetworkAdapterPosition +from ._models_py3 import NetworkSettings +from ._models_py3 import Node +from ._models_py3 import NodeInfo +from ._models_py3 import NodeList +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationsList +from ._models_py3 import Order +from ._models_py3 import OrderList +from ._models_py3 import OrderStatus +from ._models_py3 import PeriodicTimerEventTrigger +from ._models_py3 import PeriodicTimerSourceInfo +from ._models_py3 import RefreshDetails +from ._models_py3 import ResourceIdentity +from ._models_py3 import ResourceMoveDetails +from ._models_py3 import ResourceTypeSku +from ._models_py3 import Role +from ._models_py3 import RoleList +from ._models_py3 import RoleSinkInfo +from ._models_py3 import Secret +from ._models_py3 import SecuritySettings +from ._models_py3 import ServiceSpecification +from ._models_py3 import Share +from ._models_py3 import ShareAccessRight +from ._models_py3 import ShareList +from ._models_py3 import Sku +from ._models_py3 import SkuCapability +from ._models_py3 import SkuCost +from ._models_py3 import SkuInformation +from ._models_py3 import SkuInformationList +from ._models_py3 import SkuLocationInfo +from ._models_py3 import StorageAccount +from ._models_py3 import StorageAccountCredential +from ._models_py3 import StorageAccountCredentialList +from ._models_py3 import StorageAccountList +from ._models_py3 import SubscriptionRegisteredFeatures +from ._models_py3 import SymmetricKey +from ._models_py3 import SystemData +from ._models_py3 import TrackingInfo +from ._models_py3 import Trigger +from ._models_py3 import TriggerList +from ._models_py3 import UpdateDetails +from ._models_py3 import UpdateDownloadProgress +from ._models_py3 import UpdateInstallProgress +from ._models_py3 import UpdateSummary +from ._models_py3 import UploadCertificateRequest +from ._models_py3 import UploadCertificateResponse +from ._models_py3 import User +from ._models_py3 import UserAccessRight +from ._models_py3 import UserList + from ._data_box_edge_management_client_enums import ( AccountType, @@ -403,6 +285,7 @@ 'ShareAccessRight', 'ShareList', 'Sku', + 'SkuCapability', 'SkuCost', 'SkuInformation', 'SkuInformationList', diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/models/_data_box_edge_management_client_enums.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/models/_data_box_edge_management_client_enums.py index 3f2a52eaabf0..733add953390 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/models/_data_box_edge_management_client_enums.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/models/_data_box_edge_management_client_enums.py @@ -6,34 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccountType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of storage accessed on the storage account. """ GENERAL_PURPOSE_STORAGE = "GeneralPurposeStorage" BLOB_STORAGE = "BlobStorage" -class AddonState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AddonState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Addon Provisioning State """ @@ -45,14 +30,14 @@ class AddonState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" DELETING = "Deleting" -class AddonType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AddonType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Addon type. """ IOT_EDGE = "IotEdge" ARC_FOR_KUBERNETES = "ArcForKubernetes" -class AlertSeverity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AlertSeverity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Severity of the alert. """ @@ -60,14 +45,14 @@ class AlertSeverity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" CRITICAL = "Critical" -class AuthenticationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AuthenticationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The authentication type. """ INVALID = "Invalid" AZURE_ACTIVE_DIRECTORY = "AzureActiveDirectory" -class AzureContainerDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AzureContainerDataFormat(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Storage format used for the file represented by the share. """ @@ -75,7 +60,7 @@ class AzureContainerDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu PAGE_BLOB = "PageBlob" AZURE_FILE = "AzureFile" -class ClientPermissionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ClientPermissionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of access to be allowed for the client. """ @@ -83,7 +68,7 @@ class ClientPermissionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ_ONLY = "ReadOnly" READ_WRITE = "ReadWrite" -class ContainerStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ContainerStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current status of the container. """ @@ -93,7 +78,7 @@ class ContainerStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UPDATING = "Updating" NEEDS_ATTENTION = "NeedsAttention" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -102,7 +87,7 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class DataBoxEdgeDeviceKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DataBoxEdgeDeviceKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The etag for the devices. """ @@ -111,7 +96,7 @@ class DataBoxEdgeDeviceKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) AZURE_STACK_HUB = "AzureStackHub" AZURE_MODULAR_DATA_CENTRE = "AzureModularDataCentre" -class DataBoxEdgeDeviceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DataBoxEdgeDeviceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the Data Box Edge/Gateway device. """ @@ -123,14 +108,14 @@ class DataBoxEdgeDeviceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum PARTIALLY_DISCONNECTED = "PartiallyDisconnected" MAINTENANCE = "Maintenance" -class DataPolicy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DataPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Data policy of the share. """ CLOUD = "Cloud" LOCAL = "Local" -class DayOfWeek(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DayOfWeek(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SUNDAY = "Sunday" MONDAY = "Monday" @@ -140,13 +125,13 @@ class DayOfWeek(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FRIDAY = "Friday" SATURDAY = "Saturday" -class DeviceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeviceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the Data Box Edge/Gateway device. """ DATA_BOX_EDGE_DEVICE = "DataBoxEdgeDevice" -class DownloadPhase(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DownloadPhase(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The download phase. """ @@ -155,7 +140,7 @@ class DownloadPhase(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DOWNLOADING = "Downloading" VERIFYING = "Verifying" -class EncryptionAlgorithm(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The algorithm used to encrypt "Value". """ @@ -163,14 +148,14 @@ class EncryptionAlgorithm(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AES256 = "AES256" RSAES_PKCS1_V1_5 = "RSAES_PKCS1_v_1_5" -class HostPlatformType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HostPlatformType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Platform where the runtime is hosted. """ KUBERNETES_CLUSTER = "KubernetesCluster" LINUX_VM = "LinuxVM" -class InstallRebootBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InstallRebootBehavior(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates if updates are available and at least one of the updates needs a reboot. """ @@ -178,7 +163,7 @@ class InstallRebootBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) REQUIRES_REBOOT = "RequiresReboot" REQUEST_REBOOT = "RequestReboot" -class JobStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JobStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current status of the job. """ @@ -190,7 +175,7 @@ class JobStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PAUSED = "Paused" SCHEDULED = "Scheduled" -class JobType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JobType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the job. """ @@ -204,7 +189,7 @@ class JobType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESTORE = "Restore" TRIGGER_SUPPORT_PACKAGE = "TriggerSupportPackage" -class KeyVaultSyncStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeyVaultSyncStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """For changing or to initiate the resync to key-vault set the status to KeyVaultSyncPending, rest of the status will not be applicable. """ @@ -216,7 +201,7 @@ class KeyVaultSyncStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): KEY_VAULT_SYNCING = "KeyVaultSyncing" KEY_VAULT_NOT_SYNCED = "KeyVaultNotSynced" -class KubernetesNodeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KubernetesNodeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Node type - Master/Worker """ @@ -224,7 +209,7 @@ class KubernetesNodeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MASTER = "Master" WORKER = "Worker" -class KubernetesState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KubernetesState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """State of Kubernetes deployment """ @@ -236,7 +221,7 @@ class KubernetesState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" DELETING = "Deleting" -class MetricAggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricAggregationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Metric aggregation type. """ @@ -248,14 +233,14 @@ class MetricAggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) TOTAL = "Total" COUNT = "Count" -class MetricCategory(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricCategory(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Metric category. """ CAPACITY = "Capacity" TRANSACTION = "Transaction" -class MetricUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Metric units. """ @@ -268,21 +253,21 @@ class MetricUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BYTES_PER_SECOND = "BytesPerSecond" COUNT_PER_SECOND = "CountPerSecond" -class MonitoringStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MonitoringStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current monitoring status of the share. """ ENABLED = "Enabled" DISABLED = "Disabled" -class MountType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MountType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Mounting type. """ VOLUME = "Volume" HOST_PATH = "HostPath" -class MsiIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MsiIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Identity type """ @@ -290,28 +275,28 @@ class MsiIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED = "SystemAssigned" USER_ASSIGNED = "UserAssigned" -class NetworkAdapterDHCPStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkAdapterDHCPStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Value indicating whether this adapter has DHCP enabled. """ DISABLED = "Disabled" ENABLED = "Enabled" -class NetworkAdapterRDMAStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkAdapterRDMAStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Value indicating whether this adapter is RDMA capable. """ INCAPABLE = "Incapable" CAPABLE = "Capable" -class NetworkAdapterStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkAdapterStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Value indicating whether this adapter is valid. """ INACTIVE = "Inactive" ACTIVE = "Active" -class NetworkGroup(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkGroup(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The network group. """ @@ -319,7 +304,7 @@ class NetworkGroup(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): NON_RDMA = "NonRDMA" RDMA = "RDMA" -class NodeStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NodeStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current status of the individual node """ @@ -329,7 +314,7 @@ class NodeStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): REBOOTING = "Rebooting" SHUTTING_DOWN = "ShuttingDown" -class OrderState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OrderState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the order as per the allowed status types. """ @@ -351,14 +336,14 @@ class OrderState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PICKUP_COMPLETED = "PickupCompleted" AWAITING_DROP = "AwaitingDrop" -class PlatformType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PlatformType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Host OS supported by the Arc addon. """ WINDOWS = "Windows" LINUX = "Linux" -class PosixComplianceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PosixComplianceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """If provisioned storage is posix compliant. """ @@ -366,7 +351,7 @@ class PosixComplianceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) ENABLED = "Enabled" DISABLED = "Disabled" -class ResourceMoveStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceMoveStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Denotes whether move operation is in progress """ @@ -374,14 +359,14 @@ class ResourceMoveStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESOURCE_MOVE_IN_PROGRESS = "ResourceMoveInProgress" RESOURCE_MOVE_FAILED = "ResourceMoveFailed" -class RoleStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RoleStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Local Edge Management Status """ ENABLED = "Enabled" DISABLED = "Disabled" -class RoleTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RoleTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): IOT = "IOT" ASA = "ASA" @@ -391,14 +376,14 @@ class RoleTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): CLOUD_EDGE_MANAGEMENT = "CloudEdgeManagement" KUBERNETES = "Kubernetes" -class ShareAccessProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareAccessProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Access protocol to be used by the share. """ SMB = "SMB" NFS = "NFS" -class ShareAccessType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareAccessType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of access to be allowed on the share for this user. """ @@ -406,7 +391,7 @@ class ShareAccessType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): READ = "Read" CUSTOM = "Custom" -class ShareStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current status of the share. """ @@ -416,20 +401,20 @@ class ShareStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UPDATING = "Updating" NEEDS_ATTENTION = "NeedsAttention" -class ShipmentType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShipmentType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NOT_APPLICABLE = "NotApplicable" SHIPPED_TO_CUSTOMER = "ShippedToCustomer" SELF_PICKUP = "SelfPickup" -class SkuAvailability(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuAvailability(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Links to the next set of results """ AVAILABLE = "Available" UNAVAILABLE = "Unavailable" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Sku name. """ @@ -459,34 +444,34 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RDC = "RDC" MANAGEMENT = "Management" -class SkuSignupOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuSignupOption(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Sku can be signed up by customer or not. """ NONE = "None" AVAILABLE = "Available" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Sku tier. """ STANDARD = "Standard" -class SkuVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Availability of the Sku as preview/stable. """ STABLE = "Stable" PREVIEW = "Preview" -class SSLStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SSLStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Signifies whether SSL needs to be enabled or not. """ ENABLED = "Enabled" DISABLED = "Disabled" -class StorageAccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current status of the storage account """ @@ -496,7 +481,7 @@ class StorageAccountStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UPDATING = "Updating" NEEDS_ATTENTION = "NeedsAttention" -class SubscriptionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SubscriptionState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REGISTERED = "Registered" WARNED = "Warned" @@ -504,7 +489,7 @@ class SubscriptionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DELETED = "Deleted" UNREGISTERED = "Unregistered" -class TimeGrain(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TimeGrain(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PT1_M = "PT1M" PT5_M = "PT5M" @@ -515,14 +500,14 @@ class TimeGrain(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PT12_H = "PT12H" PT1_D = "PT1D" -class TriggerEventType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TriggerEventType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Trigger Kind. """ FILE_EVENT = "FileEvent" PERIODIC_TIMER_EVENT = "PeriodicTimerEvent" -class UpdateOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpdateOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current update operation. """ @@ -531,7 +516,7 @@ class UpdateOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DOWNLOAD = "Download" INSTALL = "Install" -class UpdateOperationStage(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpdateOperationStage(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Current stage of the update operation. """ @@ -553,7 +538,7 @@ class UpdateOperationStage(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESCAN_COMPLETE = "RescanComplete" RESCAN_FAILED = "RescanFailed" -class UpdateStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpdateStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the update. """ @@ -563,7 +548,7 @@ class UpdateStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): INSTALL_STARTED = "InstallStarted" INSTALL_COMPLETED = "InstallCompleted" -class UpdateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpdateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the Update """ @@ -571,7 +556,7 @@ class UpdateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): KUBERNETES = "Kubernetes" FIRMWARE = "Firmware" -class UserType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UserType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the user. """ diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/models/_models_py3.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/models/_models_py3.py index 646fd8f45498..ef1cfdfeeadf 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/models/_models_py3.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/models/_models_py3.py @@ -43,6 +43,8 @@ def __init__( self, **kwargs ): + """ + """ super(ARMBaseModel, self).__init__(**kwargs) self.id = None self.name = None @@ -65,9 +67,9 @@ class Addon(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Addon type.Constant filled by server. Possible values include: - "IotEdge", "ArcForKubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AddonType + :ivar kind: Required. Addon type.Constant filled by server. Possible values include: "IotEdge", + "ArcForKubernetes". + :vartype kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AddonType :ivar system_data: Addon type. :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData """ @@ -96,6 +98,8 @@ def __init__( self, **kwargs ): + """ + """ super(Addon, self).__init__(**kwargs) self.kind = 'Addon' # type: str self.system_data = None @@ -126,6 +130,8 @@ def __init__( self, **kwargs ): + """ + """ super(AddonList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -136,20 +142,20 @@ class Address(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param address_line1: The address line1. - :type address_line1: str - :param address_line2: The address line2. - :type address_line2: str - :param address_line3: The address line3. - :type address_line3: str - :param postal_code: The postal code. - :type postal_code: str - :param city: The city name. - :type city: str - :param state: The state name. - :type state: str - :param country: Required. The country name. - :type country: str + :ivar address_line1: The address line1. + :vartype address_line1: str + :ivar address_line2: The address line2. + :vartype address_line2: str + :ivar address_line3: The address line3. + :vartype address_line3: str + :ivar postal_code: The postal code. + :vartype postal_code: str + :ivar city: The city name. + :vartype city: str + :ivar state: The state name. + :vartype state: str + :ivar country: Required. The country name. + :vartype country: str """ _validation = { @@ -178,6 +184,22 @@ def __init__( state: Optional[str] = None, **kwargs ): + """ + :keyword address_line1: The address line1. + :paramtype address_line1: str + :keyword address_line2: The address line2. + :paramtype address_line2: str + :keyword address_line3: The address line3. + :paramtype address_line3: str + :keyword postal_code: The postal code. + :paramtype postal_code: str + :keyword city: The city name. + :paramtype city: str + :keyword state: The state name. + :paramtype state: str + :keyword country: Required. The country name. + :paramtype country: str + """ super(Address, self).__init__(**kwargs) self.address_line1 = address_line1 self.address_line2 = address_line2 @@ -250,6 +272,8 @@ def __init__( self, **kwargs ): + """ + """ super(Alert, self).__init__(**kwargs) self.system_data = None self.title = None @@ -290,6 +314,8 @@ def __init__( self, **kwargs ): + """ + """ super(AlertErrorDetails, self).__init__(**kwargs) self.error_code = None self.error_message = None @@ -321,6 +347,8 @@ def __init__( self, **kwargs ): + """ + """ super(AlertList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -339,19 +367,19 @@ class ArcAddon(Addon): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Addon type.Constant filled by server. Possible values include: - "IotEdge", "ArcForKubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AddonType + :ivar kind: Required. Addon type.Constant filled by server. Possible values include: "IotEdge", + "ArcForKubernetes". + :vartype kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AddonType :ivar system_data: Addon type. :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param subscription_id: Required. Arc resource subscription Id. - :type subscription_id: str - :param resource_group_name: Required. Arc resource group name. - :type resource_group_name: str - :param resource_name: Required. Arc resource Name. - :type resource_name: str - :param resource_location: Required. Arc resource location. - :type resource_location: str + :ivar subscription_id: Required. Arc resource subscription Id. + :vartype subscription_id: str + :ivar resource_group_name: Required. Arc resource group name. + :vartype resource_group_name: str + :ivar resource_name: Required. Arc resource Name. + :vartype resource_name: str + :ivar resource_location: Required. Arc resource location. + :vartype resource_location: str :ivar version: Arc resource version. :vartype version: str :ivar host_platform: Host OS supported by the Arc addon. Possible values include: "Windows", @@ -408,6 +436,16 @@ def __init__( resource_location: str, **kwargs ): + """ + :keyword subscription_id: Required. Arc resource subscription Id. + :paramtype subscription_id: str + :keyword resource_group_name: Required. Arc resource group name. + :paramtype resource_group_name: str + :keyword resource_name: Required. Arc resource Name. + :paramtype resource_name: str + :keyword resource_location: Required. Arc resource location. + :paramtype resource_location: str + """ super(ArcAddon, self).__init__(**kwargs) self.kind = 'ArcForKubernetes' # type: str self.subscription_id = subscription_id @@ -425,14 +463,14 @@ class AsymmetricEncryptedSecret(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The value of the secret. - :type value: str - :param encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the + :ivar value: Required. The value of the secret. + :vartype value: str + :ivar encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the value is unencrypted, it will be null. - :type encryption_cert_thumbprint: str - :param encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values + :vartype encryption_cert_thumbprint: str + :ivar encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values include: "None", "AES256", "RSAES_PKCS1_v_1_5". - :type encryption_algorithm: str or + :vartype encryption_algorithm: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.EncryptionAlgorithm """ @@ -455,6 +493,17 @@ def __init__( encryption_cert_thumbprint: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The value of the secret. + :paramtype value: str + :keyword encryption_cert_thumbprint: Thumbprint certificate used to encrypt \"Value\". If the + value is unencrypted, it will be null. + :paramtype encryption_cert_thumbprint: str + :keyword encryption_algorithm: Required. The algorithm used to encrypt "Value". Possible values + include: "None", "AES256", "RSAES_PKCS1_v_1_5". + :paramtype encryption_algorithm: str or + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.EncryptionAlgorithm + """ super(AsymmetricEncryptedSecret, self).__init__(**kwargs) self.value = value self.encryption_cert_thumbprint = encryption_cert_thumbprint @@ -464,8 +513,8 @@ def __init__( class Authentication(msrest.serialization.Model): """Authentication mechanism for IoT devices. - :param symmetric_key: Symmetric key for authentication. - :type symmetric_key: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SymmetricKey + :ivar symmetric_key: Symmetric key for authentication. + :vartype symmetric_key: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SymmetricKey """ _attribute_map = { @@ -478,6 +527,10 @@ def __init__( symmetric_key: Optional["SymmetricKey"] = None, **kwargs ): + """ + :keyword symmetric_key: Symmetric key for authentication. + :paramtype symmetric_key: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SymmetricKey + """ super(Authentication, self).__init__(**kwargs) self.symmetric_key = symmetric_key @@ -487,15 +540,15 @@ class AzureContainerInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param storage_account_credential_id: Required. ID of the storage account credential used to + :ivar storage_account_credential_id: Required. ID of the storage account credential used to access storage. - :type storage_account_credential_id: str - :param container_name: Required. Container name (Based on the data format specified, this + :vartype storage_account_credential_id: str + :ivar container_name: Required. Container name (Based on the data format specified, this represents the name of Azure Files/Page blob/Block blob). - :type container_name: str - :param data_format: Required. Storage format used for the file represented by the share. + :vartype container_name: str + :ivar data_format: Required. Storage format used for the file represented by the share. Possible values include: "BlockBlob", "PageBlob", "AzureFile". - :type data_format: str or + :vartype data_format: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AzureContainerDataFormat """ @@ -519,6 +572,18 @@ def __init__( data_format: Union[str, "AzureContainerDataFormat"], **kwargs ): + """ + :keyword storage_account_credential_id: Required. ID of the storage account credential used to + access storage. + :paramtype storage_account_credential_id: str + :keyword container_name: Required. Container name (Based on the data format specified, this + represents the name of Azure Files/Page blob/Block blob). + :paramtype container_name: str + :keyword data_format: Required. Storage format used for the file represented by the share. + Possible values include: "BlockBlob", "PageBlob", "AzureFile". + :paramtype data_format: str or + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AzureContainerDataFormat + """ super(AzureContainerInfo, self).__init__(**kwargs) self.storage_account_credential_id = storage_account_credential_id self.container_name = container_name @@ -540,14 +605,14 @@ class BandwidthSchedule(ARMBaseModel): :vartype type: str :ivar system_data: Bandwidth object related to ASE resource. :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param start: Required. The start time of the schedule in UTC. - :type start: str - :param stop: Required. The stop time of the schedule in UTC. - :type stop: str - :param rate_in_mbps: Required. The bandwidth rate in Mbps. - :type rate_in_mbps: int - :param days: Required. The days of the week when this schedule is applicable. - :type days: list[str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.DayOfWeek] + :ivar start: Required. The start time of the schedule in UTC. + :vartype start: str + :ivar stop: Required. The stop time of the schedule in UTC. + :vartype stop: str + :ivar rate_in_mbps: Required. The bandwidth rate in Mbps. + :vartype rate_in_mbps: int + :ivar days: Required. The days of the week when this schedule is applicable. + :vartype days: list[str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.DayOfWeek] """ _validation = { @@ -581,6 +646,16 @@ def __init__( days: List[Union[str, "DayOfWeek"]], **kwargs ): + """ + :keyword start: Required. The start time of the schedule in UTC. + :paramtype start: str + :keyword stop: Required. The stop time of the schedule in UTC. + :paramtype stop: str + :keyword rate_in_mbps: Required. The bandwidth rate in Mbps. + :paramtype rate_in_mbps: int + :keyword days: Required. The days of the week when this schedule is applicable. + :paramtype days: list[str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.DayOfWeek] + """ super(BandwidthSchedule, self).__init__(**kwargs) self.system_data = None self.start = start @@ -614,6 +689,8 @@ def __init__( self, **kwargs ): + """ + """ super(BandwidthSchedulesList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -624,11 +701,11 @@ class ClientAccessRight(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param client: Required. IP of the client. - :type client: str - :param access_permission: Required. Type of access to be allowed for the client. Possible - values include: "NoAccess", "ReadOnly", "ReadWrite". - :type access_permission: str or + :ivar client: Required. IP of the client. + :vartype client: str + :ivar access_permission: Required. Type of access to be allowed for the client. Possible values + include: "NoAccess", "ReadOnly", "ReadWrite". + :vartype access_permission: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ClientPermissionType """ @@ -649,6 +726,14 @@ def __init__( access_permission: Union[str, "ClientPermissionType"], **kwargs ): + """ + :keyword client: Required. IP of the client. + :paramtype client: str + :keyword access_permission: Required. Type of access to be allowed for the client. Possible + values include: "NoAccess", "ReadOnly", "ReadWrite". + :paramtype access_permission: str or + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ClientPermissionType + """ super(ClientAccessRight, self).__init__(**kwargs) self.client = client self.access_permission = access_permission @@ -670,9 +755,9 @@ class Role(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleTypes + :vartype kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleTypes :ivar system_data: Role configured on ASE resource. :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData """ @@ -701,6 +786,8 @@ def __init__( self, **kwargs ): + """ + """ super(Role, self).__init__(**kwargs) self.kind = 'Role' # type: str self.system_data = None @@ -719,9 +806,9 @@ class CloudEdgeManagementRole(Role): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleTypes + :vartype kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleTypes :ivar system_data: Role configured on ASE resource. :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData :ivar local_management_status: Local Edge Management Status. Possible values include: @@ -730,8 +817,8 @@ class CloudEdgeManagementRole(Role): ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleStatus :ivar edge_profile: Edge Profile of the resource. :vartype edge_profile: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.EdgeProfile - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleStatus + :ivar role_status: Role status. Possible values include: "Enabled", "Disabled". + :vartype role_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleStatus """ _validation = { @@ -761,6 +848,10 @@ def __init__( role_status: Optional[Union[str, "RoleStatus"]] = None, **kwargs ): + """ + :keyword role_status: Role status. Possible values include: "Enabled", "Disabled". + :paramtype role_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleStatus + """ super(CloudEdgeManagementRole, self).__init__(**kwargs) self.kind = 'CloudEdgeManagement' # type: str self.local_management_status = None @@ -771,14 +862,14 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from the service. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.CloudErrorBody] + :vartype message: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.CloudErrorBody] """ _attribute_map = { @@ -795,6 +886,16 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -834,6 +935,8 @@ def __init__( self, **kwargs ): + """ + """ super(CniConfig, self).__init__(**kwargs) self.type = None self.version = None @@ -846,10 +949,10 @@ class ComputeResource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param processor_count: Required. Processor count. - :type processor_count: int - :param memory_in_gb: Required. Memory in GB. - :type memory_in_gb: long + :ivar processor_count: Required. Processor count. + :vartype processor_count: int + :ivar memory_in_gb: Required. Memory in GB. + :vartype memory_in_gb: long """ _validation = { @@ -869,6 +972,12 @@ def __init__( memory_in_gb: int, **kwargs ): + """ + :keyword processor_count: Required. Processor count. + :paramtype processor_count: int + :keyword memory_in_gb: Required. Memory in GB. + :paramtype memory_in_gb: long + """ super(ComputeResource, self).__init__(**kwargs) self.processor_count = processor_count self.memory_in_gb = memory_in_gb @@ -879,14 +988,14 @@ class ContactDetails(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param contact_person: Required. The contact person name. - :type contact_person: str - :param company_name: Required. The name of the company. - :type company_name: str - :param phone: Required. The phone number. - :type phone: str - :param email_list: Required. The email list. - :type email_list: list[str] + :ivar contact_person: Required. The contact person name. + :vartype contact_person: str + :ivar company_name: Required. The name of the company. + :vartype company_name: str + :ivar phone: Required. The phone number. + :vartype phone: str + :ivar email_list: Required. The email list. + :vartype email_list: list[str] """ _validation = { @@ -912,6 +1021,16 @@ def __init__( email_list: List[str], **kwargs ): + """ + :keyword contact_person: Required. The contact person name. + :paramtype contact_person: str + :keyword company_name: Required. The name of the company. + :paramtype company_name: str + :keyword phone: Required. The phone number. + :paramtype phone: str + :keyword email_list: Required. The email list. + :paramtype email_list: list[str] + """ super(ContactDetails, self).__init__(**kwargs) self.contact_person = contact_person self.company_name = company_name @@ -938,9 +1057,9 @@ class Container(ARMBaseModel): "Offline", "Unknown", "Updating", "NeedsAttention". :vartype container_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ContainerStatus - :param data_format: Required. DataFormat for Container. Possible values include: "BlockBlob", + :ivar data_format: Required. DataFormat for Container. Possible values include: "BlockBlob", "PageBlob", "AzureFile". - :type data_format: str or + :vartype data_format: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AzureContainerDataFormat :ivar refresh_details: Details of the refresh job on this container. :vartype refresh_details: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RefreshDetails @@ -976,6 +1095,12 @@ def __init__( data_format: Union[str, "AzureContainerDataFormat"], **kwargs ): + """ + :keyword data_format: Required. DataFormat for Container. Possible values include: "BlockBlob", + "PageBlob", "AzureFile". + :paramtype data_format: str or + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AzureContainerDataFormat + """ super(Container, self).__init__(**kwargs) self.system_data = None self.container_status = None @@ -1009,6 +1134,8 @@ def __init__( self, **kwargs ): + """ + """ super(ContainerList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1027,29 +1154,29 @@ class DataBoxEdgeDevice(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param location: Required. The location of the device. This is a supported and registered Azure + :ivar location: Required. The location of the device. This is a supported and registered Azure geographical region (for example, West US, East US, or Southeast Asia). The geographical region of a device cannot be changed once it is created, but if an identical geographical region is specified on update, the request will succeed. - :type location: str - :param tags: A set of tags. The list of tags that describe the device. These tags can be used - to view and group this device (across resource groups). - :type tags: dict[str, str] - :param sku: The SKU type. - :type sku: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.Sku - :param etag: The etag for the devices. - :type etag: str - :param identity: Msi identity of the resource. - :type identity: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ResourceIdentity + :vartype location: str + :ivar tags: A set of tags. The list of tags that describe the device. These tags can be used to + view and group this device (across resource groups). + :vartype tags: dict[str, str] + :ivar sku: The SKU type. + :vartype sku: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.Sku + :ivar etag: The etag for the devices. + :vartype etag: str + :ivar identity: Msi identity of the resource. + :vartype identity: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ResourceIdentity :ivar kind: The etag for the devices. Possible values include: "AzureDataBoxGateway", "AzureStackEdge", "AzureStackHub", "AzureModularDataCentre". :vartype kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeDeviceKind :ivar system_data: DataBoxEdge Resource. :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible + :ivar data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible values include: "ReadyToSetup", "Online", "Offline", "NeedsAttention", "Disconnected", "PartiallyDisconnected", "Maintenance". - :type data_box_edge_device_status: str or + :vartype data_box_edge_device_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeDeviceStatus :ivar serial_number: The Serial Number of Data Box Edge/Gateway device. :vartype serial_number: str @@ -1150,6 +1277,27 @@ def __init__( data_box_edge_device_status: Optional[Union[str, "DataBoxEdgeDeviceStatus"]] = None, **kwargs ): + """ + :keyword location: Required. The location of the device. This is a supported and registered + Azure geographical region (for example, West US, East US, or Southeast Asia). The geographical + region of a device cannot be changed once it is created, but if an identical geographical + region is specified on update, the request will succeed. + :paramtype location: str + :keyword tags: A set of tags. The list of tags that describe the device. These tags can be used + to view and group this device (across resource groups). + :paramtype tags: dict[str, str] + :keyword sku: The SKU type. + :paramtype sku: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.Sku + :keyword etag: The etag for the devices. + :paramtype etag: str + :keyword identity: Msi identity of the resource. + :paramtype identity: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ResourceIdentity + :keyword data_box_edge_device_status: The status of the Data Box Edge/Gateway device. Possible + values include: "ReadyToSetup", "Online", "Offline", "NeedsAttention", "Disconnected", + "PartiallyDisconnected", "Maintenance". + :paramtype data_box_edge_device_status: str or + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeDeviceStatus + """ super(DataBoxEdgeDevice, self).__init__(**kwargs) self.location = location self.tags = tags @@ -1187,27 +1335,27 @@ class DataBoxEdgeDeviceExtendedInfo(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param encryption_key_thumbprint: The digital signature of encrypted certificate. - :type encryption_key_thumbprint: str - :param encryption_key: The public part of the encryption certificate. Client uses this to + :ivar encryption_key_thumbprint: The digital signature of encrypted certificate. + :vartype encryption_key_thumbprint: str + :ivar encryption_key: The public part of the encryption certificate. Client uses this to encrypt any secret. - :type encryption_key: str + :vartype encryption_key: str :ivar resource_key: The Resource ID of the Resource. :vartype resource_key: str - :param client_secret_store_id: The Key Vault ARM Id for client secrets. - :type client_secret_store_id: str - :param client_secret_store_url: The url to access the Client Key Vault. - :type client_secret_store_url: str - :param channel_integrity_key_name: The name of Channel Integrity Key stored in the Client Key + :ivar client_secret_store_id: The Key Vault ARM Id for client secrets. + :vartype client_secret_store_id: str + :ivar client_secret_store_url: The url to access the Client Key Vault. + :vartype client_secret_store_url: str + :ivar channel_integrity_key_name: The name of Channel Integrity Key stored in the Client Key Vault. - :type channel_integrity_key_name: str - :param channel_integrity_key_version: The version of Channel Integrity Key stored in the Client + :vartype channel_integrity_key_name: str + :ivar channel_integrity_key_version: The version of Channel Integrity Key stored in the Client Key Vault. - :type channel_integrity_key_version: str - :param key_vault_sync_status: Key vault sync status. Possible values include: "KeyVaultSynced", + :vartype channel_integrity_key_version: str + :ivar key_vault_sync_status: Key vault sync status. Possible values include: "KeyVaultSynced", "KeyVaultSyncFailed", "KeyVaultNotConfigured", "KeyVaultSyncPending", "KeyVaultSyncing", "KeyVaultNotSynced". - :type key_vault_sync_status: str or + :vartype key_vault_sync_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.KeyVaultSyncStatus :ivar device_secrets: Device secrets, will be returned only with ODataFilter $expand=deviceSecrets. @@ -1249,6 +1397,28 @@ def __init__( key_vault_sync_status: Optional[Union[str, "KeyVaultSyncStatus"]] = None, **kwargs ): + """ + :keyword encryption_key_thumbprint: The digital signature of encrypted certificate. + :paramtype encryption_key_thumbprint: str + :keyword encryption_key: The public part of the encryption certificate. Client uses this to + encrypt any secret. + :paramtype encryption_key: str + :keyword client_secret_store_id: The Key Vault ARM Id for client secrets. + :paramtype client_secret_store_id: str + :keyword client_secret_store_url: The url to access the Client Key Vault. + :paramtype client_secret_store_url: str + :keyword channel_integrity_key_name: The name of Channel Integrity Key stored in the Client Key + Vault. + :paramtype channel_integrity_key_name: str + :keyword channel_integrity_key_version: The version of Channel Integrity Key stored in the + Client Key Vault. + :paramtype channel_integrity_key_version: str + :keyword key_vault_sync_status: Key vault sync status. Possible values include: + "KeyVaultSynced", "KeyVaultSyncFailed", "KeyVaultNotConfigured", "KeyVaultSyncPending", + "KeyVaultSyncing", "KeyVaultNotSynced". + :paramtype key_vault_sync_status: str or + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.KeyVaultSyncStatus + """ super(DataBoxEdgeDeviceExtendedInfo, self).__init__(**kwargs) self.encryption_key_thumbprint = encryption_key_thumbprint self.encryption_key = encryption_key @@ -1264,21 +1434,22 @@ def __init__( class DataBoxEdgeDeviceExtendedInfoPatch(msrest.serialization.Model): """The Data Box Edge/Gateway device extended info patch. - :param client_secret_store_id: The Key Vault ARM Id for client secrets. - :type client_secret_store_id: str - :param client_secret_store_url: The url to access the Client Key Vault. - :type client_secret_store_url: str - :param channel_integrity_key_name: The name for Channel Integrity Key stored in the Client Key + :ivar client_secret_store_id: The Key Vault ARM Id for client secrets. + :vartype client_secret_store_id: str + :ivar client_secret_store_url: The url to access the Client Key Vault. + :vartype client_secret_store_url: str + :ivar channel_integrity_key_name: The name for Channel Integrity Key stored in the Client Key Vault. - :type channel_integrity_key_name: str - :param channel_integrity_key_version: The version of Channel Integrity Key stored in the Client + :vartype channel_integrity_key_name: str + :ivar channel_integrity_key_version: The version of Channel Integrity Key stored in the Client Key Vault. - :type channel_integrity_key_version: str - :param sync_status: For changing or to initiate the resync to key-vault set the status to + :vartype channel_integrity_key_version: str + :ivar sync_status: For changing or to initiate the resync to key-vault set the status to KeyVaultSyncPending, rest of the status will not be applicable. Possible values include: "KeyVaultSynced", "KeyVaultSyncFailed", "KeyVaultNotConfigured", "KeyVaultSyncPending", "KeyVaultSyncing", "KeyVaultNotSynced". - :type sync_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.KeyVaultSyncStatus + :vartype sync_status: str or + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.KeyVaultSyncStatus """ _attribute_map = { @@ -1299,6 +1470,24 @@ def __init__( sync_status: Optional[Union[str, "KeyVaultSyncStatus"]] = None, **kwargs ): + """ + :keyword client_secret_store_id: The Key Vault ARM Id for client secrets. + :paramtype client_secret_store_id: str + :keyword client_secret_store_url: The url to access the Client Key Vault. + :paramtype client_secret_store_url: str + :keyword channel_integrity_key_name: The name for Channel Integrity Key stored in the Client + Key Vault. + :paramtype channel_integrity_key_name: str + :keyword channel_integrity_key_version: The version of Channel Integrity Key stored in the + Client Key Vault. + :paramtype channel_integrity_key_version: str + :keyword sync_status: For changing or to initiate the resync to key-vault set the status to + KeyVaultSyncPending, rest of the status will not be applicable. Possible values include: + "KeyVaultSynced", "KeyVaultSyncFailed", "KeyVaultNotConfigured", "KeyVaultSyncPending", + "KeyVaultSyncing", "KeyVaultNotSynced". + :paramtype sync_status: str or + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.KeyVaultSyncStatus + """ super(DataBoxEdgeDeviceExtendedInfoPatch, self).__init__(**kwargs) self.client_secret_store_id = client_secret_store_id self.client_secret_store_url = client_secret_store_url @@ -1332,6 +1521,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataBoxEdgeDeviceList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1340,12 +1531,12 @@ def __init__( class DataBoxEdgeDevicePatch(msrest.serialization.Model): """The Data Box Edge/Gateway device patch. - :param tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. - :type tags: dict[str, str] - :param identity: Msi identity of the resource. - :type identity: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ResourceIdentity - :param edge_profile: Edge Profile property of the Data Box Edge/Gateway device. - :type edge_profile: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.EdgeProfilePatch + :ivar tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. + :vartype tags: dict[str, str] + :ivar identity: Msi identity of the resource. + :vartype identity: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ResourceIdentity + :ivar edge_profile: Edge Profile property of the Data Box Edge/Gateway device. + :vartype edge_profile: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.EdgeProfilePatch """ _attribute_map = { @@ -1362,6 +1553,14 @@ def __init__( edge_profile: Optional["EdgeProfilePatch"] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags attached to the Data Box Edge/Gateway resource. + :paramtype tags: dict[str, str] + :keyword identity: Msi identity of the resource. + :paramtype identity: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ResourceIdentity + :keyword edge_profile: Edge Profile property of the Data Box Edge/Gateway device. + :paramtype edge_profile: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.EdgeProfilePatch + """ super(DataBoxEdgeDevicePatch, self).__init__(**kwargs) self.tags = tags self.identity = identity @@ -1373,10 +1572,10 @@ class DataBoxEdgeMoveRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param target_resource_group: Required. Target resource group ARMId. - :type target_resource_group: str - :param resources: Required. List of resources to be moved. - :type resources: list[str] + :ivar target_resource_group: Required. Target resource group ARMId. + :vartype target_resource_group: str + :ivar resources: Required. List of resources to be moved. + :vartype resources: list[str] """ _validation = { @@ -1396,6 +1595,12 @@ def __init__( resources: List[str], **kwargs ): + """ + :keyword target_resource_group: Required. Target resource group ARMId. + :paramtype target_resource_group: str + :keyword resources: Required. List of resources to be moved. + :paramtype resources: list[str] + """ super(DataBoxEdgeMoveRequest, self).__init__(**kwargs) self.target_resource_group = target_resource_group self.resources = resources @@ -1445,6 +1650,8 @@ class DataBoxEdgeSku(msrest.serialization.Model): :ivar shipment_types: List of Shipment Types supported by this SKU. :vartype shipment_types: list[str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ShipmentType] + :ivar capabilities: The capability info of the SKU. + :vartype capabilities: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.SkuCapability] """ _validation = { @@ -1462,6 +1669,7 @@ class DataBoxEdgeSku(msrest.serialization.Model): 'version': {'readonly': True}, 'availability': {'readonly': True}, 'shipment_types': {'readonly': True}, + 'capabilities': {'readonly': True}, } _attribute_map = { @@ -1479,12 +1687,15 @@ class DataBoxEdgeSku(msrest.serialization.Model): 'version': {'key': 'version', 'type': 'str'}, 'availability': {'key': 'availability', 'type': 'str'}, 'shipment_types': {'key': 'shipmentTypes', 'type': '[str]'}, + 'capabilities': {'key': 'capabilities', 'type': '[SkuCapability]'}, } def __init__( self, **kwargs ): + """ + """ super(DataBoxEdgeSku, self).__init__(**kwargs) self.resource_type = None self.name = None @@ -1500,6 +1711,7 @@ def __init__( self.version = None self.availability = None self.shipment_types = None + self.capabilities = None class DataBoxEdgeSkuList(msrest.serialization.Model): @@ -1527,6 +1739,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataBoxEdgeSkuList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1535,8 +1749,8 @@ def __init__( class DCAccessCode(msrest.serialization.Model): """DC Access code in the case of Self Managed Shipping. - :param auth_code: DCAccess Code for the Self Managed shipment. - :type auth_code: str + :ivar auth_code: DCAccess Code for the Self Managed shipment. + :vartype auth_code: str """ _attribute_map = { @@ -1549,6 +1763,10 @@ def __init__( auth_code: Optional[str] = None, **kwargs ): + """ + :keyword auth_code: DCAccess Code for the Self Managed shipment. + :paramtype auth_code: str + """ super(DCAccessCode, self).__init__(**kwargs) self.auth_code = auth_code @@ -1556,8 +1774,9 @@ def __init__( class EdgeProfile(msrest.serialization.Model): """Details about Edge Profile for the resource. - :param subscription: Edge Profile Subscription. - :type subscription: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.EdgeProfileSubscription + :ivar subscription: Edge Profile Subscription. + :vartype subscription: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.EdgeProfileSubscription """ _attribute_map = { @@ -1570,6 +1789,11 @@ def __init__( subscription: Optional["EdgeProfileSubscription"] = None, **kwargs ): + """ + :keyword subscription: Edge Profile Subscription. + :paramtype subscription: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.EdgeProfileSubscription + """ super(EdgeProfile, self).__init__(**kwargs) self.subscription = subscription @@ -1577,8 +1801,8 @@ def __init__( class EdgeProfilePatch(msrest.serialization.Model): """The Data Box Edge/Gateway Edge Profile patch. - :param subscription: The Data Box Edge/Gateway Edge Profile Subscription patch. - :type subscription: + :ivar subscription: The Data Box Edge/Gateway Edge Profile Subscription patch. + :vartype subscription: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.EdgeProfileSubscriptionPatch """ @@ -1592,6 +1816,11 @@ def __init__( subscription: Optional["EdgeProfileSubscriptionPatch"] = None, **kwargs ): + """ + :keyword subscription: The Data Box Edge/Gateway Edge Profile Subscription patch. + :paramtype subscription: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.EdgeProfileSubscriptionPatch + """ super(EdgeProfilePatch, self).__init__(**kwargs) self.subscription = subscription @@ -1599,27 +1828,27 @@ def __init__( class EdgeProfileSubscription(msrest.serialization.Model): """Subscription details for the Edge Profile. - :param registration_id: Edge Subscription Registration ID. - :type registration_id: str - :param id: ARM ID of the subscription. - :type id: str - :param state: Possible values include: "Registered", "Warned", "Suspended", "Deleted", + :ivar registration_id: Edge Subscription Registration ID. + :vartype registration_id: str + :ivar id: ARM ID of the subscription. + :vartype id: str + :ivar state: Possible values include: "Registered", "Warned", "Suspended", "Deleted", "Unregistered". - :type state: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SubscriptionState - :param registration_date: - :type registration_date: str - :param subscription_id: - :type subscription_id: str - :param tenant_id: - :type tenant_id: str - :param location_placement_id: - :type location_placement_id: str - :param quota_id: - :type quota_id: str - :param serialized_details: - :type serialized_details: str - :param registered_features: - :type registered_features: + :vartype state: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SubscriptionState + :ivar registration_date: + :vartype registration_date: str + :ivar subscription_id: + :vartype subscription_id: str + :ivar tenant_id: + :vartype tenant_id: str + :ivar location_placement_id: + :vartype location_placement_id: str + :ivar quota_id: + :vartype quota_id: str + :ivar serialized_details: + :vartype serialized_details: str + :ivar registered_features: + :vartype registered_features: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.SubscriptionRegisteredFeatures] """ @@ -1651,6 +1880,30 @@ def __init__( registered_features: Optional[List["SubscriptionRegisteredFeatures"]] = None, **kwargs ): + """ + :keyword registration_id: Edge Subscription Registration ID. + :paramtype registration_id: str + :keyword id: ARM ID of the subscription. + :paramtype id: str + :keyword state: Possible values include: "Registered", "Warned", "Suspended", "Deleted", + "Unregistered". + :paramtype state: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SubscriptionState + :keyword registration_date: + :paramtype registration_date: str + :keyword subscription_id: + :paramtype subscription_id: str + :keyword tenant_id: + :paramtype tenant_id: str + :keyword location_placement_id: + :paramtype location_placement_id: str + :keyword quota_id: + :paramtype quota_id: str + :keyword serialized_details: + :paramtype serialized_details: str + :keyword registered_features: + :paramtype registered_features: + list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.SubscriptionRegisteredFeatures] + """ super(EdgeProfileSubscription, self).__init__(**kwargs) self.registration_id = registration_id self.id = id @@ -1667,8 +1920,8 @@ def __init__( class EdgeProfileSubscriptionPatch(msrest.serialization.Model): """The Data Box Edge/Gateway Edge Profile Subscription patch. - :param id: The path ID that uniquely identifies the subscription of the edge profile. - :type id: str + :ivar id: The path ID that uniquely identifies the subscription of the edge profile. + :vartype id: str """ _attribute_map = { @@ -1681,6 +1934,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The path ID that uniquely identifies the subscription of the edge profile. + :paramtype id: str + """ super(EdgeProfileSubscriptionPatch, self).__init__(**kwargs) self.id = id @@ -1710,6 +1967,8 @@ def __init__( self, **kwargs ): + """ + """ super(EtcdInfo, self).__init__(**kwargs) self.type = None self.version = None @@ -1733,9 +1992,9 @@ class Trigger(ARMBaseModel): :vartype type: str :ivar system_data: Trigger in DataBoxEdge Resource. :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: + :ivar kind: Required. Trigger Kind.Constant filled by server. Possible values include: "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.TriggerEventType + :vartype kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.TriggerEventType """ _validation = { @@ -1762,6 +2021,8 @@ def __init__( self, **kwargs ): + """ + """ super(Trigger, self).__init__(**kwargs) self.system_data = None self.kind = 'Trigger' # type: str @@ -1782,17 +2043,17 @@ class FileEventTrigger(Trigger): :vartype type: str :ivar system_data: Trigger in DataBoxEdge Resource. :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: + :ivar kind: Required. Trigger Kind.Constant filled by server. Possible values include: "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.TriggerEventType - :param source_info: Required. File event source details. - :type source_info: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.FileSourceInfo - :param sink_info: Required. Role sink info. - :type sink_info: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against + :vartype kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.TriggerEventType + :ivar source_info: Required. File event source details. + :vartype source_info: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.FileSourceInfo + :ivar sink_info: Required. Role sink info. + :vartype sink_info: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleSinkInfo + :ivar custom_context_tag: A custom context tag typically used to correlate the trigger against its usage. For example, if a periodic timer trigger is intended for certain specific IoT modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str + :vartype custom_context_tag: str """ _validation = { @@ -1825,6 +2086,16 @@ def __init__( custom_context_tag: Optional[str] = None, **kwargs ): + """ + :keyword source_info: Required. File event source details. + :paramtype source_info: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.FileSourceInfo + :keyword sink_info: Required. Role sink info. + :paramtype sink_info: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleSinkInfo + :keyword custom_context_tag: A custom context tag typically used to correlate the trigger + against its usage. For example, if a periodic timer trigger is intended for certain specific + IoT modules in the device, the tag can be the name or the image URL of the module. + :paramtype custom_context_tag: str + """ super(FileEventTrigger, self).__init__(**kwargs) self.kind = 'FileEvent' # type: str self.source_info = source_info @@ -1837,8 +2108,8 @@ class FileSourceInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param share_id: Required. File share ID. - :type share_id: str + :ivar share_id: Required. File share ID. + :vartype share_id: str """ _validation = { @@ -1855,6 +2126,10 @@ def __init__( share_id: str, **kwargs ): + """ + :keyword share_id: Required. File share ID. + :paramtype share_id: str + """ super(FileSourceInfo, self).__init__(**kwargs) self.share_id = share_id @@ -1862,14 +2137,14 @@ def __init__( class GenerateCertResponse(msrest.serialization.Model): """Used in activation key generation flow. - :param public_key: Gets or sets base64 encoded certificate raw data, + :ivar public_key: Gets or sets base64 encoded certificate raw data, this is the public part needed to be uploaded to cert vault. - :type public_key: str - :param private_key: Gets or sets base64 encoded private part of the certificate, + :vartype public_key: str + :ivar private_key: Gets or sets base64 encoded private part of the certificate, needed to form the activation key. - :type private_key: str - :param expiry_time_in_utc: Gets or sets expiry time in UTC. - :type expiry_time_in_utc: str + :vartype private_key: str + :ivar expiry_time_in_utc: Gets or sets expiry time in UTC. + :vartype expiry_time_in_utc: str """ _attribute_map = { @@ -1886,6 +2161,16 @@ def __init__( expiry_time_in_utc: Optional[str] = None, **kwargs ): + """ + :keyword public_key: Gets or sets base64 encoded certificate raw data, + this is the public part needed to be uploaded to cert vault. + :paramtype public_key: str + :keyword private_key: Gets or sets base64 encoded private part of the certificate, + needed to form the activation key. + :paramtype private_key: str + :keyword expiry_time_in_utc: Gets or sets expiry time in UTC. + :paramtype expiry_time_in_utc: str + """ super(GenerateCertResponse, self).__init__(**kwargs) self.public_key = public_key self.private_key = private_key @@ -1897,12 +2182,12 @@ class ImageRepositoryCredential(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param image_repository_url: Required. Image repository url (e.g.: mcr.microsoft.com). - :type image_repository_url: str - :param user_name: Required. Repository user name. - :type user_name: str - :param password: Repository user password. - :type password: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AsymmetricEncryptedSecret + :ivar image_repository_url: Required. Image repository url (e.g.: mcr.microsoft.com). + :vartype image_repository_url: str + :ivar user_name: Required. Repository user name. + :vartype user_name: str + :ivar password: Repository user password. + :vartype password: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AsymmetricEncryptedSecret """ _validation = { @@ -1924,6 +2209,15 @@ def __init__( password: Optional["AsymmetricEncryptedSecret"] = None, **kwargs ): + """ + :keyword image_repository_url: Required. Image repository url (e.g.: mcr.microsoft.com). + :paramtype image_repository_url: str + :keyword user_name: Required. Repository user name. + :paramtype user_name: str + :keyword password: Repository user password. + :paramtype password: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AsymmetricEncryptedSecret + """ super(ImageRepositoryCredential, self).__init__(**kwargs) self.image_repository_url = image_repository_url self.user_name = user_name @@ -1943,17 +2237,17 @@ class IoTAddon(Addon): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Addon type.Constant filled by server. Possible values include: - "IotEdge", "ArcForKubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AddonType + :ivar kind: Required. Addon type.Constant filled by server. Possible values include: "IotEdge", + "ArcForKubernetes". + :vartype kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AddonType :ivar system_data: Addon type. :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param io_t_device_details: Required. IoT device metadata to which appliance needs to be + :ivar io_t_device_details: Required. IoT device metadata to which appliance needs to be connected. - :type io_t_device_details: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.IoTDeviceInfo - :param io_t_edge_device_details: Required. IoT edge device to which the IoT Addon needs to be + :vartype io_t_device_details: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.IoTDeviceInfo + :ivar io_t_edge_device_details: Required. IoT edge device to which the IoT Addon needs to be configured. - :type io_t_edge_device_details: + :vartype io_t_edge_device_details: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.IoTDeviceInfo :ivar version: Version of IoT running on the appliance. :vartype version: str @@ -2005,6 +2299,16 @@ def __init__( io_t_edge_device_details: "IoTDeviceInfo", **kwargs ): + """ + :keyword io_t_device_details: Required. IoT device metadata to which appliance needs to be + connected. + :paramtype io_t_device_details: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.IoTDeviceInfo + :keyword io_t_edge_device_details: Required. IoT edge device to which the IoT Addon needs to be + configured. + :paramtype io_t_edge_device_details: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.IoTDeviceInfo + """ super(IoTAddon, self).__init__(**kwargs) self.kind = 'IotEdge' # type: str self.io_t_device_details = io_t_device_details @@ -2020,14 +2324,14 @@ class IoTDeviceInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param device_id: Required. ID of the IoT device/edge device. - :type device_id: str - :param io_t_host_hub: Required. Host name for the IoT hub associated to the device. - :type io_t_host_hub: str - :param io_t_host_hub_id: Id for the IoT hub associated to the device. - :type io_t_host_hub_id: str - :param authentication: Encrypted IoT device/IoT edge device connection string. - :type authentication: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.Authentication + :ivar device_id: Required. ID of the IoT device/edge device. + :vartype device_id: str + :ivar io_t_host_hub: Required. Host name for the IoT hub associated to the device. + :vartype io_t_host_hub: str + :ivar io_t_host_hub_id: Id for the IoT hub associated to the device. + :vartype io_t_host_hub_id: str + :ivar authentication: Encrypted IoT device/IoT edge device connection string. + :vartype authentication: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.Authentication """ _validation = { @@ -2051,6 +2355,16 @@ def __init__( authentication: Optional["Authentication"] = None, **kwargs ): + """ + :keyword device_id: Required. ID of the IoT device/edge device. + :paramtype device_id: str + :keyword io_t_host_hub: Required. Host name for the IoT hub associated to the device. + :paramtype io_t_host_hub: str + :keyword io_t_host_hub_id: Id for the IoT hub associated to the device. + :paramtype io_t_host_hub_id: str + :keyword authentication: Encrypted IoT device/IoT edge device connection string. + :paramtype authentication: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.Authentication + """ super(IoTDeviceInfo, self).__init__(**kwargs) self.device_id = device_id self.io_t_host_hub = io_t_host_hub @@ -2063,12 +2377,12 @@ class IoTEdgeAgentInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param image_name: Required. Name of the IoT edge agent image. - :type image_name: str - :param tag: Required. Image Tag. - :type tag: str - :param image_repository: Image repository details. - :type image_repository: + :ivar image_name: Required. Name of the IoT edge agent image. + :vartype image_name: str + :ivar tag: Required. Image Tag. + :vartype tag: str + :ivar image_repository: Image repository details. + :vartype image_repository: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ImageRepositoryCredential """ @@ -2091,6 +2405,15 @@ def __init__( image_repository: Optional["ImageRepositoryCredential"] = None, **kwargs ): + """ + :keyword image_name: Required. Name of the IoT edge agent image. + :paramtype image_name: str + :keyword tag: Required. Image Tag. + :paramtype tag: str + :keyword image_repository: Image repository details. + :paramtype image_repository: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ImageRepositoryCredential + """ super(IoTEdgeAgentInfo, self).__init__(**kwargs) self.image_name = image_name self.tag = tag @@ -2110,33 +2433,34 @@ class IoTRole(Role): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleTypes + :vartype kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleTypes :ivar system_data: Role configured on ASE resource. :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param host_platform: Host OS supported by the IoT role. Possible values include: "Windows", + :ivar host_platform: Host OS supported by the IoT role. Possible values include: "Windows", "Linux". - :type host_platform: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.PlatformType - :param io_t_device_details: IoT device metadata to which data box edge device needs to be + :vartype host_platform: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.PlatformType + :ivar io_t_device_details: IoT device metadata to which data box edge device needs to be connected. - :type io_t_device_details: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.IoTDeviceInfo - :param io_t_edge_device_details: IoT edge device to which the IoT role needs to be configured. - :type io_t_edge_device_details: + :vartype io_t_device_details: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.IoTDeviceInfo + :ivar io_t_edge_device_details: IoT edge device to which the IoT role needs to be configured. + :vartype io_t_edge_device_details: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.IoTDeviceInfo - :param share_mappings: Mount points of shares in role(s). - :type share_mappings: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MountPointMap] - :param io_t_edge_agent_info: Iot edge agent details to download the agent and bootstrap iot + :ivar share_mappings: Mount points of shares in role(s). + :vartype share_mappings: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MountPointMap] + :ivar io_t_edge_agent_info: Iot edge agent details to download the agent and bootstrap iot runtime. - :type io_t_edge_agent_info: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.IoTEdgeAgentInfo + :vartype io_t_edge_agent_info: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.IoTEdgeAgentInfo :ivar host_platform_type: Platform where the Iot runtime is hosted. Possible values include: "KubernetesCluster", "LinuxVM". :vartype host_platform_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.HostPlatformType - :param compute_resource: Resource allocation. - :type compute_resource: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ComputeResource - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleStatus + :ivar compute_resource: Resource allocation. + :vartype compute_resource: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ComputeResource + :ivar role_status: Role status. Possible values include: "Enabled", "Disabled". + :vartype role_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleStatus """ _validation = { @@ -2176,6 +2500,31 @@ def __init__( role_status: Optional[Union[str, "RoleStatus"]] = None, **kwargs ): + """ + :keyword host_platform: Host OS supported by the IoT role. Possible values include: "Windows", + "Linux". + :paramtype host_platform: str or + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.PlatformType + :keyword io_t_device_details: IoT device metadata to which data box edge device needs to be + connected. + :paramtype io_t_device_details: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.IoTDeviceInfo + :keyword io_t_edge_device_details: IoT edge device to which the IoT role needs to be + configured. + :paramtype io_t_edge_device_details: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.IoTDeviceInfo + :keyword share_mappings: Mount points of shares in role(s). + :paramtype share_mappings: + list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MountPointMap] + :keyword io_t_edge_agent_info: Iot edge agent details to download the agent and bootstrap iot + runtime. + :paramtype io_t_edge_agent_info: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.IoTEdgeAgentInfo + :keyword compute_resource: Resource allocation. + :paramtype compute_resource: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ComputeResource + :keyword role_status: Role status. Possible values include: "Enabled", "Disabled". + :paramtype role_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleStatus + """ super(IoTRole, self).__init__(**kwargs) self.kind = 'IOT' # type: str self.host_platform = host_platform @@ -2217,6 +2566,8 @@ def __init__( self, **kwargs ): + """ + """ super(Ipv4Config, self).__init__(**kwargs) self.ip_address = None self.subnet = None @@ -2252,6 +2603,8 @@ def __init__( self, **kwargs ): + """ + """ super(Ipv6Config, self).__init__(**kwargs) self.ip_address = None self.prefix_length = None @@ -2303,9 +2656,9 @@ class Job(msrest.serialization.Model): :vartype error_manifest_file: str :ivar refreshed_entity_id: ARM ID of the entity that was refreshed. :vartype refreshed_entity_id: str - :param folder: If only subfolders need to be refreshed, then the subfolder path inside the - share or container. (The path is empty if there are no subfolders.). - :type folder: str + :ivar folder: If only subfolders need to be refreshed, then the subfolder path inside the share + or container. (The path is empty if there are no subfolders.). + :vartype folder: str """ _validation = { @@ -2351,6 +2704,11 @@ def __init__( folder: Optional[str] = None, **kwargs ): + """ + :keyword folder: If only subfolders need to be refreshed, then the subfolder path inside the + share or container. (The path is empty if there are no subfolders.). + :paramtype folder: str + """ super(Job, self).__init__(**kwargs) self.id = None self.name = None @@ -2399,6 +2757,8 @@ def __init__( self, **kwargs ): + """ + """ super(JobErrorDetails, self).__init__(**kwargs) self.error_details = None self.code = None @@ -2434,6 +2794,8 @@ def __init__( self, **kwargs ): + """ + """ super(JobErrorItem, self).__init__(**kwargs) self.recommendations = None self.code = None @@ -2451,8 +2813,8 @@ class KubernetesClusterInfo(msrest.serialization.Model): :vartype etcd_info: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.EtcdInfo :ivar nodes: Kubernetes cluster nodes. :vartype nodes: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.NodeInfo] - :param version: Required. Kubernetes cluster version. - :type version: str + :ivar version: Required. Kubernetes cluster version. + :vartype version: str """ _validation = { @@ -2473,6 +2835,10 @@ def __init__( version: str, **kwargs ): + """ + :keyword version: Required. Kubernetes cluster version. + :paramtype version: str + """ super(KubernetesClusterInfo, self).__init__(**kwargs) self.etcd_info = None self.nodes = None @@ -2486,8 +2852,8 @@ class KubernetesIPConfiguration(msrest.serialization.Model): :ivar port: Port of the Kubernetes node. :vartype port: str - :param ip_address: IP address of the Kubernetes node. - :type ip_address: str + :ivar ip_address: IP address of the Kubernetes node. + :vartype ip_address: str """ _validation = { @@ -2505,6 +2871,10 @@ def __init__( ip_address: Optional[str] = None, **kwargs ): + """ + :keyword ip_address: IP address of the Kubernetes node. + :paramtype ip_address: str + """ super(KubernetesIPConfiguration, self).__init__(**kwargs) self.port = None self.ip_address = ip_address @@ -2523,14 +2893,14 @@ class KubernetesRole(Role): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleTypes + :vartype kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleTypes :ivar system_data: Role configured on ASE resource. :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param host_platform: Host OS supported by the Kubernetes role. Possible values include: + :ivar host_platform: Host OS supported by the Kubernetes role. Possible values include: "Windows", "Linux". - :type host_platform: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.PlatformType + :vartype host_platform: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.PlatformType :ivar provisioning_state: State of Kubernetes deployment. Possible values include: "Invalid", "Creating", "Created", "Updating", "Reconfiguring", "Failed", "Deleting". :vartype provisioning_state: str or @@ -2539,14 +2909,14 @@ class KubernetesRole(Role): "KubernetesCluster", "LinuxVM". :vartype host_platform_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.HostPlatformType - :param kubernetes_cluster_info: Kubernetes cluster configuration. - :type kubernetes_cluster_info: + :ivar kubernetes_cluster_info: Kubernetes cluster configuration. + :vartype kubernetes_cluster_info: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.KubernetesClusterInfo - :param kubernetes_role_resources: Kubernetes role resources. - :type kubernetes_role_resources: + :ivar kubernetes_role_resources: Kubernetes role resources. + :vartype kubernetes_role_resources: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.KubernetesRoleResources - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleStatus + :ivar role_status: Role status. Possible values include: "Enabled", "Disabled". + :vartype role_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleStatus """ _validation = { @@ -2582,6 +2952,20 @@ def __init__( role_status: Optional[Union[str, "RoleStatus"]] = None, **kwargs ): + """ + :keyword host_platform: Host OS supported by the Kubernetes role. Possible values include: + "Windows", "Linux". + :paramtype host_platform: str or + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.PlatformType + :keyword kubernetes_cluster_info: Kubernetes cluster configuration. + :paramtype kubernetes_cluster_info: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.KubernetesClusterInfo + :keyword kubernetes_role_resources: Kubernetes role resources. + :paramtype kubernetes_role_resources: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.KubernetesRoleResources + :keyword role_status: Role status. Possible values include: "Enabled", "Disabled". + :paramtype role_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleStatus + """ super(KubernetesRole, self).__init__(**kwargs) self.kind = 'Kubernetes' # type: str self.host_platform = host_platform @@ -2599,8 +2983,8 @@ class KubernetesRoleCompute(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param vm_profile: Required. VM profile. - :type vm_profile: str + :ivar vm_profile: Required. VM profile. + :vartype vm_profile: str :ivar memory_in_bytes: Memory in bytes. :vartype memory_in_bytes: long :ivar processor_count: Processor count. @@ -2625,6 +3009,10 @@ def __init__( vm_profile: str, **kwargs ): + """ + :keyword vm_profile: Required. VM profile. + :paramtype vm_profile: str + """ super(KubernetesRoleCompute, self).__init__(**kwargs) self.vm_profile = vm_profile self.memory_in_bytes = None @@ -2657,6 +3045,8 @@ def __init__( self, **kwargs ): + """ + """ super(KubernetesRoleNetwork, self).__init__(**kwargs) self.cni_config = None self.load_balancer_config = None @@ -2669,10 +3059,10 @@ class KubernetesRoleResources(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param storage: Kubernetes role storage resource. - :type storage: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.KubernetesRoleStorage - :param compute: Required. Kubernetes role compute resource. - :type compute: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.KubernetesRoleCompute + :ivar storage: Kubernetes role storage resource. + :vartype storage: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.KubernetesRoleStorage + :ivar compute: Required. Kubernetes role compute resource. + :vartype compute: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.KubernetesRoleCompute :ivar network: Kubernetes role network resource. :vartype network: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.KubernetesRoleNetwork """ @@ -2695,6 +3085,12 @@ def __init__( storage: Optional["KubernetesRoleStorage"] = None, **kwargs ): + """ + :keyword storage: Kubernetes role storage resource. + :paramtype storage: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.KubernetesRoleStorage + :keyword compute: Required. Kubernetes role compute resource. + :paramtype compute: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.KubernetesRoleCompute + """ super(KubernetesRoleResources, self).__init__(**kwargs) self.storage = storage self.compute = compute @@ -2709,8 +3105,8 @@ class KubernetesRoleStorage(msrest.serialization.Model): :ivar storage_classes: Kubernetes storage class info. :vartype storage_classes: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.KubernetesRoleStorageClassInfo] - :param endpoints: Mount points of shares in role(s). - :type endpoints: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MountPointMap] + :ivar endpoints: Mount points of shares in role(s). + :vartype endpoints: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MountPointMap] """ _validation = { @@ -2728,6 +3124,10 @@ def __init__( endpoints: Optional[List["MountPointMap"]] = None, **kwargs ): + """ + :keyword endpoints: Mount points of shares in role(s). + :paramtype endpoints: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MountPointMap] + """ super(KubernetesRoleStorage, self).__init__(**kwargs) self.storage_classes = None self.endpoints = endpoints @@ -2764,6 +3164,8 @@ def __init__( self, **kwargs ): + """ + """ super(KubernetesRoleStorageClassInfo, self).__init__(**kwargs) self.name = None self.type = None @@ -2795,6 +3197,8 @@ def __init__( self, **kwargs ): + """ + """ super(LoadBalancerConfig, self).__init__(**kwargs) self.type = None self.version = None @@ -2813,20 +3217,20 @@ class MECRole(Role): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param kind: Required. Role type.Constant filled by server. Possible values include: "IOT", + :ivar kind: Required. Role type.Constant filled by server. Possible values include: "IOT", "ASA", "Functions", "Cognitive", "MEC", "CloudEdgeManagement", "Kubernetes". - :type kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleTypes + :vartype kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleTypes :ivar system_data: Role configured on ASE resource. :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param connection_string: Activation key of the MEC. - :type connection_string: + :ivar connection_string: Activation key of the MEC. + :vartype connection_string: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AsymmetricEncryptedSecret - :param controller_endpoint: Controller Endpoint. - :type controller_endpoint: str - :param resource_unique_id: Unique Id of the Resource. - :type resource_unique_id: str - :param role_status: Role status. Possible values include: "Enabled", "Disabled". - :type role_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleStatus + :ivar controller_endpoint: Controller Endpoint. + :vartype controller_endpoint: str + :ivar resource_unique_id: Unique Id of the Resource. + :vartype resource_unique_id: str + :ivar role_status: Role status. Possible values include: "Enabled", "Disabled". + :vartype role_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleStatus """ _validation = { @@ -2858,6 +3262,17 @@ def __init__( role_status: Optional[Union[str, "RoleStatus"]] = None, **kwargs ): + """ + :keyword connection_string: Activation key of the MEC. + :paramtype connection_string: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AsymmetricEncryptedSecret + :keyword controller_endpoint: Controller Endpoint. + :paramtype controller_endpoint: str + :keyword resource_unique_id: Unique Id of the Resource. + :paramtype resource_unique_id: str + :keyword role_status: Role status. Possible values include: "Enabled", "Disabled". + :paramtype role_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleStatus + """ super(MECRole, self).__init__(**kwargs) self.kind = 'MEC' # type: str self.connection_string = connection_string @@ -2871,15 +3286,16 @@ class MetricConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param resource_id: Required. The Resource ID on which the metrics should be pushed. - :type resource_id: str - :param mdm_account: The MDM account to which the counters should be pushed. - :type mdm_account: str - :param metric_name_space: The MDM namespace to which the counters should be pushed. This is + :ivar resource_id: Required. The Resource ID on which the metrics should be pushed. + :vartype resource_id: str + :ivar mdm_account: The MDM account to which the counters should be pushed. + :vartype mdm_account: str + :ivar metric_name_space: The MDM namespace to which the counters should be pushed. This is required if MDMAccount is specified. - :type metric_name_space: str - :param counter_sets: Required. Host name for the IoT hub associated to the device. - :type counter_sets: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricCounterSet] + :vartype metric_name_space: str + :ivar counter_sets: Required. Host name for the IoT hub associated to the device. + :vartype counter_sets: + list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricCounterSet] """ _validation = { @@ -2903,6 +3319,18 @@ def __init__( metric_name_space: Optional[str] = None, **kwargs ): + """ + :keyword resource_id: Required. The Resource ID on which the metrics should be pushed. + :paramtype resource_id: str + :keyword mdm_account: The MDM account to which the counters should be pushed. + :paramtype mdm_account: str + :keyword metric_name_space: The MDM namespace to which the counters should be pushed. This is + required if MDMAccount is specified. + :paramtype metric_name_space: str + :keyword counter_sets: Required. Host name for the IoT hub associated to the device. + :paramtype counter_sets: + list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricCounterSet] + """ super(MetricConfiguration, self).__init__(**kwargs) self.resource_id = resource_id self.mdm_account = mdm_account @@ -2915,15 +3343,15 @@ class MetricCounter(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The counter name. - :type name: str - :param instance: The instance from which counter should be collected. - :type instance: str - :param dimension_filter: The dimension filter. - :type dimension_filter: + :ivar name: Required. The counter name. + :vartype name: str + :ivar instance: The instance from which counter should be collected. + :vartype instance: str + :ivar dimension_filter: The dimension filter. + :vartype dimension_filter: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricDimension] - :param additional_dimensions: The additional dimensions to be added to metric. - :type additional_dimensions: + :ivar additional_dimensions: The additional dimensions to be added to metric. + :vartype additional_dimensions: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricDimension] """ @@ -2947,6 +3375,18 @@ def __init__( additional_dimensions: Optional[List["MetricDimension"]] = None, **kwargs ): + """ + :keyword name: Required. The counter name. + :paramtype name: str + :keyword instance: The instance from which counter should be collected. + :paramtype instance: str + :keyword dimension_filter: The dimension filter. + :paramtype dimension_filter: + list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricDimension] + :keyword additional_dimensions: The additional dimensions to be added to metric. + :paramtype additional_dimensions: + list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricDimension] + """ super(MetricCounter, self).__init__(**kwargs) self.name = name self.instance = instance @@ -2959,8 +3399,8 @@ class MetricCounterSet(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param counters: Required. The counters that should be collected in this set. - :type counters: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricCounter] + :ivar counters: Required. The counters that should be collected in this set. + :vartype counters: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricCounter] """ _validation = { @@ -2977,6 +3417,10 @@ def __init__( counters: List["MetricCounter"], **kwargs ): + """ + :keyword counters: Required. The counters that should be collected in this set. + :paramtype counters: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricCounter] + """ super(MetricCounterSet, self).__init__(**kwargs) self.counters = counters @@ -2986,10 +3430,10 @@ class MetricDimension(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_type: Required. The dimension type. - :type source_type: str - :param source_name: Required. The dimension value. - :type source_name: str + :ivar source_type: Required. The dimension type. + :vartype source_type: str + :ivar source_name: Required. The dimension value. + :vartype source_name: str """ _validation = { @@ -3009,6 +3453,12 @@ def __init__( source_name: str, **kwargs ): + """ + :keyword source_type: Required. The dimension type. + :paramtype source_type: str + :keyword source_name: Required. The dimension value. + :paramtype source_name: str + """ super(MetricDimension, self).__init__(**kwargs) self.source_type = source_type self.source_name = source_name @@ -3017,12 +3467,12 @@ def __init__( class MetricDimensionV1(msrest.serialization.Model): """Metric Dimension v1. - :param name: Name of the metrics dimension. - :type name: str - :param display_name: Display name of the metrics dimension. - :type display_name: str - :param to_be_exported_for_shoebox: To be exported to shoe box. - :type to_be_exported_for_shoebox: bool + :ivar name: Name of the metrics dimension. + :vartype name: str + :ivar display_name: Display name of the metrics dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: To be exported to shoe box. + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -3039,6 +3489,14 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): + """ + :keyword name: Name of the metrics dimension. + :paramtype name: str + :keyword display_name: Display name of the metrics dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: To be exported to shoe box. + :paramtype to_be_exported_for_shoebox: bool + """ super(MetricDimensionV1, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -3048,32 +3506,32 @@ def __init__( class MetricSpecificationV1(msrest.serialization.Model): """Metric specification version 1. - :param name: Name of the metric. - :type name: str - :param display_name: Display name of the metric. - :type display_name: str - :param display_description: Description of the metric to be displayed. - :type display_description: str - :param unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Display name of the metric. + :vartype display_name: str + :ivar display_description: Description of the metric to be displayed. + :vartype display_description: str + :ivar unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", "Seconds", "Milliseconds", "Bytes", "BytesPerSecond", "CountPerSecond". - :type unit: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricUnit - :param aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", + :vartype unit: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricUnit + :ivar aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", "None", "Average", "Minimum", "Maximum", "Total", "Count". - :type aggregation_type: str or + :vartype aggregation_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricAggregationType - :param dimensions: Metric dimensions, other than default dimension which is resource. - :type dimensions: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricDimensionV1] - :param fill_gap_with_zero: Set true to fill the gaps with zero. - :type fill_gap_with_zero: bool - :param category: Metric category. Possible values include: "Capacity", "Transaction". - :type category: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricCategory - :param resource_id_dimension_name_override: Resource name override. - :type resource_id_dimension_name_override: str - :param supported_time_grain_types: Support granularity of metrics. - :type supported_time_grain_types: list[str or + :ivar dimensions: Metric dimensions, other than default dimension which is resource. + :vartype dimensions: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricDimensionV1] + :ivar fill_gap_with_zero: Set true to fill the gaps with zero. + :vartype fill_gap_with_zero: bool + :ivar category: Metric category. Possible values include: "Capacity", "Transaction". + :vartype category: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricCategory + :ivar resource_id_dimension_name_override: Resource name override. + :vartype resource_id_dimension_name_override: str + :ivar supported_time_grain_types: Support granularity of metrics. + :vartype supported_time_grain_types: list[str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.TimeGrain] - :param supported_aggregation_types: Support metric aggregation type. - :type supported_aggregation_types: list[str or + :ivar supported_aggregation_types: Support metric aggregation type. + :vartype supported_aggregation_types: list[str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricAggregationType] """ @@ -3107,6 +3565,36 @@ def __init__( supported_aggregation_types: Optional[List[Union[str, "MetricAggregationType"]]] = None, **kwargs ): + """ + :keyword name: Name of the metric. + :paramtype name: str + :keyword display_name: Display name of the metric. + :paramtype display_name: str + :keyword display_description: Description of the metric to be displayed. + :paramtype display_description: str + :keyword unit: Metric units. Possible values include: "NotSpecified", "Percent", "Count", + "Seconds", "Milliseconds", "Bytes", "BytesPerSecond", "CountPerSecond". + :paramtype unit: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricUnit + :keyword aggregation_type: Metric aggregation type. Possible values include: "NotSpecified", + "None", "Average", "Minimum", "Maximum", "Total", "Count". + :paramtype aggregation_type: str or + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricAggregationType + :keyword dimensions: Metric dimensions, other than default dimension which is resource. + :paramtype dimensions: + list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricDimensionV1] + :keyword fill_gap_with_zero: Set true to fill the gaps with zero. + :paramtype fill_gap_with_zero: bool + :keyword category: Metric category. Possible values include: "Capacity", "Transaction". + :paramtype category: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricCategory + :keyword resource_id_dimension_name_override: Resource name override. + :paramtype resource_id_dimension_name_override: str + :keyword supported_time_grain_types: Support granularity of metrics. + :paramtype supported_time_grain_types: list[str or + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.TimeGrain] + :keyword supported_aggregation_types: Support metric aggregation type. + :paramtype supported_aggregation_types: list[str or + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricAggregationType] + """ super(MetricSpecificationV1, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -3136,8 +3624,8 @@ class MonitoringMetricConfiguration(ARMBaseModel): :vartype type: str :ivar system_data: MonitoringConfiguration on ASE device. :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param metric_configurations: Required. The metrics configuration details. - :type metric_configurations: + :ivar metric_configurations: Required. The metrics configuration details. + :vartype metric_configurations: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricConfiguration] """ @@ -3163,6 +3651,11 @@ def __init__( metric_configurations: List["MetricConfiguration"], **kwargs ): + """ + :keyword metric_configurations: Required. The metrics configuration details. + :paramtype metric_configurations: + list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricConfiguration] + """ super(MonitoringMetricConfiguration, self).__init__(**kwargs) self.system_data = None self.metric_configurations = metric_configurations @@ -3194,6 +3687,8 @@ def __init__( self, **kwargs ): + """ + """ super(MonitoringMetricConfigurationList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3206,8 +3701,8 @@ class MountPointMap(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param share_id: Required. ID of the share mounted to the role VM. - :type share_id: str + :ivar share_id: Required. ID of the share mounted to the role VM. + :vartype share_id: str :ivar role_id: ID of the role to which share is mounted. :vartype role_id: str :ivar mount_point: Mount point for the share. @@ -3241,6 +3736,10 @@ def __init__( share_id: str, **kwargs ): + """ + :keyword share_id: Required. ID of the share mounted to the role VM. + :paramtype share_id: str + """ super(MountPointMap, self).__init__(**kwargs) self.share_id = share_id self.role_id = None @@ -3274,13 +3773,13 @@ class NetworkAdapter(msrest.serialization.Model): :ivar status: Value indicating whether this adapter is valid. Possible values include: "Inactive", "Active". :vartype status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.NetworkAdapterStatus - :param rdma_status: Value indicating whether this adapter is RDMA capable. Possible values + :ivar rdma_status: Value indicating whether this adapter is RDMA capable. Possible values include: "Incapable", "Capable". - :type rdma_status: str or + :vartype rdma_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.NetworkAdapterRDMAStatus - :param dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values + :ivar dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values include: "Disabled", "Enabled". - :type dhcp_status: str or + :vartype dhcp_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.NetworkAdapterDHCPStatus :ivar ipv4_configuration: The IPv4 configuration of the network adapter. :vartype ipv4_configuration: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.Ipv4Config @@ -3333,6 +3832,16 @@ def __init__( dhcp_status: Optional[Union[str, "NetworkAdapterDHCPStatus"]] = None, **kwargs ): + """ + :keyword rdma_status: Value indicating whether this adapter is RDMA capable. Possible values + include: "Incapable", "Capable". + :paramtype rdma_status: str or + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.NetworkAdapterRDMAStatus + :keyword dhcp_status: Value indicating whether this adapter has DHCP enabled. Possible values + include: "Disabled", "Enabled". + :paramtype dhcp_status: str or + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.NetworkAdapterDHCPStatus + """ super(NetworkAdapter, self).__init__(**kwargs) self.adapter_id = None self.adapter_position = None @@ -3376,6 +3885,8 @@ def __init__( self, **kwargs ): + """ + """ super(NetworkAdapterPosition, self).__init__(**kwargs) self.network_group = None self.port = None @@ -3419,6 +3930,8 @@ def __init__( self, **kwargs ): + """ + """ super(NetworkSettings, self).__init__(**kwargs) self.system_data = None self.network_adapters = None @@ -3485,6 +3998,8 @@ def __init__( self, **kwargs ): + """ + """ super(Node, self).__init__(**kwargs) self.node_status = None self.node_chassis_serial_number = None @@ -3504,8 +4019,8 @@ class NodeInfo(msrest.serialization.Model): :vartype name: str :ivar type: Node type - Master/Worker. Possible values include: "Invalid", "Master", "Worker". :vartype type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.KubernetesNodeType - :param ip_configuration: IP Configuration of the Kubernetes node. - :type ip_configuration: + :ivar ip_configuration: IP Configuration of the Kubernetes node. + :vartype ip_configuration: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.KubernetesIPConfiguration] """ @@ -3526,6 +4041,11 @@ def __init__( ip_configuration: Optional[List["KubernetesIPConfiguration"]] = None, **kwargs ): + """ + :keyword ip_configuration: IP Configuration of the Kubernetes node. + :paramtype ip_configuration: + list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.KubernetesIPConfiguration] + """ super(NodeInfo, self).__init__(**kwargs) self.name = None self.type = None @@ -3539,8 +4059,8 @@ class NodeList(msrest.serialization.Model): :ivar value: The list of Nodes. :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Node] - :param next_link: Link to the next set of results. - :type next_link: str + :ivar next_link: Link to the next set of results. + :vartype next_link: str """ _validation = { @@ -3558,6 +4078,10 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: Link to the next set of results. + :paramtype next_link: str + """ super(NodeList, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -3566,16 +4090,16 @@ def __init__( class Operation(msrest.serialization.Model): """Operations. - :param name: Name of the operation. - :type name: str - :param display: Properties displayed for the operation. - :type display: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.OperationDisplay - :param origin: Origin of the operation. - :type origin: str - :param is_data_action: Indicates whether the operation is a data action. - :type is_data_action: bool - :param service_specification: Service specification. - :type service_specification: + :ivar name: Name of the operation. + :vartype name: str + :ivar display: Properties displayed for the operation. + :vartype display: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.OperationDisplay + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar service_specification: Service specification. + :vartype service_specification: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ServiceSpecification """ @@ -3597,6 +4121,19 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword name: Name of the operation. + :paramtype name: str + :keyword display: Properties displayed for the operation. + :paramtype display: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + :keyword service_specification: Service specification. + :paramtype service_specification: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ServiceSpecification + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -3608,14 +4145,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Operation display properties. - :param provider: Provider name. - :type provider: str - :param resource: The type of resource in which the operation is performed. - :type resource: str - :param operation: Operation to be performed on the resource. - :type operation: str - :param description: Description of the operation to be performed. - :type description: str + :ivar provider: Provider name. + :vartype provider: str + :ivar resource: The type of resource in which the operation is performed. + :vartype resource: str + :ivar operation: Operation to be performed on the resource. + :vartype operation: str + :ivar description: Description of the operation to be performed. + :vartype description: str """ _attribute_map = { @@ -3634,6 +4171,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Provider name. + :paramtype provider: str + :keyword resource: The type of resource in which the operation is performed. + :paramtype resource: str + :keyword operation: Operation to be performed on the resource. + :paramtype operation: str + :keyword description: Description of the operation to be performed. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -3646,10 +4193,10 @@ class OperationsList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The value. - :type value: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Operation] - :param next_link: Link to the next set of results. - :type next_link: str + :ivar value: Required. The value. + :vartype value: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Operation] + :ivar next_link: Link to the next set of results. + :vartype next_link: str """ _validation = { @@ -3668,6 +4215,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The value. + :paramtype value: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Operation] + :keyword next_link: Link to the next set of results. + :paramtype next_link: str + """ super(OperationsList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3686,10 +4239,10 @@ class Order(ARMBaseModel): :vartype type: str :ivar system_data: Order configured on ASE resource. :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param contact_information: The contact details. - :type contact_information: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ContactDetails - :param shipping_address: The shipping address. - :type shipping_address: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.Address + :ivar contact_information: The contact details. + :vartype contact_information: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ContactDetails + :ivar shipping_address: The shipping address. + :vartype shipping_address: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.Address :ivar current_status: Current status of the order. :vartype current_status: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.OrderStatus :ivar order_history: List of status changes in the order. @@ -3704,9 +4257,9 @@ class Order(ARMBaseModel): whether it has an original or a replacement device. :vartype return_tracking_info: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.TrackingInfo] - :param shipment_type: ShipmentType of the order. Possible values include: "NotApplicable", + :ivar shipment_type: ShipmentType of the order. Possible values include: "NotApplicable", "ShippedToCustomer", "SelfPickup". - :type shipment_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ShipmentType + :vartype shipment_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ShipmentType """ _validation = { @@ -3744,6 +4297,17 @@ def __init__( shipment_type: Optional[Union[str, "ShipmentType"]] = None, **kwargs ): + """ + :keyword contact_information: The contact details. + :paramtype contact_information: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ContactDetails + :keyword shipping_address: The shipping address. + :paramtype shipping_address: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.Address + :keyword shipment_type: ShipmentType of the order. Possible values include: "NotApplicable", + "ShippedToCustomer", "SelfPickup". + :paramtype shipment_type: str or + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ShipmentType + """ super(Order, self).__init__(**kwargs) self.system_data = None self.contact_information = contact_information @@ -3781,6 +4345,8 @@ def __init__( self, **kwargs ): + """ + """ super(OrderList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3793,16 +4359,16 @@ class OrderStatus(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param status: Required. Status of the order as per the allowed status types. Possible values + :ivar status: Required. Status of the order as per the allowed status types. Possible values include: "Untracked", "AwaitingFulfillment", "AwaitingPreparation", "AwaitingShipment", "Shipped", "Arriving", "Delivered", "ReplacementRequested", "LostDevice", "Declined", "ReturnInitiated", "AwaitingReturnShipment", "ShippedBack", "CollectedAtMicrosoft", "AwaitingPickup", "PickupCompleted", "AwaitingDrop". - :type status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.OrderState + :vartype status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.OrderState :ivar update_date_time: Time of status update. :vartype update_date_time: ~datetime.datetime - :param comments: Comments related to this status change. - :type comments: str + :ivar comments: Comments related to this status change. + :vartype comments: str :ivar tracking_information: Tracking information related to the state in the ordering flow. :vartype tracking_information: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.TrackingInfo :ivar additional_order_details: Dictionary to hold generic information which is not stored @@ -3832,6 +4398,16 @@ def __init__( comments: Optional[str] = None, **kwargs ): + """ + :keyword status: Required. Status of the order as per the allowed status types. Possible values + include: "Untracked", "AwaitingFulfillment", "AwaitingPreparation", "AwaitingShipment", + "Shipped", "Arriving", "Delivered", "ReplacementRequested", "LostDevice", "Declined", + "ReturnInitiated", "AwaitingReturnShipment", "ShippedBack", "CollectedAtMicrosoft", + "AwaitingPickup", "PickupCompleted", "AwaitingDrop". + :paramtype status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.OrderState + :keyword comments: Comments related to this status change. + :paramtype comments: str + """ super(OrderStatus, self).__init__(**kwargs) self.status = status self.update_date_time = None @@ -3855,17 +4431,18 @@ class PeriodicTimerEventTrigger(Trigger): :vartype type: str :ivar system_data: Trigger in DataBoxEdge Resource. :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param kind: Required. Trigger Kind.Constant filled by server. Possible values include: + :ivar kind: Required. Trigger Kind.Constant filled by server. Possible values include: "FileEvent", "PeriodicTimerEvent". - :type kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.TriggerEventType - :param source_info: Required. Periodic timer details. - :type source_info: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.PeriodicTimerSourceInfo - :param sink_info: Required. Role Sink information. - :type sink_info: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleSinkInfo - :param custom_context_tag: A custom context tag typically used to correlate the trigger against + :vartype kind: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.TriggerEventType + :ivar source_info: Required. Periodic timer details. + :vartype source_info: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.PeriodicTimerSourceInfo + :ivar sink_info: Required. Role Sink information. + :vartype sink_info: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleSinkInfo + :ivar custom_context_tag: A custom context tag typically used to correlate the trigger against its usage. For example, if a periodic timer trigger is intended for certain specific IoT modules in the device, the tag can be the name or the image URL of the module. - :type custom_context_tag: str + :vartype custom_context_tag: str """ _validation = { @@ -3898,6 +4475,17 @@ def __init__( custom_context_tag: Optional[str] = None, **kwargs ): + """ + :keyword source_info: Required. Periodic timer details. + :paramtype source_info: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.PeriodicTimerSourceInfo + :keyword sink_info: Required. Role Sink information. + :paramtype sink_info: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleSinkInfo + :keyword custom_context_tag: A custom context tag typically used to correlate the trigger + against its usage. For example, if a periodic timer trigger is intended for certain specific + IoT modules in the device, the tag can be the name or the image URL of the module. + :paramtype custom_context_tag: str + """ super(PeriodicTimerEventTrigger, self).__init__(**kwargs) self.kind = 'PeriodicTimerEvent' # type: str self.source_info = source_info @@ -3910,15 +4498,15 @@ class PeriodicTimerSourceInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param start_time: Required. The time of the day that results in a valid trigger. Schedule is + :ivar start_time: Required. The time of the day that results in a valid trigger. Schedule is computed with reference to the time specified upto seconds. If timezone is not specified the time will considered to be in device timezone. The value will always be returned as UTC time. - :type start_time: ~datetime.datetime - :param schedule: Required. Periodic frequency at which timer event needs to be raised. Supports + :vartype start_time: ~datetime.datetime + :ivar schedule: Required. Periodic frequency at which timer event needs to be raised. Supports daily, hourly, minutes, and seconds. - :type schedule: str - :param topic: Topic where periodic events are published to IoT device. - :type topic: str + :vartype schedule: str + :ivar topic: Topic where periodic events are published to IoT device. + :vartype topic: str """ _validation = { @@ -3940,6 +4528,17 @@ def __init__( topic: Optional[str] = None, **kwargs ): + """ + :keyword start_time: Required. The time of the day that results in a valid trigger. Schedule is + computed with reference to the time specified upto seconds. If timezone is not specified the + time will considered to be in device timezone. The value will always be returned as UTC time. + :paramtype start_time: ~datetime.datetime + :keyword schedule: Required. Periodic frequency at which timer event needs to be raised. + Supports daily, hourly, minutes, and seconds. + :paramtype schedule: str + :keyword topic: Topic where periodic events are published to IoT device. + :paramtype topic: str + """ super(PeriodicTimerSourceInfo, self).__init__(**kwargs) self.start_time = start_time self.schedule = schedule @@ -3949,21 +4548,21 @@ def __init__( class RefreshDetails(msrest.serialization.Model): """Fields for tracking refresh job on the share or container. - :param in_progress_refresh_job_id: If a refresh job is currently in progress on this share or + :ivar in_progress_refresh_job_id: If a refresh job is currently in progress on this share or container, this field indicates the ARM resource ID of that job. The field is empty if no job is in progress. - :type in_progress_refresh_job_id: str - :param last_completed_refresh_job_time_in_utc: Indicates the completed time for the last - refresh job on this particular share or container, if any.This could be a failed job or a - successful job. - :type last_completed_refresh_job_time_in_utc: ~datetime.datetime - :param error_manifest_file: Indicates the relative path of the error xml for the last refresh + :vartype in_progress_refresh_job_id: str + :ivar last_completed_refresh_job_time_in_utc: Indicates the completed time for the last refresh + job on this particular share or container, if any.This could be a failed job or a successful + job. + :vartype last_completed_refresh_job_time_in_utc: ~datetime.datetime + :ivar error_manifest_file: Indicates the relative path of the error xml for the last refresh job on this particular share or container, if any. This could be a failed job or a successful job. - :type error_manifest_file: str - :param last_job: Indicates the id of the last refresh job on this particular share or + :vartype error_manifest_file: str + :ivar last_job: Indicates the id of the last refresh job on this particular share or container,if any. This could be a failed job or a successful job. - :type last_job: str + :vartype last_job: str """ _attribute_map = { @@ -3982,6 +4581,23 @@ def __init__( last_job: Optional[str] = None, **kwargs ): + """ + :keyword in_progress_refresh_job_id: If a refresh job is currently in progress on this share or + container, this field indicates the ARM resource ID of that job. The field is empty if no job + is in progress. + :paramtype in_progress_refresh_job_id: str + :keyword last_completed_refresh_job_time_in_utc: Indicates the completed time for the last + refresh job on this particular share or container, if any.This could be a failed job or a + successful job. + :paramtype last_completed_refresh_job_time_in_utc: ~datetime.datetime + :keyword error_manifest_file: Indicates the relative path of the error xml for the last refresh + job on this particular share or container, if any. This could be a failed job or a successful + job. + :paramtype error_manifest_file: str + :keyword last_job: Indicates the id of the last refresh job on this particular share or + container,if any. This could be a failed job or a successful job. + :paramtype last_job: str + """ super(RefreshDetails, self).__init__(**kwargs) self.in_progress_refresh_job_id = in_progress_refresh_job_id self.last_completed_refresh_job_time_in_utc = last_completed_refresh_job_time_in_utc @@ -3994,8 +4610,8 @@ class ResourceIdentity(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param type: Identity type. Possible values include: "None", "SystemAssigned", "UserAssigned". - :type type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.MsiIdentityType + :ivar type: Identity type. Possible values include: "None", "SystemAssigned", "UserAssigned". + :vartype type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.MsiIdentityType :ivar principal_id: Service Principal Id backing the Msi. :vartype principal_id: str :ivar tenant_id: Home Tenant Id. @@ -4019,6 +4635,11 @@ def __init__( type: Optional[Union[str, "MsiIdentityType"]] = None, **kwargs ): + """ + :keyword type: Identity type. Possible values include: "None", "SystemAssigned", + "UserAssigned". + :paramtype type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.MsiIdentityType + """ super(ResourceIdentity, self).__init__(**kwargs) self.type = type self.principal_id = None @@ -4028,13 +4649,13 @@ def __init__( class ResourceMoveDetails(msrest.serialization.Model): """Fields for tracking resource move. - :param operation_in_progress: Denotes whether move operation is in progress. Possible values + :ivar operation_in_progress: Denotes whether move operation is in progress. Possible values include: "None", "ResourceMoveInProgress", "ResourceMoveFailed". - :type operation_in_progress: str or + :vartype operation_in_progress: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ResourceMoveStatus - :param operation_in_progress_lock_timeout_in_utc: Denotes the timeout of the operation to + :ivar operation_in_progress_lock_timeout_in_utc: Denotes the timeout of the operation to finish. - :type operation_in_progress_lock_timeout_in_utc: ~datetime.datetime + :vartype operation_in_progress_lock_timeout_in_utc: ~datetime.datetime """ _attribute_map = { @@ -4049,6 +4670,15 @@ def __init__( operation_in_progress_lock_timeout_in_utc: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword operation_in_progress: Denotes whether move operation is in progress. Possible values + include: "None", "ResourceMoveInProgress", "ResourceMoveFailed". + :paramtype operation_in_progress: str or + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ResourceMoveStatus + :keyword operation_in_progress_lock_timeout_in_utc: Denotes the timeout of the operation to + finish. + :paramtype operation_in_progress_lock_timeout_in_utc: ~datetime.datetime + """ super(ResourceMoveDetails, self).__init__(**kwargs) self.operation_in_progress = operation_in_progress self.operation_in_progress_lock_timeout_in_utc = operation_in_progress_lock_timeout_in_utc @@ -4079,6 +4709,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceTypeSku, self).__init__(**kwargs) self.resource_type = None self.skus = None @@ -4109,6 +4741,8 @@ def __init__( self, **kwargs ): + """ + """ super(RoleList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4119,8 +4753,8 @@ class RoleSinkInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param role_id: Required. Compute role ID. - :type role_id: str + :ivar role_id: Required. Compute role ID. + :vartype role_id: str """ _validation = { @@ -4137,6 +4771,10 @@ def __init__( role_id: str, **kwargs ): + """ + :keyword role_id: Required. Compute role ID. + :paramtype role_id: str + """ super(RoleSinkInfo, self).__init__(**kwargs) self.role_id = role_id @@ -4144,12 +4782,12 @@ def __init__( class Secret(msrest.serialization.Model): """Holds device secret either as a KeyVault reference or as an encrypted value. - :param encrypted_secret: Encrypted (using device public key) secret value. - :type encrypted_secret: + :ivar encrypted_secret: Encrypted (using device public key) secret value. + :vartype encrypted_secret: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AsymmetricEncryptedSecret - :param key_vault_id: Id of the Key-Vault where secret is stored (ex: + :ivar key_vault_id: Id of the Key-Vault where secret is stored (ex: secrets/AuthClientSecret/82ef4346187a4033a10d629cde07d740). - :type key_vault_id: str + :vartype key_vault_id: str """ _attribute_map = { @@ -4164,6 +4802,14 @@ def __init__( key_vault_id: Optional[str] = None, **kwargs ): + """ + :keyword encrypted_secret: Encrypted (using device public key) secret value. + :paramtype encrypted_secret: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AsymmetricEncryptedSecret + :keyword key_vault_id: Id of the Key-Vault where secret is stored (ex: + secrets/AuthClientSecret/82ef4346187a4033a10d629cde07d740). + :paramtype key_vault_id: str + """ super(Secret, self).__init__(**kwargs) self.encrypted_secret = encrypted_secret self.key_vault_id = key_vault_id @@ -4182,11 +4828,11 @@ class SecuritySettings(ARMBaseModel): :vartype name: str :ivar type: The hierarchical type of the object. :vartype type: str - :param device_admin_password: Required. Device administrator password as an encrypted string + :ivar device_admin_password: Required. Device administrator password as an encrypted string (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual password should have at least 8 characters that are a combination of uppercase, lowercase, numeric, and special characters. - :type device_admin_password: + :vartype device_admin_password: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AsymmetricEncryptedSecret """ @@ -4210,6 +4856,14 @@ def __init__( device_admin_password: "AsymmetricEncryptedSecret", **kwargs ): + """ + :keyword device_admin_password: Required. Device administrator password as an encrypted string + (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual + password should have at least 8 characters that are a combination of uppercase, lowercase, + numeric, and special characters. + :paramtype device_admin_password: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AsymmetricEncryptedSecret + """ super(SecuritySettings, self).__init__(**kwargs) self.device_admin_password = device_admin_password @@ -4217,8 +4871,8 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """Service specification. - :param metric_specifications: Metric specification as defined by shoebox. - :type metric_specifications: + :ivar metric_specifications: Metric specification as defined by shoebox. + :vartype metric_specifications: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricSpecificationV1] """ @@ -4232,6 +4886,11 @@ def __init__( metric_specifications: Optional[List["MetricSpecificationV1"]] = None, **kwargs ): + """ + :keyword metric_specifications: Metric specification as defined by shoebox. + :paramtype metric_specifications: + list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MetricSpecificationV1] + """ super(ServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications @@ -4251,36 +4910,36 @@ class Share(ARMBaseModel): :vartype type: str :ivar system_data: Share on ASE device. :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param description: Description for the share. - :type description: str - :param share_status: Required. Current status of the share. Possible values include: "Offline", + :ivar description: Description for the share. + :vartype description: str + :ivar share_status: Required. Current status of the share. Possible values include: "Offline", "Unknown", "OK", "Updating", "NeedsAttention". - :type share_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ShareStatus - :param monitoring_status: Required. Current monitoring status of the share. Possible values + :vartype share_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ShareStatus + :ivar monitoring_status: Required. Current monitoring status of the share. Possible values include: "Enabled", "Disabled". - :type monitoring_status: str or + :vartype monitoring_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.MonitoringStatus - :param azure_container_info: Azure container mapping for the share. - :type azure_container_info: + :ivar azure_container_info: Azure container mapping for the share. + :vartype azure_container_info: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AzureContainerInfo - :param access_protocol: Required. Access protocol to be used by the share. Possible values + :ivar access_protocol: Required. Access protocol to be used by the share. Possible values include: "SMB", "NFS". - :type access_protocol: str or + :vartype access_protocol: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ShareAccessProtocol - :param user_access_rights: Mapping of users and corresponding access rights on the share + :ivar user_access_rights: Mapping of users and corresponding access rights on the share (required for SMB protocol). - :type user_access_rights: + :vartype user_access_rights: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.UserAccessRight] - :param client_access_rights: List of IP addresses and corresponding access rights on the + :ivar client_access_rights: List of IP addresses and corresponding access rights on the share(required for NFS protocol). - :type client_access_rights: + :vartype client_access_rights: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.ClientAccessRight] - :param refresh_details: Details of the refresh job on this share. - :type refresh_details: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RefreshDetails + :ivar refresh_details: Details of the refresh job on this share. + :vartype refresh_details: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RefreshDetails :ivar share_mappings: Share mount point to the role. :vartype share_mappings: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MountPointMap] - :param data_policy: Data policy of the share. Possible values include: "Cloud", "Local". - :type data_policy: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataPolicy + :ivar data_policy: Data policy of the share. Possible values include: "Cloud", "Local". + :vartype data_policy: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataPolicy """ _validation = { @@ -4325,6 +4984,36 @@ def __init__( data_policy: Optional[Union[str, "DataPolicy"]] = None, **kwargs ): + """ + :keyword description: Description for the share. + :paramtype description: str + :keyword share_status: Required. Current status of the share. Possible values include: + "Offline", "Unknown", "OK", "Updating", "NeedsAttention". + :paramtype share_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ShareStatus + :keyword monitoring_status: Required. Current monitoring status of the share. Possible values + include: "Enabled", "Disabled". + :paramtype monitoring_status: str or + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.MonitoringStatus + :keyword azure_container_info: Azure container mapping for the share. + :paramtype azure_container_info: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AzureContainerInfo + :keyword access_protocol: Required. Access protocol to be used by the share. Possible values + include: "SMB", "NFS". + :paramtype access_protocol: str or + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ShareAccessProtocol + :keyword user_access_rights: Mapping of users and corresponding access rights on the share + (required for SMB protocol). + :paramtype user_access_rights: + list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.UserAccessRight] + :keyword client_access_rights: List of IP addresses and corresponding access rights on the + share(required for NFS protocol). + :paramtype client_access_rights: + list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.ClientAccessRight] + :keyword refresh_details: Details of the refresh job on this share. + :paramtype refresh_details: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.RefreshDetails + :keyword data_policy: Data policy of the share. Possible values include: "Cloud", "Local". + :paramtype data_policy: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataPolicy + """ super(Share, self).__init__(**kwargs) self.system_data = None self.description = description @@ -4344,11 +5033,11 @@ class ShareAccessRight(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param share_id: Required. The share ID. - :type share_id: str - :param access_type: Required. Type of access to be allowed on the share for this user. Possible + :ivar share_id: Required. The share ID. + :vartype share_id: str + :ivar access_type: Required. Type of access to be allowed on the share for this user. Possible values include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ShareAccessType + :vartype access_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ShareAccessType """ _validation = { @@ -4368,6 +5057,14 @@ def __init__( access_type: Union[str, "ShareAccessType"], **kwargs ): + """ + :keyword share_id: Required. The share ID. + :paramtype share_id: str + :keyword access_type: Required. Type of access to be allowed on the share for this user. + Possible values include: "Change", "Read", "Custom". + :paramtype access_type: str or + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ShareAccessType + """ super(ShareAccessRight, self).__init__(**kwargs) self.share_id = share_id self.access_type = access_type @@ -4398,6 +5095,8 @@ def __init__( self, **kwargs ): + """ + """ super(ShareList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4406,14 +5105,14 @@ def __init__( class Sku(msrest.serialization.Model): """The SKU type. - :param name: SKU name. Possible values include: "Gateway", "Edge", "TEA_1Node", - "TEA_1Node_UPS", "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", - "TEA_4Node_UPS_Heater", "TMA", "TDC", "TCA_Small", "GPU", "TCA_Large", "EdgeP_Base", - "EdgeP_High", "EdgePR_Base", "EdgePR_Base_UPS", "EP2_64_1VPU_W", "EP2_128_1T4_Mx1_W", - "EP2_256_2T4_W", "EdgeMR_Mini", "RCA_Small", "RCA_Large", "RDC", "Management". - :type name: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SkuName - :param tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard". - :type tier: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SkuTier + :ivar name: SKU name. Possible values include: "Gateway", "Edge", "TEA_1Node", "TEA_1Node_UPS", + "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", "TEA_4Node_UPS_Heater", "TMA", + "TDC", "TCA_Small", "GPU", "TCA_Large", "EdgeP_Base", "EdgeP_High", "EdgePR_Base", + "EdgePR_Base_UPS", "EP2_64_1VPU_W", "EP2_128_1T4_Mx1_W", "EP2_256_2T4_W", "EdgeMR_Mini", + "RCA_Small", "RCA_Large", "RDC", "Management". + :vartype name: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SkuName + :ivar tier: The SKU tier. This is based on the SKU name. Possible values include: "Standard". + :vartype tier: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SkuTier """ _attribute_map = { @@ -4428,11 +5127,54 @@ def __init__( tier: Optional[Union[str, "SkuTier"]] = None, **kwargs ): + """ + :keyword name: SKU name. Possible values include: "Gateway", "Edge", "TEA_1Node", + "TEA_1Node_UPS", "TEA_1Node_Heater", "TEA_1Node_UPS_Heater", "TEA_4Node_Heater", + "TEA_4Node_UPS_Heater", "TMA", "TDC", "TCA_Small", "GPU", "TCA_Large", "EdgeP_Base", + "EdgeP_High", "EdgePR_Base", "EdgePR_Base_UPS", "EP2_64_1VPU_W", "EP2_128_1T4_Mx1_W", + "EP2_256_2T4_W", "EdgeMR_Mini", "RCA_Small", "RCA_Large", "RDC", "Management". + :paramtype name: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SkuName + :keyword tier: The SKU tier. This is based on the SKU name. Possible values include: + "Standard". + :paramtype tier: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SkuTier + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier +class SkuCapability(msrest.serialization.Model): + """The metadata to describe the capability. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: An invariant to describe the feature. + :vartype name: str + :ivar value: An invariant if the feature is measured by quantity. + :vartype value: str + """ + + _validation = { + 'name': {'readonly': True}, + 'value': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(SkuCapability, self).__init__(**kwargs) + self.name = None + self.value = None + + class SkuCost(msrest.serialization.Model): """The metadata for retrieving price info. @@ -4462,6 +5204,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuCost, self).__init__(**kwargs) self.meter_id = None self.quantity = None @@ -4522,6 +5266,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuInformation, self).__init__(**kwargs) self.name = None self.tier = None @@ -4559,6 +5305,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuInformationList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4593,6 +5341,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuLocationInfo, self).__init__(**kwargs) self.location = None self.zones = None @@ -4614,17 +5364,17 @@ class StorageAccount(ARMBaseModel): :vartype type: str :ivar system_data: StorageAccount object on ASE device. :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param description: Description for the storage Account. - :type description: str - :param storage_account_status: Current status of the storage account. Possible values include: + :ivar description: Description for the storage Account. + :vartype description: str + :ivar storage_account_status: Current status of the storage account. Possible values include: "OK", "Offline", "Unknown", "Updating", "NeedsAttention". - :type storage_account_status: str or + :vartype storage_account_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.StorageAccountStatus - :param data_policy: Required. Data policy of the storage Account. Possible values include: + :ivar data_policy: Required. Data policy of the storage Account. Possible values include: "Cloud", "Local". - :type data_policy: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataPolicy - :param storage_account_credential_id: Storage Account Credential Id. - :type storage_account_credential_id: str + :vartype data_policy: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataPolicy + :ivar storage_account_credential_id: Storage Account Credential Id. + :vartype storage_account_credential_id: str :ivar blob_endpoint: BlobEndpoint of Storage Account. :vartype blob_endpoint: str :ivar container_count: The Container Count. Present only for Storage Accounts with DataPolicy @@ -4664,6 +5414,19 @@ def __init__( storage_account_credential_id: Optional[str] = None, **kwargs ): + """ + :keyword description: Description for the storage Account. + :paramtype description: str + :keyword storage_account_status: Current status of the storage account. Possible values + include: "OK", "Offline", "Unknown", "Updating", "NeedsAttention". + :paramtype storage_account_status: str or + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.StorageAccountStatus + :keyword data_policy: Required. Data policy of the storage Account. Possible values include: + "Cloud", "Local". + :paramtype data_policy: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataPolicy + :keyword storage_account_credential_id: Storage Account Credential Id. + :paramtype storage_account_credential_id: str + """ super(StorageAccount, self).__init__(**kwargs) self.system_data = None self.description = description @@ -4689,25 +5452,26 @@ class StorageAccountCredential(ARMBaseModel): :vartype type: str :ivar system_data: StorageAccountCredential object. :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param alias: Required. Alias for the storage account. - :type alias: str - :param user_name: Username for the storage account. - :type user_name: str - :param account_key: Encrypted storage key. - :type account_key: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AsymmetricEncryptedSecret - :param connection_string: Connection string for the storage account. Use this string if - username and account key are not specified. - :type connection_string: str - :param ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible values + :ivar alias: Required. Alias for the storage account. + :vartype alias: str + :ivar user_name: Username for the storage account. + :vartype user_name: str + :ivar account_key: Encrypted storage key. + :vartype account_key: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AsymmetricEncryptedSecret + :ivar connection_string: Connection string for the storage account. Use this string if username + and account key are not specified. + :vartype connection_string: str + :ivar ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible values include: "Enabled", "Disabled". - :type ssl_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SSLStatus - :param blob_domain_name: Blob end point for private clouds. - :type blob_domain_name: str - :param account_type: Required. Type of storage accessed on the storage account. Possible values + :vartype ssl_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SSLStatus + :ivar blob_domain_name: Blob end point for private clouds. + :vartype blob_domain_name: str + :ivar account_type: Required. Type of storage accessed on the storage account. Possible values include: "GeneralPurposeStorage", "BlobStorage". - :type account_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AccountType - :param storage_account_id: Id of the storage account. - :type storage_account_id: str + :vartype account_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AccountType + :ivar storage_account_id: Id of the storage account. + :vartype storage_account_id: str """ _validation = { @@ -4748,6 +5512,28 @@ def __init__( storage_account_id: Optional[str] = None, **kwargs ): + """ + :keyword alias: Required. Alias for the storage account. + :paramtype alias: str + :keyword user_name: Username for the storage account. + :paramtype user_name: str + :keyword account_key: Encrypted storage key. + :paramtype account_key: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AsymmetricEncryptedSecret + :keyword connection_string: Connection string for the storage account. Use this string if + username and account key are not specified. + :paramtype connection_string: str + :keyword ssl_status: Required. Signifies whether SSL needs to be enabled or not. Possible + values include: "Enabled", "Disabled". + :paramtype ssl_status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SSLStatus + :keyword blob_domain_name: Blob end point for private clouds. + :paramtype blob_domain_name: str + :keyword account_type: Required. Type of storage accessed on the storage account. Possible + values include: "GeneralPurposeStorage", "BlobStorage". + :paramtype account_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AccountType + :keyword storage_account_id: Id of the storage account. + :paramtype storage_account_id: str + """ super(StorageAccountCredential, self).__init__(**kwargs) self.system_data = None self.alias = alias @@ -4786,6 +5572,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountCredentialList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4816,6 +5604,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4824,10 +5614,10 @@ def __init__( class SubscriptionRegisteredFeatures(msrest.serialization.Model): """SubscriptionRegisteredFeatures. - :param name: - :type name: str - :param state: - :type state: str + :ivar name: + :vartype name: str + :ivar state: + :vartype state: str """ _attribute_map = { @@ -4842,6 +5632,12 @@ def __init__( state: Optional[str] = None, **kwargs ): + """ + :keyword name: + :paramtype name: str + :keyword state: + :paramtype state: str + """ super(SubscriptionRegisteredFeatures, self).__init__(**kwargs) self.name = name self.state = state @@ -4850,8 +5646,8 @@ def __init__( class SymmetricKey(msrest.serialization.Model): """Symmetric key for authentication. - :param connection_string: Connection string based on the symmetric key. - :type connection_string: + :ivar connection_string: Connection string based on the symmetric key. + :vartype connection_string: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AsymmetricEncryptedSecret """ @@ -4865,6 +5661,11 @@ def __init__( connection_string: Optional["AsymmetricEncryptedSecret"] = None, **kwargs ): + """ + :keyword connection_string: Connection string based on the symmetric key. + :paramtype connection_string: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AsymmetricEncryptedSecret + """ super(SymmetricKey, self).__init__(**kwargs) self.connection_string = connection_string @@ -4872,21 +5673,22 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or + :vartype last_modified_by_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.CreatedByType - :param last_modified_at: The type of identity that last modified the resource. - :type last_modified_at: ~datetime.datetime + :ivar last_modified_at: The type of identity that last modified the resource. + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -4909,6 +5711,24 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.CreatedByType + :keyword last_modified_at: The type of identity that last modified the resource. + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -4921,14 +5741,14 @@ def __init__( class TrackingInfo(msrest.serialization.Model): """Tracking courier information. - :param serial_number: Serial number of the device being tracked. - :type serial_number: str - :param carrier_name: Name of the carrier used in the delivery. - :type carrier_name: str - :param tracking_id: Tracking ID of the shipment. - :type tracking_id: str - :param tracking_url: Tracking URL of the shipment. - :type tracking_url: str + :ivar serial_number: Serial number of the device being tracked. + :vartype serial_number: str + :ivar carrier_name: Name of the carrier used in the delivery. + :vartype carrier_name: str + :ivar tracking_id: Tracking ID of the shipment. + :vartype tracking_id: str + :ivar tracking_url: Tracking URL of the shipment. + :vartype tracking_url: str """ _attribute_map = { @@ -4947,6 +5767,16 @@ def __init__( tracking_url: Optional[str] = None, **kwargs ): + """ + :keyword serial_number: Serial number of the device being tracked. + :paramtype serial_number: str + :keyword carrier_name: Name of the carrier used in the delivery. + :paramtype carrier_name: str + :keyword tracking_id: Tracking ID of the shipment. + :paramtype tracking_id: str + :keyword tracking_url: Tracking URL of the shipment. + :paramtype tracking_url: str + """ super(TrackingInfo, self).__init__(**kwargs) self.serial_number = serial_number self.carrier_name = carrier_name @@ -4979,6 +5809,8 @@ def __init__( self, **kwargs ): + """ + """ super(TriggerList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4987,24 +5819,24 @@ def __init__( class UpdateDetails(msrest.serialization.Model): """Update Specific attributes. - :param update_title: Title of the Update. - :type update_title: str - :param update_size: Size of the update(In Bytes). - :type update_size: float - :param update_type: Type of the Update. Possible values include: "Software", "Kubernetes", + :ivar update_title: Title of the Update. + :vartype update_title: str + :ivar update_size: Size of the update(In Bytes). + :vartype update_size: float + :ivar update_type: Type of the Update. Possible values include: "Software", "Kubernetes", "Firmware". - :type update_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.UpdateType - :param target_version: Target Version number. - :type target_version: str - :param estimated_install_time_in_mins: Estimated Install Time for the update. - :type estimated_install_time_in_mins: int - :param reboot_behavior: Indicates if updates are available and at least one of the updates - needs a reboot. Possible values include: "NeverReboots", "RequiresReboot", "RequestReboot". - :type reboot_behavior: str or + :vartype update_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.UpdateType + :ivar target_version: Target Version number. + :vartype target_version: str + :ivar estimated_install_time_in_mins: Estimated Install Time for the update. + :vartype estimated_install_time_in_mins: int + :ivar reboot_behavior: Indicates if updates are available and at least one of the updates needs + a reboot. Possible values include: "NeverReboots", "RequiresReboot", "RequestReboot". + :vartype reboot_behavior: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.InstallRebootBehavior - :param status: Status of the update. Possible values include: "DownloadPending", + :ivar status: Status of the update. Possible values include: "DownloadPending", "DownloadStarted", "DownloadCompleted", "InstallStarted", "InstallCompleted". - :type status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.UpdateStatus + :vartype status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.UpdateStatus """ _attribute_map = { @@ -5029,6 +5861,26 @@ def __init__( status: Optional[Union[str, "UpdateStatus"]] = None, **kwargs ): + """ + :keyword update_title: Title of the Update. + :paramtype update_title: str + :keyword update_size: Size of the update(In Bytes). + :paramtype update_size: float + :keyword update_type: Type of the Update. Possible values include: "Software", "Kubernetes", + "Firmware". + :paramtype update_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.UpdateType + :keyword target_version: Target Version number. + :paramtype target_version: str + :keyword estimated_install_time_in_mins: Estimated Install Time for the update. + :paramtype estimated_install_time_in_mins: int + :keyword reboot_behavior: Indicates if updates are available and at least one of the updates + needs a reboot. Possible values include: "NeverReboots", "RequiresReboot", "RequestReboot". + :paramtype reboot_behavior: str or + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.InstallRebootBehavior + :keyword status: Status of the update. Possible values include: "DownloadPending", + "DownloadStarted", "DownloadCompleted", "InstallStarted", "InstallCompleted". + :paramtype status: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.UpdateStatus + """ super(UpdateDetails, self).__init__(**kwargs) self.update_title = update_title self.update_size = update_size @@ -5082,6 +5934,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateDownloadProgress, self).__init__(**kwargs) self.download_phase = None self.percent_complete = None @@ -5120,6 +5974,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateInstallProgress, self).__init__(**kwargs) self.percent_complete = None self.number_of_updates_to_install = None @@ -5139,15 +5995,15 @@ class UpdateSummary(ARMBaseModel): :vartype type: str :ivar system_data: UpdateSummary Result. :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param device_version_number: The current version of the device in format: 1.2.17312.13.",. - :type device_version_number: str - :param friendly_device_version_name: The current version of the device in text format. - :type friendly_device_version_name: str - :param device_last_scanned_date_time: The last time when a scan was done on the device. - :type device_last_scanned_date_time: ~datetime.datetime - :param last_completed_scan_job_date_time: The time when the last scan job was completed + :ivar device_version_number: The current version of the device in format: 1.2.17312.13.",. + :vartype device_version_number: str + :ivar friendly_device_version_name: The current version of the device in text format. + :vartype friendly_device_version_name: str + :ivar device_last_scanned_date_time: The last time when a scan was done on the device. + :vartype device_last_scanned_date_time: ~datetime.datetime + :ivar last_completed_scan_job_date_time: The time when the last scan job was completed (success/cancelled/failed) on the appliance. - :type last_completed_scan_job_date_time: ~datetime.datetime + :vartype last_completed_scan_job_date_time: ~datetime.datetime :ivar last_completed_download_job_date_time: The time when the last Download job was completed (success/cancelled/failed) on the appliance. :vartype last_completed_download_job_date_time: ~datetime.datetime @@ -5268,6 +6124,17 @@ def __init__( last_completed_scan_job_date_time: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword device_version_number: The current version of the device in format: 1.2.17312.13.",. + :paramtype device_version_number: str + :keyword friendly_device_version_name: The current version of the device in text format. + :paramtype friendly_device_version_name: str + :keyword device_last_scanned_date_time: The last time when a scan was done on the device. + :paramtype device_last_scanned_date_time: ~datetime.datetime + :keyword last_completed_scan_job_date_time: The time when the last scan job was completed + (success/cancelled/failed) on the appliance. + :paramtype last_completed_scan_job_date_time: ~datetime.datetime + """ super(UpdateSummary, self).__init__(**kwargs) self.system_data = None self.device_version_number = device_version_number @@ -5300,12 +6167,12 @@ class UploadCertificateRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param authentication_type: The authentication type. Possible values include: "Invalid", + :ivar authentication_type: The authentication type. Possible values include: "Invalid", "AzureActiveDirectory". - :type authentication_type: str or + :vartype authentication_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AuthenticationType - :param certificate: Required. The base64 encoded certificate raw data. - :type certificate: str + :ivar certificate: Required. The base64 encoded certificate raw data. + :vartype certificate: str """ _validation = { @@ -5324,6 +6191,14 @@ def __init__( authentication_type: Optional[Union[str, "AuthenticationType"]] = None, **kwargs ): + """ + :keyword authentication_type: The authentication type. Possible values include: "Invalid", + "AzureActiveDirectory". + :paramtype authentication_type: str or + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AuthenticationType + :keyword certificate: Required. The base64 encoded certificate raw data. + :paramtype certificate: str + """ super(UploadCertificateRequest, self).__init__(**kwargs) self.authentication_type = authentication_type self.certificate = certificate @@ -5334,9 +6209,10 @@ class UploadCertificateResponse(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param auth_type: Specifies authentication type. Possible values include: "Invalid", + :ivar auth_type: Specifies authentication type. Possible values include: "Invalid", "AzureActiveDirectory". - :type auth_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AuthenticationType + :vartype auth_type: str or + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AuthenticationType :ivar resource_id: The resource ID of the Data Box Edge/Gateway device. :vartype resource_id: str :ivar aad_authority: Azure Active Directory tenant authority. @@ -5381,6 +6257,12 @@ def __init__( auth_type: Optional[Union[str, "AuthenticationType"]] = None, **kwargs ): + """ + :keyword auth_type: Specifies authentication type. Possible values include: "Invalid", + "AzureActiveDirectory". + :paramtype auth_type: str or + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AuthenticationType + """ super(UploadCertificateResponse, self).__init__(**kwargs) self.auth_type = auth_type self.resource_id = None @@ -5405,15 +6287,15 @@ class User(ARMBaseModel): :vartype type: str :ivar system_data: User in DataBoxEdge Resource. :vartype system_data: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SystemData - :param encrypted_password: The password details. - :type encrypted_password: + :ivar encrypted_password: The password details. + :vartype encrypted_password: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AsymmetricEncryptedSecret :ivar share_access_rights: List of shares that the user has rights on. This field should not be specified during user creation. :vartype share_access_rights: list[~azure.mgmt.databoxedge.v2021_02_01_preview.models.ShareAccessRight] - :param user_type: Type of the user. Possible values include: "Share", "LocalManagement", "ARM". - :type user_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.UserType + :ivar user_type: Type of the user. Possible values include: "Share", "LocalManagement", "ARM". + :vartype user_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.UserType """ _validation = { @@ -5441,6 +6323,14 @@ def __init__( user_type: Optional[Union[str, "UserType"]] = None, **kwargs ): + """ + :keyword encrypted_password: The password details. + :paramtype encrypted_password: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.AsymmetricEncryptedSecret + :keyword user_type: Type of the user. Possible values include: "Share", "LocalManagement", + "ARM". + :paramtype user_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.UserType + """ super(User, self).__init__(**kwargs) self.system_data = None self.encrypted_password = encrypted_password @@ -5453,11 +6343,11 @@ class UserAccessRight(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param user_id: Required. User ID (already existing in the device). - :type user_id: str - :param access_type: Required. Type of access to be allowed for the user. Possible values + :ivar user_id: Required. User ID (already existing in the device). + :vartype user_id: str + :ivar access_type: Required. Type of access to be allowed for the user. Possible values include: "Change", "Read", "Custom". - :type access_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ShareAccessType + :vartype access_type: str or ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ShareAccessType """ _validation = { @@ -5477,6 +6367,14 @@ def __init__( access_type: Union[str, "ShareAccessType"], **kwargs ): + """ + :keyword user_id: Required. User ID (already existing in the device). + :paramtype user_id: str + :keyword access_type: Required. Type of access to be allowed for the user. Possible values + include: "Change", "Read", "Custom". + :paramtype access_type: str or + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.ShareAccessType + """ super(UserAccessRight, self).__init__(**kwargs) self.user_id = user_id self.access_type = access_type @@ -5507,6 +6405,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserList, self).__init__(**kwargs) self.value = None self.next_link = None diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_addons_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_addons_operations.py index 2c92a13640b4..bf53aef7694a 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_addons_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_addons_operations.py @@ -5,25 +5,191 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_role_request( + device_name: str, + role_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + role_name: str, + addon_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "addonName": _SERIALIZER.url("addon_name", addon_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + role_name: str, + addon_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "addonName": _SERIALIZER.url("addon_name", addon_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + role_name: str, + addon_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "addonName": _SERIALIZER.url("addon_name", addon_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AddonsOperations(object): """AddonsOperations operations. @@ -47,14 +213,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_role( self, - device_name, # type: str - role_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AddonList"] + device_name: str, + role_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.AddonList"]: """Lists all the addons configured in the role. :param device_name: The device name. @@ -65,7 +231,8 @@ def list_by_role( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AddonList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.AddonList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.AddonList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AddonList"] @@ -73,37 +240,35 @@ def list_by_role( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_role.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_role_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_role.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_role_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AddonList', pipeline_response) + deserialized = self._deserialize("AddonList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -121,20 +286,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_role.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - role_name, # type: str - addon_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Addon" + device_name: str, + role_name: str, + addon_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Addon": """Gets a specific addon by name. :param device_name: The device name. @@ -155,29 +321,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -191,51 +347,42 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - role_name, # type: str - addon_name, # type: str - resource_group_name, # type: str - addon, # type: "_models.Addon" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Addon"] + device_name: str, + role_name: str, + addon_name: str, + resource_group_name: str, + addon: "_models.Addon", + **kwargs: Any + ) -> Optional["_models.Addon"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Addon"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(addon, 'Addon') + + request = build_create_or_update_request_initial( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(addon, 'Addon') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -251,18 +398,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - role_name, # type: str - addon_name, # type: str - resource_group_name, # type: str - addon, # type: "_models.Addon" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Addon"] + device_name: str, + role_name: str, + addon_name: str, + resource_group_name: str, + addon: "_models.Addon", + **kwargs: Any + ) -> LROPoller["_models.Addon"]: """Create or update a addon. :param device_name: The device name. @@ -277,15 +426,18 @@ def begin_create_or_update( :type addon: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.Addon :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Addon or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Addon] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Addon"] lro_delay = kwargs.pop( 'polling_interval', @@ -299,29 +451,21 @@ def begin_create_or_update( addon_name=addon_name, resource_group_name=resource_group_name, addon=addon, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Addon', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -333,45 +477,35 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore def _delete_initial( self, - device_name, # type: str - role_name, # type: str - addon_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + role_name: str, + addon_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + role_name=role_name, + addon_name=addon_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -384,15 +518,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - role_name, # type: str - addon_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + role_name: str, + addon_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the addon on the device. :param device_name: The device name. @@ -405,15 +540,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -429,23 +566,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'addonName': self._serialize.url("addon_name", addon_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -457,4 +585,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_alerts_operations.py index aa5e57d65099..886670c98106 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_alerts_operations.py @@ -5,23 +5,97 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AlertsOperations(object): """AlertsOperations operations. @@ -45,13 +119,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AlertList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.AlertList"]: """Gets all the alerts for a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -60,7 +134,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AlertList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.AlertList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.AlertList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertList"] @@ -68,36 +143,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AlertList', pipeline_response) + deserialized = self._deserialize("AlertList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,19 +187,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Alert" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Alert": """Gets an alert by name. Gets an alert by name. @@ -148,28 +221,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,4 +246,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_available_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_available_skus_operations.py index 33646794cd4a..bfb4723fff84 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_available_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_available_skus_operations.py @@ -5,23 +5,56 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/availableSkus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AvailableSkusOperations(object): """AvailableSkusOperations operations. @@ -45,18 +78,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DataBoxEdgeSkuList"] + **kwargs: Any + ) -> Iterable["_models.DataBoxEdgeSkuList"]: """List all the available Skus and information related to them. List all the available Skus and information related to them. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DataBoxEdgeSkuList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeSkuList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeSkuList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeSkuList"] @@ -64,34 +98,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeSkuList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeSkuList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -109,6 +138,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_bandwidth_schedules_operations.py index 3d4f49fbe32a..1e92a3664f24 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_bandwidth_schedules_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class BandwidthSchedulesOperations(object): """BandwidthSchedulesOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BandwidthSchedulesList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.BandwidthSchedulesList"]: """Gets all the bandwidth schedules for a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -61,8 +219,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BandwidthSchedulesList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.BandwidthSchedulesList] + :return: An iterator like instance of either BandwidthSchedulesList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.BandwidthSchedulesList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedulesList"] @@ -70,36 +230,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BandwidthSchedulesList', pipeline_response) + deserialized = self._deserialize("BandwidthSchedulesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,19 +274,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BandwidthSchedule" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.BandwidthSchedule": """Gets the properties of the specified bandwidth schedule. :param device_name: The device name. @@ -148,28 +306,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,49 +331,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.BandwidthSchedule" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.BandwidthSchedule"] + device_name: str, + name: str, + resource_group_name: str, + parameters: "_models.BandwidthSchedule", + **kwargs: Any + ) -> Optional["_models.BandwidthSchedule"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BandwidthSchedule"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BandwidthSchedule') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BandwidthSchedule') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -241,17 +380,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.BandwidthSchedule" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BandwidthSchedule"] + device_name: str, + name: str, + resource_group_name: str, + parameters: "_models.BandwidthSchedule", + **kwargs: Any + ) -> LROPoller["_models.BandwidthSchedule"]: """Creates or updates a bandwidth schedule. :param device_name: The device name. @@ -264,15 +405,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.BandwidthSchedule :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either BandwidthSchedule or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.BandwidthSchedule] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BandwidthSchedule or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.BandwidthSchedule] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BandwidthSchedule"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +431,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BandwidthSchedule', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -318,43 +457,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -367,14 +496,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the specified bandwidth schedule. :param device_name: The device name. @@ -385,15 +515,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -408,22 +540,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -435,4 +559,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_containers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_containers_operations.py index 82bffe37fd93..f1d3140e6f23 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_containers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_containers_operations.py @@ -5,25 +5,230 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_storage_account_request( + device_name: str, + storage_account_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + storage_account_name: str, + container_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + storage_account_name: str, + container_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + storage_account_name: str, + container_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_refresh_request_initial( + device_name: str, + storage_account_name: str, + container_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ContainersOperations(object): """ContainersOperations operations. @@ -47,14 +252,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_storage_account( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ContainerList"] + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ContainerList"]: """Lists all the containers of a storage Account in a Data Box Edge/Data Box Gateway device. Lists all the containers of a storage Account in a Data Box Edge/Data Box Gateway device. @@ -67,7 +272,8 @@ def list_by_storage_account( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ContainerList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.ContainerList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.ContainerList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerList"] @@ -75,37 +281,35 @@ def list_by_storage_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_storage_account.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_account_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_storage_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_storage_account_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ContainerList', pipeline_response) + deserialized = self._deserialize("ContainerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -123,20 +327,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_storage_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Container" + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Container": """Gets a container by name. Gets a container by name. @@ -159,29 +364,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -195,51 +390,42 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - container, # type: "_models.Container" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Container"] + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + container: "_models.Container", + **kwargs: Any + ) -> Optional["_models.Container"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Container"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(container, 'Container') + + request = build_create_or_update_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(container, 'Container') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -255,18 +441,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - container, # type: "_models.Container" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Container"] + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + container: "_models.Container", + **kwargs: Any + ) -> LROPoller["_models.Container"]: """Creates a new container or updates an existing container on the device. Creates a new container or updates an existing container on the device. @@ -283,15 +471,19 @@ def begin_create_or_update( :type container: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.Container :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Container or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Container] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Container] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Container"] lro_delay = kwargs.pop( 'polling_interval', @@ -305,29 +497,21 @@ def begin_create_or_update( container_name=container_name, resource_group_name=resource_group_name, container=container, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Container', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -339,45 +523,35 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore def _delete_initial( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -390,15 +564,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the container on the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -411,15 +586,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -435,23 +612,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -463,45 +631,35 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}'} # type: ignore def _refresh_initial( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -514,15 +672,16 @@ def _refresh_initial( _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh'} # type: ignore + + @distributed_trace def begin_refresh( self, - device_name, # type: str - storage_account_name, # type: str - container_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + storage_account_name: str, + container_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Refreshes the container metadata with the data from the cloud. Refreshes the container metadata with the data from the cloud. @@ -537,15 +696,17 @@ def begin_refresh( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -561,23 +722,14 @@ def begin_refresh( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -589,4 +741,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_devices_operations.py index bbb4d75c968e..8c47f84ba4eb 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_devices_operations.py @@ -5,25 +5,635 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_subscription_request( + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_download_updates_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_generate_certificate_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/generateCertificate') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_extended_information_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_install_updates_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_network_settings_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/networkSettings/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_scan_for_updates_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_security_settings_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_extended_information_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateExtendedInformation') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_update_summary_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_upload_certificate_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/uploadCertificate') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class DevicesOperations(object): """DevicesOperations operations. @@ -47,20 +657,22 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DataBoxEdgeDeviceList"] + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.DataBoxEdgeDeviceList"]: """Gets all the Data Box Edge/Data Box Gateway devices in a subscription. :param expand: Specify $expand=details to populate additional fields related to the resource or Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -68,36 +680,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,18 +722,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DataBoxEdgeDeviceList"] + resource_group_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.DataBoxEdgeDeviceList"]: """Gets all the Data Box Edge/Data Box Gateway devices in a resource group. :param resource_group_name: The resource group name. @@ -135,8 +743,10 @@ def list_by_resource_group( Specify $skipToken=:code:`` to populate the next page in the list. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeDeviceList] + :return: An iterator like instance of either DataBoxEdgeDeviceList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeDeviceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDeviceList"] @@ -144,37 +754,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DataBoxEdgeDeviceList', pipeline_response) + deserialized = self._deserialize("DataBoxEdgeDeviceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -192,18 +798,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDevice" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DataBoxEdgeDevice": """Gets the properties of the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -220,27 +827,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -254,47 +851,38 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - resource_group_name, # type: str - data_box_edge_device, # type: "_models.DataBoxEdgeDevice" - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDevice" + device_name: str, + resource_group_name: str, + data_box_edge_device: "_models.DataBoxEdgeDevice", + **kwargs: Any + ) -> "_models.DataBoxEdgeDevice": cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') + + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(data_box_edge_device, 'DataBoxEdgeDevice') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -308,16 +896,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - resource_group_name, # type: str - data_box_edge_device, # type: "_models.DataBoxEdgeDevice" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DataBoxEdgeDevice"] + device_name: str, + resource_group_name: str, + data_box_edge_device: "_models.DataBoxEdgeDevice", + **kwargs: Any + ) -> LROPoller["_models.DataBoxEdgeDevice"]: """Creates or updates a Data Box Edge/Data Box Gateway resource. :param device_name: The device name. @@ -325,18 +915,24 @@ def begin_create_or_update( :param resource_group_name: The resource group name. :type resource_group_name: str :param data_box_edge_device: The resource object. - :type data_box_edge_device: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeDevice + :type data_box_edge_device: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeDevice :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DataBoxEdgeDevice or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeDevice] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DataBoxEdgeDevice or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeDevice] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DataBoxEdgeDevice"] lro_delay = kwargs.pop( 'polling_interval', @@ -348,27 +944,21 @@ def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, data_box_edge_device=data_box_edge_device, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DataBoxEdgeDevice', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -380,41 +970,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore def _delete_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -427,13 +1007,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -442,15 +1023,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -464,21 +1047,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -490,16 +1066,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + @distributed_trace def update( self, - device_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.DataBoxEdgeDevicePatch" - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDevice" + device_name: str, + resource_group_name: str, + parameters: "_models.DataBoxEdgeDevicePatch", + **kwargs: Any + ) -> "_models.DataBoxEdgeDevice": """Modifies a Data Box Edge/Data Box Gateway resource. :param device_name: The device name. @@ -518,32 +1095,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataBoxEdgeDevicePatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -557,41 +1124,32 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}'} # type: ignore + def _download_updates_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._download_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_download_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._download_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -604,13 +1162,14 @@ def _download_updates_initial( _download_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + + @distributed_trace def begin_download_updates( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Downloads the updates on a Data Box Edge/Data Box Gateway device. Downloads the updates on a Data Box Edge/Data Box Gateway device. @@ -621,15 +1180,17 @@ def begin_download_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -643,21 +1204,14 @@ def begin_download_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -669,15 +1223,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_download_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates'} # type: ignore + @distributed_trace def generate_certificate( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.GenerateCertResponse" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.GenerateCertResponse": """Generates certificate for activation key. :param device_name: The device name. @@ -694,27 +1249,17 @@ def generate_certificate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.generate_certificate.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_generate_certificate_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.generate_certificate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -728,15 +1273,17 @@ def generate_certificate( return cls(pipeline_response, deserialized, {}) return deserialized + generate_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/generateCertificate'} # type: ignore + + @distributed_trace def get_extended_information( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDeviceExtendedInfo" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DataBoxEdgeDeviceExtendedInfo": """Gets additional information for the specified Azure Stack Edge/Data Box Gateway device. :param device_name: The device name. @@ -753,27 +1300,17 @@ def get_extended_information( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_extended_information.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_extended_information_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_extended_information.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -787,41 +1324,32 @@ def get_extended_information( return cls(pipeline_response, deserialized, {}) return deserialized + get_extended_information.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation'} # type: ignore + def _install_updates_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._install_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_install_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._install_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -834,13 +1362,14 @@ def _install_updates_initial( _install_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + + @distributed_trace def begin_install_updates( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Installs the updates on the Data Box Edge/Data Box Gateway device. Installs the updates on the Data Box Edge/Data Box Gateway device. @@ -851,15 +1380,17 @@ def begin_install_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -873,21 +1404,14 @@ def begin_install_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -899,15 +1423,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_install_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates'} # type: ignore + @distributed_trace def get_network_settings( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.NetworkSettings" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.NetworkSettings": """Gets the network settings of the specified Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -924,27 +1449,17 @@ def get_network_settings( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_network_settings.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_network_settings_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_network_settings.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -958,41 +1473,32 @@ def get_network_settings( return cls(pipeline_response, deserialized, {}) return deserialized + get_network_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/networkSettings/default'} # type: ignore + def _scan_for_updates_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._scan_for_updates_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_scan_for_updates_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._scan_for_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1005,13 +1511,14 @@ def _scan_for_updates_initial( _scan_for_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore + + @distributed_trace def begin_scan_for_updates( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Scans for updates on a Data Box Edge/Data Box Gateway device. Scans for updates on a Data Box Edge/Data Box Gateway device. @@ -1022,15 +1529,17 @@ def begin_scan_for_updates( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1044,21 +1553,14 @@ def begin_scan_for_updates( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1070,47 +1572,37 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_scan_for_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates'} # type: ignore def _create_or_update_security_settings_initial( self, - device_name, # type: str - resource_group_name, # type: str - security_settings, # type: "_models.SecuritySettings" - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + security_settings: "_models.SecuritySettings", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_security_settings_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(security_settings, 'SecuritySettings') + + request = build_create_or_update_security_settings_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_security_settings_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(security_settings, 'SecuritySettings') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1123,14 +1615,15 @@ def _create_or_update_security_settings_initial( _create_or_update_security_settings_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + + @distributed_trace def begin_create_or_update_security_settings( self, - device_name, # type: str - resource_group_name, # type: str - security_settings, # type: "_models.SecuritySettings" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + security_settings: "_models.SecuritySettings", + **kwargs: Any + ) -> LROPoller[None]: """Updates the security settings on a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -1141,15 +1634,18 @@ def begin_create_or_update_security_settings( :type security_settings: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.SecuritySettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1161,24 +1657,18 @@ def begin_create_or_update_security_settings( device_name=device_name, resource_group_name=resource_group_name, security_settings=security_settings, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1190,16 +1680,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_security_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update'} # type: ignore + @distributed_trace def update_extended_information( self, - device_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.DataBoxEdgeDeviceExtendedInfoPatch" - **kwargs # type: Any - ): - # type: (...) -> "_models.DataBoxEdgeDeviceExtendedInfo" + device_name: str, + resource_group_name: str, + parameters: "_models.DataBoxEdgeDeviceExtendedInfoPatch", + **kwargs: Any + ) -> "_models.DataBoxEdgeDeviceExtendedInfo": """Gets additional information for the specified Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -1207,7 +1698,8 @@ def update_extended_information( :param resource_group_name: The resource group name. :type resource_group_name: str :param parameters: The patch object. - :type parameters: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeDeviceExtendedInfoPatch + :type parameters: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeDeviceExtendedInfoPatch :keyword callable cls: A custom type or function that will be passed the direct response :return: DataBoxEdgeDeviceExtendedInfo, or the result of cls(response) :rtype: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.DataBoxEdgeDeviceExtendedInfo @@ -1218,32 +1710,22 @@ def update_extended_information( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update_extended_information.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'DataBoxEdgeDeviceExtendedInfoPatch') + + request = build_update_extended_information_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.update_extended_information.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataBoxEdgeDeviceExtendedInfoPatch') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1257,16 +1739,19 @@ def update_extended_information( return cls(pipeline_response, deserialized, {}) return deserialized + update_extended_information.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateExtendedInformation'} # type: ignore + + @distributed_trace def get_update_summary( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.UpdateSummary" - """Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.UpdateSummary": + """Gets information about the availability of updates based on the last scan of the device. It + also gets information about any ongoing download or install jobs on the device. Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. @@ -1285,27 +1770,17 @@ def get_update_summary( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_update_summary.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_update_summary_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get_update_summary.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1319,16 +1794,18 @@ def get_update_summary( return cls(pipeline_response, deserialized, {}) return deserialized + get_update_summary.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default'} # type: ignore + + @distributed_trace def upload_certificate( self, - device_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.UploadCertificateRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.UploadCertificateResponse" + device_name: str, + resource_group_name: str, + parameters: "_models.UploadCertificateRequest", + **kwargs: Any + ) -> "_models.UploadCertificateResponse": """Uploads registration certificate for the device. :param device_name: The device name. @@ -1347,32 +1824,22 @@ def upload_certificate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.upload_certificate.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'UploadCertificateRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_upload_certificate_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.upload_certificate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'UploadCertificateRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1386,4 +1853,6 @@ def upload_certificate( return cls(pipeline_response, deserialized, {}) return deserialized + upload_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/uploadCertificate'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_jobs_operations.py index 1fa2b0e1ad23..90313baccb44 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_jobs_operations.py @@ -5,22 +5,61 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class JobsOperations(object): """JobsOperations operations. @@ -44,14 +83,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Job" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Job": """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. @@ -72,28 +111,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -107,4 +136,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_monitoring_config_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_monitoring_config_operations.py index dc3a756ee375..f095c8298e42 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_monitoring_config_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_monitoring_config_operations.py @@ -5,25 +5,185 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + device_name: str, + role_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + role_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + role_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + role_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class MonitoringConfigOperations(object): """MonitoringConfigOperations operations. @@ -47,14 +207,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - device_name, # type: str - role_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.MonitoringMetricConfigurationList"] + device_name: str, + role_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.MonitoringMetricConfigurationList"]: """Lists metric configurations in a role. Lists metric configurations in a role. @@ -66,8 +226,10 @@ def list( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MonitoringMetricConfigurationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MonitoringMetricConfigurationList] + :return: An iterator like instance of either MonitoringMetricConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MonitoringMetricConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringMetricConfigurationList"] @@ -75,37 +237,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('MonitoringMetricConfigurationList', pipeline_response) + deserialized = self._deserialize("MonitoringMetricConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -123,19 +283,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - role_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.MonitoringMetricConfiguration" + device_name: str, + role_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.MonitoringMetricConfiguration": """Gets a metric configuration of a role. Gets a metric configuration of a role. @@ -156,28 +317,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -191,49 +342,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - role_name, # type: str - resource_group_name, # type: str - monitoring_metric_configuration, # type: "_models.MonitoringMetricConfiguration" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.MonitoringMetricConfiguration"] + device_name: str, + role_name: str, + resource_group_name: str, + monitoring_metric_configuration: "_models.MonitoringMetricConfiguration", + **kwargs: Any + ) -> Optional["_models.MonitoringMetricConfiguration"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MonitoringMetricConfiguration"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(monitoring_metric_configuration, 'MonitoringMetricConfiguration') + + request = build_create_or_update_request_initial( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(monitoring_metric_configuration, 'MonitoringMetricConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -249,17 +391,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - role_name, # type: str - resource_group_name, # type: str - monitoring_metric_configuration, # type: "_models.MonitoringMetricConfiguration" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.MonitoringMetricConfiguration"] + device_name: str, + role_name: str, + resource_group_name: str, + monitoring_metric_configuration: "_models.MonitoringMetricConfiguration", + **kwargs: Any + ) -> LROPoller["_models.MonitoringMetricConfiguration"]: """Creates a new metric configuration or updates an existing one for a role. Creates a new metric configuration or updates an existing one for a role. @@ -271,18 +415,24 @@ def begin_create_or_update( :param resource_group_name: The resource group name. :type resource_group_name: str :param monitoring_metric_configuration: The metric configuration. - :type monitoring_metric_configuration: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.MonitoringMetricConfiguration + :type monitoring_metric_configuration: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.MonitoringMetricConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either MonitoringMetricConfiguration or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MonitoringMetricConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringMetricConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.MonitoringMetricConfiguration] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringMetricConfiguration"] lro_delay = kwargs.pop( 'polling_interval', @@ -295,28 +445,21 @@ def begin_create_or_update( role_name=role_name, resource_group_name=resource_group_name, monitoring_metric_configuration=monitoring_metric_configuration, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MonitoringMetricConfiguration', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -328,43 +471,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore def _delete_initial( self, - device_name, # type: str - role_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + role_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -377,14 +510,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - role_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + role_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """deletes a new metric configuration for a role. deletes a new metric configuration for a role. @@ -397,15 +531,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -420,22 +556,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -447,4 +575,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_nodes_operations.py index fdddca8309c8..617a70f42e6e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_nodes_operations.py @@ -5,23 +5,60 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/nodes') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class NodesOperations(object): """NodesOperations operations. @@ -45,13 +82,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.NodeList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.NodeList"]: """Gets all the nodes currently configured under this Data Box Edge device. :param device_name: The device name. @@ -60,7 +97,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either NodeList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.NodeList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.NodeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeList"] @@ -68,36 +106,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('NodeList', pipeline_response) + deserialized = self._deserialize("NodeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,6 +150,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_operations.py index 046e4bc51513..7658a41d2ebf 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.DataBoxEdge/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,18 +72,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationsList"] + **kwargs: Any + ) -> Iterable["_models.OperationsList"]: """List all the supported operations. List all the supported operations. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationsList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.OperationsList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.OperationsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationsList"] @@ -64,30 +92,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationsList', pipeline_response) + deserialized = self._deserialize("OperationsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -105,6 +130,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_operations_status_operations.py index e670f8a84b7d..dd022c0aa7b6 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_operations_status_operations.py @@ -5,22 +5,61 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/operationsStatus/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class OperationsStatusOperations(object): """OperationsStatusOperations operations. @@ -44,14 +83,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Job" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Job": """Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. Gets the details of a specified job on a Data Box Edge/Data Box Gateway device. @@ -72,28 +111,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -107,4 +136,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/operationsStatus/{name}'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_orders_operations.py index 7d118289e192..24fabab4886e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_orders_operations.py @@ -5,25 +5,212 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_dc_access_code_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default/listDCAccessCode') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class OrdersOperations(object): """OrdersOperations operations. @@ -47,13 +234,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OrderList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.OrderList"]: """Lists all the orders related to a Data Box Edge/Data Box Gateway device. Lists all the orders related to a Data Box Edge/Data Box Gateway device. @@ -64,7 +251,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OrderList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.OrderList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.OrderList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OrderList"] @@ -72,36 +260,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OrderList', pipeline_response) + deserialized = self._deserialize("OrderList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,18 +304,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Order" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Order": """Gets a specific order by name. Gets a specific order by name. @@ -149,27 +335,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,47 +359,38 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - resource_group_name, # type: str - order, # type: "_models.Order" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Order"] + device_name: str, + resource_group_name: str, + order: "_models.Order", + **kwargs: Any + ) -> Optional["_models.Order"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Order"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(order, 'Order') + + request = build_create_or_update_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(order, 'Order') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,16 +406,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - resource_group_name, # type: str - order, # type: "_models.Order" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Order"] + device_name: str, + resource_group_name: str, + order: "_models.Order", + **kwargs: Any + ) -> LROPoller["_models.Order"]: """Creates or updates an order. Creates or updates an order. @@ -261,15 +430,18 @@ def begin_create_or_update( :type order: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.Order :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Order or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Order] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Order"] lro_delay = kwargs.pop( 'polling_interval', @@ -281,27 +453,21 @@ def begin_create_or_update( device_name=device_name, resource_group_name=resource_group_name, order=order, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Order', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -313,41 +479,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore def _delete_initial( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -360,13 +516,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the order related to the device. Deletes the order related to the device. @@ -377,15 +534,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -399,21 +558,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -425,15 +577,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default'} # type: ignore + @distributed_trace def list_dc_access_code( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DCAccessCode" + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DCAccessCode": """Gets the DCAccess Code. Gets the DCAccess Code. @@ -452,27 +605,17 @@ def list_dc_access_code( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_dc_access_code.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_dc_access_code_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_dc_access_code.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -486,4 +629,6 @@ def list_dc_access_code( return cls(pipeline_response, deserialized, {}) return deserialized + list_dc_access_code.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default/listDCAccessCode'} # type: ignore + diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_roles_operations.py index 252a36cf677a..551843c5637f 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_roles_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class RolesOperations(object): """RolesOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RoleList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.RoleList"]: """Lists all the roles configured in a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -62,7 +220,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RoleList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.RoleList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleList"] @@ -70,36 +229,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RoleList', pipeline_response) + deserialized = self._deserialize("RoleList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,19 +273,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Role" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Role": """Gets a specific role by name. :param device_name: The device name. @@ -148,28 +305,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,49 +330,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - role, # type: "_models.Role" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Role"] + device_name: str, + name: str, + resource_group_name: str, + role: "_models.Role", + **kwargs: Any + ) -> Optional["_models.Role"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Role"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(role, 'Role') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(role, 'Role') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -241,17 +379,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - role, # type: "_models.Role" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Role"] + device_name: str, + name: str, + resource_group_name: str, + role: "_models.Role", + **kwargs: Any + ) -> LROPoller["_models.Role"]: """Create or update a role. :param device_name: The device name. @@ -264,15 +404,18 @@ def begin_create_or_update( :type role: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.Role :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Role or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Role] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Role"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +428,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, role=role, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Role', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -318,43 +454,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -367,14 +493,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the role on the device. :param device_name: The device name. @@ -385,15 +512,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -408,22 +537,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -435,4 +556,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_shares_operations.py index f1a4686a42d2..784381f99487 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_shares_operations.py @@ -5,25 +5,220 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_refresh_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SharesOperations(object): """SharesOperations operations. @@ -47,13 +242,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ShareList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ShareList"]: """Lists all the shares in a Data Box Edge/Data Box Gateway device. Lists all the shares in a Data Box Edge/Data Box Gateway device. @@ -64,7 +259,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ShareList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.ShareList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.ShareList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ShareList"] @@ -72,36 +268,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ShareList', pipeline_response) + deserialized = self._deserialize("ShareList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +312,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Share" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Share": """Gets a share by name. Gets a share by name. @@ -152,28 +346,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -187,49 +371,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - share, # type: "_models.Share" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Share"] + device_name: str, + name: str, + resource_group_name: str, + share: "_models.Share", + **kwargs: Any + ) -> Optional["_models.Share"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Share"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(share, 'Share') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(share, 'Share') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,17 +420,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - share, # type: "_models.Share" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Share"] + device_name: str, + name: str, + resource_group_name: str, + share: "_models.Share", + **kwargs: Any + ) -> LROPoller["_models.Share"]: """Creates a new share or updates an existing share on the device. Creates a new share or updates an existing share on the device. @@ -270,15 +447,18 @@ def begin_create_or_update( :type share: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.Share :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Share or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Share] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Share"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +471,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, share=share, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Share', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -324,43 +497,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,14 +536,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the share on the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -391,15 +555,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -414,22 +580,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -441,43 +599,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}'} # type: ignore def _refresh_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -490,14 +638,15 @@ def _refresh_initial( _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore + + @distributed_trace def begin_refresh( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Refreshes the share metadata with the data from the cloud. Refreshes the share metadata with the data from the cloud. @@ -510,15 +659,17 @@ def begin_refresh( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -533,22 +684,14 @@ def begin_refresh( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -560,4 +703,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_storage_account_credentials_operations.py index 5ebf92945344..3516427e5558 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_storage_account_credentials_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class StorageAccountCredentialsOperations(object): """StorageAccountCredentialsOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountCredentialList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountCredentialList"]: """Gets all the storage account credentials in a Data Box Edge/Data Box Gateway device. Gets all the storage account credentials in a Data Box Edge/Data Box Gateway device. @@ -63,8 +221,10 @@ def list_by_data_box_edge_device( :param resource_group_name: The resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageAccountCredentialList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.StorageAccountCredentialList] + :return: An iterator like instance of either StorageAccountCredentialList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.StorageAccountCredentialList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredentialList"] @@ -72,36 +232,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('StorageAccountCredentialList', pipeline_response) + deserialized = self._deserialize("StorageAccountCredentialList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +276,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccountCredential" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.StorageAccountCredential": """Gets the properties of the specified storage account credential. :param device_name: The device name. @@ -150,28 +308,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,49 +333,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - storage_account_credential, # type: "_models.StorageAccountCredential" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageAccountCredential"] + device_name: str, + name: str, + resource_group_name: str, + storage_account_credential: "_models.StorageAccountCredential", + **kwargs: Any + ) -> Optional["_models.StorageAccountCredential"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccountCredential"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(storage_account_credential, 'StorageAccountCredential') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_account_credential, 'StorageAccountCredential') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -243,17 +382,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - storage_account_credential, # type: "_models.StorageAccountCredential" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageAccountCredential"] + device_name: str, + name: str, + resource_group_name: str, + storage_account_credential: "_models.StorageAccountCredential", + **kwargs: Any + ) -> LROPoller["_models.StorageAccountCredential"]: """Creates or updates the storage account credential. :param device_name: The device name. @@ -263,18 +404,24 @@ def begin_create_or_update( :param resource_group_name: The resource group name. :type resource_group_name: str :param storage_account_credential: The storage account credential. - :type storage_account_credential: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.StorageAccountCredential + :type storage_account_credential: + ~azure.mgmt.databoxedge.v2021_02_01_preview.models.StorageAccountCredential :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either StorageAccountCredential or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.StorageAccountCredential] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either StorageAccountCredential or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.StorageAccountCredential] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountCredential"] lro_delay = kwargs.pop( 'polling_interval', @@ -287,28 +434,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, storage_account_credential=storage_account_credential, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccountCredential', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -320,43 +460,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -369,14 +499,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the storage account credential. :param device_name: The device name. @@ -387,15 +518,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -410,22 +543,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -437,4 +562,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_storage_accounts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_storage_accounts_operations.py index e559cc8201e0..0e8f95bdb2da 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_storage_accounts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_storage_accounts_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + storage_account_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + storage_account_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + storage_account_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "storageAccountName": _SERIALIZER.url("storage_account_name", storage_account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageAccountList"] + device_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageAccountList"]: """Lists all the StorageAccounts in a Data Box Edge/Data Box Gateway device. Lists all the StorageAccounts in a Data Box Edge/Data Box Gateway device. @@ -64,7 +222,8 @@ def list_by_data_box_edge_device( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either StorageAccountList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.StorageAccountList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.StorageAccountList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountList"] @@ -72,36 +231,33 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('StorageAccountList', pipeline_response) + deserialized = self._deserialize("StorageAccountList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +275,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageAccount" + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.StorageAccount": """Gets a StorageAccount by name. Gets a StorageAccount by name. @@ -152,28 +309,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -187,49 +334,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - storage_account, # type: "_models.StorageAccount" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.StorageAccount"] + device_name: str, + storage_account_name: str, + resource_group_name: str, + storage_account: "_models.StorageAccount", + **kwargs: Any + ) -> Optional["_models.StorageAccount"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(storage_account, 'StorageAccount') + + request = build_create_or_update_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_account, 'StorageAccount') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,17 +383,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - storage_account, # type: "_models.StorageAccount" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageAccount"] + device_name: str, + storage_account_name: str, + resource_group_name: str, + storage_account: "_models.StorageAccount", + **kwargs: Any + ) -> LROPoller["_models.StorageAccount"]: """Creates a new StorageAccount or updates an existing StorageAccount on the device. Creates a new StorageAccount or updates an existing StorageAccount on the device. @@ -270,15 +410,20 @@ def begin_create_or_update( :type storage_account: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.StorageAccount :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either StorageAccount or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.StorageAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either StorageAccount or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.StorageAccount] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +436,21 @@ def begin_create_or_update( storage_account_name=storage_account_name, resource_group_name=resource_group_name, storage_account=storage_account, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -324,43 +462,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore def _delete_initial( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + storage_account_name=storage_account_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,14 +501,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - storage_account_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + storage_account_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the StorageAccount on the Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -391,15 +520,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -414,22 +545,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'storageAccountName': self._serialize.url("storage_account_name", storage_account_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -441,4 +564,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_triggers_operations.py index d9813804152e..3eefa101a798 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_triggers_operations.py @@ -5,25 +5,187 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class TriggersOperations(object): """TriggersOperations operations. @@ -47,14 +209,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.TriggerList"] + device_name: str, + resource_group_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.TriggerList"]: """Lists all the triggers configured in the device. :param device_name: The device name. @@ -66,7 +228,8 @@ def list_by_data_box_edge_device( :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TriggerList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.TriggerList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.TriggerList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TriggerList"] @@ -74,38 +237,35 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TriggerList', pipeline_response) + deserialized = self._deserialize("TriggerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -123,19 +283,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Trigger" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.Trigger": """Get a specific trigger by name. :param device_name: The device name. @@ -154,28 +315,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -189,49 +340,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - trigger, # type: "_models.Trigger" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Trigger"] + device_name: str, + name: str, + resource_group_name: str, + trigger: "_models.Trigger", + **kwargs: Any + ) -> Optional["_models.Trigger"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Trigger"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(trigger, 'Trigger') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(trigger, 'Trigger') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,17 +389,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - trigger, # type: "_models.Trigger" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Trigger"] + device_name: str, + name: str, + resource_group_name: str, + trigger: "_models.Trigger", + **kwargs: Any + ) -> LROPoller["_models.Trigger"]: """Creates or updates a trigger. :param device_name: Creates or updates a trigger. @@ -270,15 +414,19 @@ def begin_create_or_update( :type trigger: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.Trigger :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Trigger or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Trigger] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.Trigger] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Trigger"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +439,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, trigger=trigger, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Trigger', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -324,43 +465,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,14 +504,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the trigger on the gateway device. :param device_name: The device name. @@ -391,15 +523,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -414,22 +548,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -441,4 +567,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'} # type: ignore diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_users_operations.py index cfcd2c6f7dcf..de43ba6806f0 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_users_operations.py @@ -5,25 +5,187 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_data_box_edge_device_request( + device_name: str, + subscription_id: str, + resource_group_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + device_name: str, + name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}') + path_format_arguments = { + "deviceName": _SERIALIZER.url("device_name", device_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class UsersOperations(object): """UsersOperations operations. @@ -47,14 +209,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_data_box_edge_device( self, - device_name, # type: str - resource_group_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UserList"] + device_name: str, + resource_group_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.UserList"]: """Gets all the users registered on a Data Box Edge/Data Box Gateway device. :param device_name: The device name. @@ -66,7 +228,8 @@ def list_by_data_box_edge_device( :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.UserList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databoxedge.v2021_02_01_preview.models.UserList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UserList"] @@ -74,38 +237,35 @@ def list_by_data_box_edge_device( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_data_box_edge_device.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=self.list_by_data_box_edge_device.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_data_box_edge_device_request( + device_name=device_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('UserList', pipeline_response) + deserialized = self._deserialize("UserList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -123,19 +283,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_data_box_edge_device.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users'} # type: ignore + @distributed_trace def get( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.User" + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.User": """Gets the properties of the specified user. :param device_name: The device name. @@ -154,28 +315,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -189,49 +340,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + def _create_or_update_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - user, # type: "_models.User" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.User"] + device_name: str, + name: str, + resource_group_name: str, + user: "_models.User", + **kwargs: Any + ) -> Optional["_models.User"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.User"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(user, 'User') + + request = build_create_or_update_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(user, 'User') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,17 +389,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - user, # type: "_models.User" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.User"] + device_name: str, + name: str, + resource_group_name: str, + user: "_models.User", + **kwargs: Any + ) -> LROPoller["_models.User"]: """Creates a new user or updates an existing user's information on a Data Box Edge/Data Box Gateway device. @@ -271,15 +415,18 @@ def begin_create_or_update( :type user: ~azure.mgmt.databoxedge.v2021_02_01_preview.models.User :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either User or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databoxedge.v2021_02_01_preview.models.User] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.User"] lro_delay = kwargs.pop( 'polling_interval', @@ -292,28 +439,21 @@ def begin_create_or_update( name=name, resource_group_name=resource_group_name, user=user, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('User', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -325,43 +465,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore def _delete_initial( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + device_name=device_name, + name=name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -374,14 +504,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - device_name, # type: str - name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + device_name: str, + name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the user on a databox edge/gateway device. :param device_name: The device name. @@ -392,15 +523,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -415,22 +548,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'deviceName': self._serialize.url("device_name", device_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -442,4 +567,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}'} # type: ignore